diff --git a/.github/composite-actions/build-vector-extension/action.yml b/.github/composite-actions/build-vector-extension/action.yml index d992361966b..d06697496f8 100644 --- a/.github/composite-actions/build-vector-extension/action.yml +++ b/.github/composite-actions/build-vector-extension/action.yml @@ -12,7 +12,7 @@ runs: - name: Build vector Extension run: | cd .. - export VECTOR_VERSION="0.5.1" + export VECTOR_VERSION="0.7.2" sudo apt-get install wget wget https://github.com/pgvector/pgvector/archive/refs/tags/v${VECTOR_VERSION}.tar.gz tar -xvzf v${VECTOR_VERSION}.tar.gz diff --git a/.github/composite-actions/minor-version-upgrade-util/action.yml b/.github/composite-actions/minor-version-upgrade-util/action.yml index 5588f9101b9..d2425074168 100644 --- a/.github/composite-actions/minor-version-upgrade-util/action.yml +++ b/.github/composite-actions/minor-version-upgrade-util/action.yml @@ -82,7 +82,7 @@ runs: mvn test export inputFilesPath=input for filename in $(grep -v "^ignore.*\|^#.*\|^cmd.*\|^all.*\|^$" upgrade/$base_dir/schedule); do - sed -i "s/$filename[ ]*$/$filename-vu-verify\\n$filename-vu-cleanup/g" upgrade/$base_dir/schedule + sed -i "s/\b$filename[ ]*\b$/$filename-vu-verify\\n$filename-vu-cleanup/g" upgrade/$base_dir/schedule done export scheduleFile=upgrade/$base_dir/schedule mvn test diff --git a/.github/composite-actions/run-verify-tests/action.yml b/.github/composite-actions/run-verify-tests/action.yml index 9707a160898..aaf86c53fca 100644 --- a/.github/composite-actions/run-verify-tests/action.yml +++ b/.github/composite-actions/run-verify-tests/action.yml @@ -64,8 +64,14 @@ runs: mvn test export inputFilesPath=input + # Skip test BABEL-404 for previous versions while testing dump/restore since it specifies + # contraint column ordering which is expected to fail after fix for BABEL-4888 + if [[ "${{ inputs.dump_restore }}" == 'true' && "${{ inputs.extension_branch }}" != 'latest' ]];then + sed -i "/BABEL-404\>/d" upgrade/$base_dir/schedule + fi + for filename in $(grep -v "^ignore.*\|^#.*\|^cmd.*\|^all.*\|^$" upgrade/$base_dir/schedule); do - sed -i "s/$filename[ ]*$/$filename-vu-verify\\n$filename-vu-cleanup/g" upgrade/$base_dir/schedule + sed -i "s/\b$filename[ ]*\b$/$filename-vu-verify\\n$filename-vu-cleanup/g" upgrade/$base_dir/schedule done export scheduleFile=upgrade/$base_dir/schedule mvn test diff --git a/.github/composite-actions/setup-base-version/action.yml b/.github/composite-actions/setup-base-version/action.yml index 1932a2fa283..283a40a337b 100644 --- a/.github/composite-actions/setup-base-version/action.yml +++ b/.github/composite-actions/setup-base-version/action.yml @@ -66,7 +66,7 @@ runs: - name: Build vector Extension run: | cd .. - export VECTOR_VERSION="0.5.1" + export VECTOR_VERSION="0.7.2" sudo apt-get install wget wget https://github.com/pgvector/pgvector/archive/refs/tags/v${VECTOR_VERSION}.tar.gz tar -xvzf v${VECTOR_VERSION}.tar.gz @@ -192,6 +192,13 @@ runs: export inputFilesPath=upgrade/$base_dir/preparation mvn test + + # Skip test BABEL-404 for previous versions while testing dump/restore since it specifies + # contraint column ordering which is expected to fail after fix for BABEL-4888 + if [[ "${{ inputs.dump_restore }}" == 'true' && "${{ inputs.extension_branch }}" != 'latest' ]];then + sed -i "/BABEL-404\>/d" upgrade/$base_dir/schedule + fi + for filename in $(grep -v "^ignore.*\|^#.*\|^cmd.*\|^all.*\|^$" upgrade/$base_dir/schedule); do if [[ ! ($(find input/ -name $filename"-vu-prepare.*") || $(find input/ -name $filename"-vu-verify.*")) ]]; then printf '%s\n' "ERROR: Cannot find Test file "$filename"-vu-prepare or "$filename"-vu-verify in input directory !!" >&2 @@ -201,7 +208,7 @@ runs: export isUpgradeTestMode=false export inputFilesPath=input for filename in $(grep -v "^ignore.*\|^#.*\|^cmd.*\|^all.*\|^$" upgrade/$base_dir/schedule); do - sed -i "s/$filename[ ]*$/$filename-vu-prepare/g" upgrade/$base_dir/schedule + sed -i "s/\b$filename[ ]*\b$/$filename-vu-prepare/g" upgrade/$base_dir/schedule done export scheduleFile=upgrade/$base_dir/schedule mvn test diff --git a/.github/configuration/upgrade-test-configuration.yml b/.github/configuration/upgrade-test-configuration.yml index 639c687a6ea..0578fa3f220 100644 --- a/.github/configuration/upgrade-test-configuration.yml +++ b/.github/configuration/upgrade-test-configuration.yml @@ -98,6 +98,18 @@ upgrade-version: [{ } ], }, +{ + upgrade-path: [ + { + version: '14.14', + upgrade-type: null + }, + { + version: target.latest, + upgrade-type: major + } + ], +}, { upgrade-path: [ { @@ -113,7 +125,7 @@ upgrade-version: [{ { upgrade-path: [ { - version: 15.8, + version: 15.9, upgrade-type: null }, { @@ -149,7 +161,7 @@ upgrade-version: [{ { upgrade-path: [ { - version: 16.3, + version: 16.4, upgrade-type: null }, { @@ -165,11 +177,11 @@ upgrade-version: [{ upgrade-type: null }, { - version: 14.13, + version: '14.14', upgrade-type: major }, { - version: 15.8, + version: 15.9, upgrade-type: major }, { @@ -195,7 +207,7 @@ upgrade-version: [{ { upgrade-path: [ { - version: 15.8, + version: 15.9, upgrade-type: null }, { @@ -208,7 +220,7 @@ upgrade-version: [{ { upgrade-path: [ { - version: 15.8, + version: 15.9, upgrade-type: null }, { @@ -225,7 +237,7 @@ upgrade-version: [{ upgrade-type: null }, { - version: 15.8, + version: 15.9, upgrade-type: minor }, { diff --git a/.github/template/version-branch-template.yml b/.github/template/version-branch-template.yml index dbbb9ea84fc..66033b31f6a 100644 --- a/.github/template/version-branch-template.yml +++ b/.github/template/version-branch-template.yml @@ -44,6 +44,9 @@ engine_branch: BABEL_2_9_STABLE__PG_14_12 extension_branch: BABEL_2_9_STABLE '14.13': + engine_branch: BABEL_2_10_STABLE__PG_14_13 + extension_branch: BABEL_2_10_STABLE +'14.14': engine_branch: BABEL_2_X_DEV__PG_14_X extension_branch: BABEL_2_X_DEV '15.2': @@ -65,6 +68,9 @@ engine_branch: BABEL_3_6_STABLE__PG_15_7 extension_branch: BABEL_3_6_STABLE '15.8': + engine_branch: BABEL_3_7_STABLE__PG_15_8 + extension_branch: BABEL_3_7_STABLE +'15.9': engine_branch: BABEL_3_X_DEV__PG_15_X extension_branch: BABEL_3_X_DEV '16.1': @@ -76,6 +82,9 @@ '16.3': engine_branch: BABEL_4_2_STABLE__PG_16_3 extension_branch: BABEL_4_2_STABLE +'16.4': + engine_branch: BABEL_4_3_STABLE__PG_16_4 + extension_branch: BABEL_4_3_STABLE 'source.latest': engine_branch: latest extension_branch: latest diff --git a/.github/workflows/major-version-upgrade.yml b/.github/workflows/major-version-upgrade.yml index 4b3dc0e891c..770462fbd26 100644 --- a/.github/workflows/major-version-upgrade.yml +++ b/.github/workflows/major-version-upgrade.yml @@ -6,8 +6,8 @@ jobs: env: OLD_INSTALL_DIR: psql_source NEW_INSTALL_DIR: psql_target - ENGINE_BRANCH_FROM: BABEL_2_7_STABLE__PG_14_10 - EXTENSION_BRANCH_FROM: BABEL_2_7_STABLE + ENGINE_BRANCH_FROM: BABEL_2_X_DEV__PG_14_X + EXTENSION_BRANCH_FROM: BABEL_2_X_DEV runs-on: ubuntu-20.04 steps: diff --git a/.github/workflows/minor-version-upgrade.yml b/.github/workflows/minor-version-upgrade.yml index 21d5f4789e0..c76cb0b140a 100644 --- a/.github/workflows/minor-version-upgrade.yml +++ b/.github/workflows/minor-version-upgrade.yml @@ -95,7 +95,7 @@ jobs: - name: Build vector Extension run: | cd .. - export VECTOR_VERSION="0.5.1" + export VECTOR_VERSION="0.7.2" sudo apt-get install wget wget https://github.com/pgvector/pgvector/archive/refs/tags/v${VECTOR_VERSION}.tar.gz tar -xvzf v${VECTOR_VERSION}.tar.gz diff --git a/.github/workflows/singledb-version-upgrade.yml b/.github/workflows/singledb-version-upgrade.yml index 0ad17f0d641..d523b552ac3 100644 --- a/.github/workflows/singledb-version-upgrade.yml +++ b/.github/workflows/singledb-version-upgrade.yml @@ -7,8 +7,8 @@ jobs: env: OLD_INSTALL_DIR: psql_source NEW_INSTALL_DIR: psql_target - ENGINE_BRANCH_FROM: BABEL_2_7_STABLE__PG_14_10 - EXTENSION_BRANCH_FROM: BABEL_2_7_STABLE + ENGINE_BRANCH_FROM: BABEL_2_X_DEV__PG_14_X + EXTENSION_BRANCH_FROM: BABEL_2_X_DEV runs-on: ubuntu-20.04 steps: diff --git a/.gitignore b/.gitignore index e2b9f4e9c60..605b837ed1a 100644 --- a/.gitignore +++ b/.gitignore @@ -28,8 +28,8 @@ contrib/babelfishpg_tsql/antlr/antlr4cpp_generated_src/ contrib/babelfishpg_tsql/antlr/cmake_install.cmake contrib/babelfishpg_tsql/pl_reserved_kwlist_d.h contrib/babelfishpg_tsql/pl_unreserved_kwlist_d.h -contrib/babelfishpg_tsql/sql/babelfishpg_tsql--[0-9].[0-9].[0-9]--[0-9].[0-9].[0-9].sql -contrib/babelfishpg_tsql/sql/babelfishpg_tsql--[0-9].[0-9].[0-9].sql +contrib/babelfishpg_tsql/sql/babelfishpg_tsql--[0-9]*.[0-9]*.[0-9]*--[0-9]*.[0-9]*.[0-9]*.sql +contrib/babelfishpg_tsql/sql/babelfishpg_tsql--[0-9]*.[0-9]*.[0-9]*.sql contrib/babelfishpg_tsql/src/backend_parser/gram-backend.c contrib/babelfishpg_tsql/src/backend_parser/gram-backend.h contrib/babelfishpg_tsql/src/backend_parser/gram-backend.output @@ -41,4 +41,5 @@ contrib/babelfishpg_tsql/src/fts_parser.c contrib/babelfishpg_tsql/src/fts_scan.c contrib/babelfishpg_tsql/src/pl_gram.c contrib/babelfishpg_tsql/src/pl_gram.h -contrib/babelfishpg_tsql/src/pl_gram.output \ No newline at end of file +contrib/babelfishpg_tsql/src/pl_gram.output + diff --git a/contrib/README.md b/contrib/README.md index 13e830e2363..784cb3319d4 100644 --- a/contrib/README.md +++ b/contrib/README.md @@ -224,7 +224,6 @@ Build babelfishpg_unit extension if you want to run/add unit tests (Optional): CREATE EXTENSION IF NOT EXISTS "babelfishpg_tds" CASCADE; GRANT ALL ON SCHEMA sys to babelfish_user; ALTER SYSTEM SET babelfishpg_tsql.database_name = 'babelfish_db'; - ALTER SYSTEM SET babelfishpg_tds.set_db_session_property = true; ALTER DATABASE babelfish_db SET babelfishpg_tsql.migration_mode = 'single-db'|'multi-db'; SELECT pg_reload_conf(); CALL SYS.INITIALIZE_BABELFISH('babelfish_user'); diff --git a/contrib/babelfishpg_common/Makefile b/contrib/babelfishpg_common/Makefile index 06fdef540a0..7f3de8eb9ca 100644 --- a/contrib/babelfishpg_common/Makefile +++ b/contrib/babelfishpg_common/Makefile @@ -59,7 +59,8 @@ GENERATED_UPGRADES = \ sql/$(EXTENSION)--3.3.0--4.0.0.sql \ sql/$(EXTENSION)--3.3.0--3.4.0.sql \ sql/$(EXTENSION)--4.0.0--4.1.0.sql \ - sql/$(EXTENSION)--4.1.0--4.2.0.sql + sql/$(EXTENSION)--4.1.0--4.2.0.sql \ + sql/$(EXTENSION)--4.2.0--4.3.0.sql ifdef PREV_EXTVERSION DATA = sql/$(EXTENSION)--$(PREV_EXTVERSION).sql @@ -118,6 +119,10 @@ ifeq (,$(filter $(FLAG_TO_CHECK),$(PG_CPPFLAGS))) sql/$(EXTENSION)--4.1.0--4.2.0.sql: sql/upgrades/babelfishpg_upgrades.in cpp -D PREV_VERSION=4.1.0 -D CUR_VERSION=4.2.0 $< | sed 's/^# /-- /g' > $@ + + sql/$(EXTENSION)--4.2.0--4.3.0.sql: sql/upgrades/babelfishpg_upgrades.in + cpp -D PREV_VERSION=4.2.0 -D CUR_VERSION=4.3.0 $< | sed 's/^# /-- /g' > $@ + else # The flag is present build the .in file including the spatial type files sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).in @@ -137,6 +142,10 @@ else sql/$(EXTENSION)--4.1.0--4.2.0.sql: sql/upgrades/babelfishpg_upgrades.in cpp -D ENABLE_SPATIAL_TYPES=1 -D PREV_VERSION=4.1.0 -D CUR_VERSION=4.2.0 $< | sed 's/^# /-- /g' > $@ + + sql/$(EXTENSION)--4.2.0--4.3.0.sql: sql/upgrades/babelfishpg_upgrades.in + cpp -D ENABLE_SPATIAL_TYPES=1 -D PREV_VERSION=4.2.0 -D CUR_VERSION=4.3.0 $< | sed 's/^# /-- /g' > $@ + endif sql/babelfishpg_common--%.sql: sql/upgrades/babelfishpg_common--%.sql diff --git a/contrib/babelfishpg_common/Version.config b/contrib/babelfishpg_common/Version.config index 8ffb0cee072..5538dac85cb 100644 --- a/contrib/babelfishpg_common/Version.config +++ b/contrib/babelfishpg_common/Version.config @@ -1,4 +1,4 @@ BBFPGCMN_MAJOR_VERSION=4 -BBFPGCMN_MINOR_VERSION=2 +BBFPGCMN_MINOR_VERSION=3 BBFPGCMN_MICRO_VERSION=0 diff --git a/contrib/babelfishpg_common/sql/binary.sql b/contrib/babelfishpg_common/sql/binary.sql index 867c266c095..3ad552287ac 100644 --- a/contrib/babelfishpg_common/sql/binary.sql +++ b/contrib/babelfishpg_common/sql/binary.sql @@ -97,7 +97,7 @@ AS 'babelfishpg_common', 'varbinaryvarchar' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; CREATE CAST (sys.BBF_BINARY AS sys.VARCHAR) -WITH FUNCTION sys.binarysysvarchar (sys.BBF_BINARY, integer, boolean) AS ASSIGNMENT; +WITH FUNCTION sys.binarysysvarchar (sys.BBF_BINARY, integer, boolean) AS IMPLICIT; CREATE OR REPLACE FUNCTION sys.binaryvarchar(sys.BBF_BINARY, integer, boolean) RETURNS pg_catalog.VARCHAR @@ -249,7 +249,7 @@ CREATE OPERATOR sys.>= ( CREATE FUNCTION sys.binary_lt(leftarg sys.bbf_binary, rightarg sys.bbf_binary) RETURNS boolean -AS 'babelfishpg_common', 'varbinary_eq' +AS 'babelfishpg_common', 'varbinary_lt' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; CREATE OPERATOR sys.< ( diff --git a/contrib/babelfishpg_common/sql/geography.sql b/contrib/babelfishpg_common/sql/geography.sql index f4ab4fbada3..6ca2937892b 100644 --- a/contrib/babelfishpg_common/sql/geography.sql +++ b/contrib/babelfishpg_common/sql/geography.sql @@ -443,18 +443,53 @@ CREATE OR REPLACE FUNCTION sys.ST_zmflag(sys.GEOGRAPHY) AS '$libdir/postgis-3', 'LWGEOM_zmflag' LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE; -CREATE FUNCTION sys.ST_Equals(leftarg sys.GEOGRAPHY, rightarg sys.GEOGRAPHY) - RETURNS boolean - AS $$ - DECLARE - leftvarBin sys.bbf_varbinary; - rightvarBin sys.bbf_varbinary; - BEGIN - leftvarBin := (SELECT sys.bbf_varbinary($1)); - rightvarBin := (SELECT sys.bbf_varbinary($2)); - RETURN (SELECT sys.varbinary_eq(leftvarBin, rightvarBin)); - END; - $$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; +CREATE OR REPLACE FUNCTION sys.STArea(sys.GEOGRAPHY) + RETURNS float8 + AS '$libdir/postgis-3','ST_Area' + LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.STSrid(sys.GEOGRAPHY) + RETURNS integer + AS '$libdir/postgis-3','LWGEOM_get_srid' + LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.STEquals(geom1 sys.GEOGRAPHY, geom2 sys.GEOGRAPHY) + RETURNS sys.BIT + AS $$ + BEGIN + IF STSrid(geom1) != STSrid(geom2) THEN + RETURN NULL; + ELSE + Return sys.STEquals_helper($1,$2); + END IF; + END; + $$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.STContains(geom1 sys.GEOGRAPHY, geom2 sys.GEOGRAPHY) + RETURNS sys.BIT + AS $$ + BEGIN + IF STSrid(geom1) != STSrid(geom2) THEN + RETURN NULL; + ELSE + Return sys.STContains_helper($1,$2); + END IF; + END; + $$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.ST_Equals(leftarg sys.GEOGRAPHY, rightarg sys.GEOGRAPHY) + RETURNS boolean + AS $$ + DECLARE + Result integer; + BEGIN + Result := STEquals(leftarg,rightarg); + IF Result IS NULL THEN + RETURN false; + END IF; + RETURN Result; + END; + $$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; CREATE OPERATOR sys.= ( LEFTARG = sys.GEOGRAPHY, @@ -464,18 +499,19 @@ CREATE OPERATOR sys.= ( RESTRICT = eqsel ); -CREATE FUNCTION sys.ST_NotEquals(leftarg sys.GEOGRAPHY, rightarg sys.GEOGRAPHY) +CREATE OR REPLACE FUNCTION sys.ST_NotEquals(leftarg sys.GEOGRAPHY, rightarg sys.GEOGRAPHY) RETURNS boolean AS $$ - DECLARE - leftvarBin sys.bbf_varbinary; - rightvarBin sys.bbf_varbinary; - BEGIN - leftvarBin := (SELECT sys.bbf_varbinary($1)); - rightvarBin := (SELECT sys.bbf_varbinary($2)); - RETURN (SELECT sys.varbinary_neq(leftvarBin, rightvarBin)); - END; - $$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + DECLARE + Result integer; + BEGIN + Result := STEquals(leftarg,rightarg); + IF Result IS NULL THEN + RETURN true; + END IF; + RETURN 1 - Result; + END; + $$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; CREATE OPERATOR sys.<> ( LEFTARG = sys.GEOGRAPHY, @@ -512,6 +548,16 @@ CREATE OR REPLACE FUNCTION sys.ST_Transform(sys.GEOGRAPHY, integer) LANGUAGE 'c' IMMUTABLE STRICT; -- Helper functions for main T-SQL functions +CREATE OR REPLACE FUNCTION sys.STEquals_helper(geom1 sys.GEOGRAPHY, geom2 sys.GEOGRAPHY) + RETURNS sys.BIT + AS '$libdir/postgis-3','ST_Equals' + LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.STContains_helper(geom1 sys.GEOGRAPHY, geom2 sys.GEOGRAPHY) + RETURNS sys.BIT + AS '$libdir/postgis-3','within' + LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE; + CREATE OR REPLACE FUNCTION sys.stgeogfromtext_helper(text, integer) RETURNS sys.GEOGRAPHY AS '$libdir/postgis-3','LWGEOM_from_text' diff --git a/contrib/babelfishpg_common/sql/geometry.sql b/contrib/babelfishpg_common/sql/geometry.sql index 251668cfacc..47a8bfa945f 100644 --- a/contrib/babelfishpg_common/sql/geometry.sql +++ b/contrib/babelfishpg_common/sql/geometry.sql @@ -338,18 +338,53 @@ CREATE OR REPLACE FUNCTION sys.ST_zmflag(sys.GEOMETRY) AS '$libdir/postgis-3', 'LWGEOM_zmflag' LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE; -CREATE FUNCTION sys.ST_Equals(leftarg sys.GEOMETRY, rightarg sys.GEOMETRY) +CREATE OR REPLACE FUNCTION sys.STArea(sys.GEOMETRY) + RETURNS float8 + AS '$libdir/postgis-3','ST_Area' + LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.STSrid(sys.GEOMETRY) + RETURNS integer + AS '$libdir/postgis-3','LWGEOM_get_srid' + LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.STEquals(geom1 sys.GEOMETRY, geom2 sys.GEOMETRY) + RETURNS sys.BIT + AS $$ + BEGIN + IF STSrid(geom1) != STSrid(geom2) THEN + RETURN NULL; + ELSE + Return sys.STEquals_helper($1,$2); + END IF; + END; + $$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.STContains(geom1 sys.GEOMETRY, geom2 sys.GEOMETRY) + RETURNS sys.BIT + AS $$ + BEGIN + IF STSrid(geom1) != STSrid(geom2) THEN + RETURN NULL; + ELSE + Return sys.STContains_helper($1,$2); + END IF; + END; + $$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.ST_Equals(leftarg sys.GEOMETRY, rightarg sys.GEOMETRY) RETURNS boolean - AS $$ - DECLARE - leftvarBin sys.bbf_varbinary; - rightvarBin sys.bbf_varbinary; - BEGIN - leftvarBin := (SELECT sys.bbf_varbinary($1)); - rightvarBin := (SELECT sys.bbf_varbinary($2)); - RETURN (SELECT sys.varbinary_eq(leftvarBin, rightvarBin)); - END; - $$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + AS $$ + DECLARE + Result integer; + BEGIN + Result := STEquals(leftarg,rightarg); + IF Result IS NULL THEN + RETURN false; + END IF; + RETURN Result; + END; + $$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; CREATE OPERATOR sys.= ( LEFTARG = sys.GEOMETRY, @@ -359,18 +394,19 @@ CREATE OPERATOR sys.= ( RESTRICT = eqsel ); -CREATE FUNCTION sys.ST_NotEquals(leftarg sys.GEOMETRY, rightarg sys.GEOMETRY) +CREATE OR REPLACE FUNCTION sys.ST_NotEquals(leftarg sys.GEOMETRY, rightarg sys.GEOMETRY) RETURNS boolean AS $$ - DECLARE - leftvarBin sys.bbf_varbinary; - rightvarBin sys.bbf_varbinary; - BEGIN - leftvarBin := (SELECT sys.bbf_varbinary($1)); - rightvarBin := (SELECT sys.bbf_varbinary($2)); - RETURN (SELECT sys.varbinary_neq(leftvarBin, rightvarBin)); - END; - $$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + DECLARE + Result integer; + BEGIN + Result := STEquals(leftarg,rightarg); + IF Result IS NULL THEN + RETURN true; + END IF; + RETURN 1 - Result; + END; + $$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; CREATE OPERATOR sys.<> ( LEFTARG = sys.GEOMETRY, @@ -396,6 +432,16 @@ CREATE OR REPLACE FUNCTION sys.sty(sys.GEOMETRY) LANGUAGE 'c' IMMUTABLE STRICT; -- Helper functions for main T-SQL functions +CREATE OR REPLACE FUNCTION sys.STContains_helper(geom1 sys.GEOMETRY, geom2 sys.GEOMETRY) + RETURNS sys.BIT + AS '$libdir/postgis-3','within' + LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.STEquals_helper(geom1 sys.GEOMETRY, geom2 sys.GEOMETRY) + RETURNS sys.BIT + AS '$libdir/postgis-3','ST_Equals' + LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE; + CREATE OR REPLACE FUNCTION sys.stgeomfromtext_helper(text, integer) RETURNS sys.GEOMETRY AS '$libdir/postgis-3','LWGEOM_from_text' diff --git a/contrib/babelfishpg_common/sql/upgrades/babelfish_common_helper--4.2.0--4.3.0.sql b/contrib/babelfishpg_common/sql/upgrades/babelfish_common_helper--4.2.0--4.3.0.sql new file mode 100644 index 00000000000..8d2dd0afa38 --- /dev/null +++ b/contrib/babelfishpg_common/sql/upgrades/babelfish_common_helper--4.2.0--4.3.0.sql @@ -0,0 +1,28 @@ +------------------------------------------------------------------------------ +---- Include changes related to other datatypes except spatial types here ---- +------------------------------------------------------------------------------ + +-- complain if script is sourced in psql, rather than via ALTER EXTENSION +\echo Use "ALTER EXTENSION ""babelfishpg_common"" UPDATE TO "4.3.0"" to load this file. \quit + +SELECT set_config('search_path', 'sys, '||current_setting('search_path'), false); + +DO $$ +DECLARE + schema_oid oid; + cast_source oid; + cast_target oid; +BEGIN + select oid INTO schema_oid from pg_namespace where nspname='sys'; + select oid into cast_source from pg_type where typname='bbf_binary' and typnamespace=schema_oid; + select oid into cast_target from pg_type where typname='varchar' and typnamespace=schema_oid; + UPDATE pg_catalog.pg_cast SET castcontext='i' WHERE castsource=cast_source AND casttarget=cast_target; +END $$; + +CREATE OR REPLACE FUNCTION sys.binary_lt(leftarg sys.bbf_binary, rightarg sys.bbf_binary) +RETURNS boolean +AS 'babelfishpg_common', 'varbinary_lt' +LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +-- Reset search_path to not affect any subsequent scripts +SELECT set_config('search_path', trim(leading 'sys, ' from current_setting('search_path')), false); diff --git a/contrib/babelfishpg_common/sql/upgrades/babelfishpg_common--3.6.0--4.0.0.sql b/contrib/babelfishpg_common/sql/upgrades/babelfishpg_common--3.6.0--4.0.0.sql new file mode 100644 index 00000000000..b166a4ff893 --- /dev/null +++ b/contrib/babelfishpg_common/sql/upgrades/babelfishpg_common--3.6.0--4.0.0.sql @@ -0,0 +1,2 @@ +-- complain if script is sourced in psql, rather than via ALTER EXTENSION +\echo Use "ALTER EXTENSION ""babelfishpg_common"" UPDATE TO '4.0.0'" to load this file. \quit diff --git a/contrib/babelfishpg_common/sql/upgrades/spatial_types--4.2.0--4.3.0.sql b/contrib/babelfishpg_common/sql/upgrades/spatial_types--4.2.0--4.3.0.sql new file mode 100644 index 00000000000..22e59fba541 --- /dev/null +++ b/contrib/babelfishpg_common/sql/upgrades/spatial_types--4.2.0--4.3.0.sql @@ -0,0 +1,147 @@ +------------------------------------------------------- +---- Include changes related to spatial types here ---- +------------------------------------------------------- +CREATE OR REPLACE FUNCTION sys.STArea(sys.GEOMETRY) + RETURNS float8 + AS '$libdir/postgis-3','ST_Area' + LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.STSrid(sys.GEOMETRY) + RETURNS integer + AS '$libdir/postgis-3','LWGEOM_get_srid' + LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.STEquals(geom1 sys.GEOMETRY, geom2 sys.GEOMETRY) + RETURNS sys.BIT + AS $$ + BEGIN + IF STSrid(geom1) != STSrid(geom2) THEN + RETURN NULL; + ELSE + Return sys.STEquals_helper($1,$2); + END IF; + END; + $$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.STContains(geom1 sys.GEOMETRY, geom2 sys.GEOMETRY) + RETURNS sys.BIT + AS $$ + DECLARE + BEGIN + IF STSrid(geom1) != STSrid(geom2) THEN + RETURN NULL; + ELSE + Return sys.STContains_helper($1,$2); + END IF; + END; + $$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.ST_Equals(leftarg sys.GEOMETRY, rightarg sys.GEOMETRY) + RETURNS boolean + AS $$ + DECLARE + Result integer; + BEGIN + Result := STEquals(leftarg,rightarg); + IF Result IS NULL THEN + RETURN false; + END IF; + RETURN Result; + END; + $$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.ST_NotEquals(leftarg sys.GEOMETRY, rightarg sys.GEOMETRY) + RETURNS boolean + AS $$ + DECLARE + Result integer; + BEGIN + Result := STEquals(leftarg,rightarg); + IF Result IS NULL THEN + RETURN true; + END IF; + RETURN 1 - Result; + END; + $$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.STContains_helper(geom1 sys.GEOMETRY, geom2 sys.GEOMETRY) + RETURNS sys.BIT + AS '$libdir/postgis-3','within' + LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.STEquals_helper(geom1 sys.GEOMETRY, geom2 sys.GEOMETRY) + RETURNS sys.BIT + AS '$libdir/postgis-3','ST_Equals' + LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.STArea(sys.GEOGRAPHY) + RETURNS float8 + AS '$libdir/postgis-3','ST_Area' + LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.STSrid(sys.GEOGRAPHY) + RETURNS integer + AS '$libdir/postgis-3','LWGEOM_get_srid' + LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.STEquals(geom1 sys.GEOGRAPHY, geom2 sys.GEOGRAPHY) + RETURNS sys.BIT + AS $$ + BEGIN + IF STSrid(geom1) != STSrid(geom2) THEN + RETURN NULL; + ELSE + Return sys.STEquals_helper($1,$2); + END IF; + END; + $$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.STContains(geom1 sys.GEOGRAPHY, geom2 sys.GEOGRAPHY) + RETURNS sys.BIT + AS $$ + BEGIN + IF STSrid(geom1) != STSrid(geom2) THEN + RETURN NULL; + ELSE + Return sys.STContains_helper($1,$2); + END IF; + END; + $$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.ST_Equals(leftarg sys.GEOGRAPHY, rightarg sys.GEOGRAPHY) + RETURNS boolean + AS $$ + DECLARE + Result integer; + BEGIN + Result := STEquals(leftarg,rightarg); + IF Result IS NULL THEN + RETURN false; + END IF; + RETURN Result; + END; + $$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.ST_NotEquals(leftarg sys.GEOGRAPHY, rightarg sys.GEOGRAPHY) + RETURNS boolean + AS $$ + DECLARE + Result integer; + BEGIN + Result := STEquals(leftarg,rightarg); + IF Result IS NULL THEN + RETURN true; + END IF; + RETURN 1 - Result; + END; + $$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.STEquals_helper(geom1 sys.GEOGRAPHY, geom2 sys.GEOGRAPHY) + RETURNS sys.BIT + AS '$libdir/postgis-3','ST_Equals' + LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.STContains_helper(geom1 sys.GEOGRAPHY, geom2 sys.GEOGRAPHY) + RETURNS sys.BIT + AS '$libdir/postgis-3','within' + LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE; diff --git a/contrib/babelfishpg_common/src/babelfishpg_common.c b/contrib/babelfishpg_common/src/babelfishpg_common.c index 7a508fa2ee8..70a931a7c23 100644 --- a/contrib/babelfishpg_common/src/babelfishpg_common.c +++ b/contrib/babelfishpg_common/src/babelfishpg_common.c @@ -180,11 +180,14 @@ get_common_utility_plugin(void) common_utility_plugin_var.is_tsql_sys_binary_datatype = &is_tsql_sys_binary_datatype; common_utility_plugin_var.is_tsql_varbinary_datatype = &is_tsql_varbinary_datatype; common_utility_plugin_var.is_tsql_sys_varbinary_datatype = &is_tsql_sys_varbinary_datatype; + common_utility_plugin_var.is_tsql_geometry_datatype = &is_tsql_geometry_datatype; + common_utility_plugin_var.is_tsql_geography_datatype = &is_tsql_geography_datatype; common_utility_plugin_var.is_tsql_timestamp_datatype = &is_tsql_timestamp_datatype; common_utility_plugin_var.is_tsql_datetime2_datatype = &is_tsql_datetime2_datatype; common_utility_plugin_var.is_tsql_smalldatetime_datatype = &is_tsql_smalldatetime_datatype; common_utility_plugin_var.is_tsql_datetimeoffset_datatype = &is_tsql_datetimeoffset_datatype; common_utility_plugin_var.is_tsql_decimal_datatype = &is_tsql_decimal_datatype; + common_utility_plugin_var.is_tsql_sqlvariant_datatype = &is_tsql_sqlvariant_datatype; common_utility_plugin_var.is_tsql_rowversion_or_timestamp_datatype = &is_tsql_rowversion_or_timestamp_datatype; common_utility_plugin_var.datetime_in_str = &datetime_in_str; common_utility_plugin_var.datetime2sqlvariant = &datetime2sqlvariant; @@ -199,6 +202,7 @@ get_common_utility_plugin(void) common_utility_plugin_var.TdsGetMetaData = &TdsGetMetaData; common_utility_plugin_var.TdsGetVariantBaseType = &TdsGetVariantBaseType; common_utility_plugin_var.lookup_tsql_datatype_oid = &lookup_tsql_datatype_oid; + common_utility_plugin_var.resolve_pg_type_to_tsql = &resolve_pg_type_to_tsql; common_utility_plugin_var.GetUTF8CodePoint = &GetUTF8CodePoint; common_utility_plugin_var.TsqlUTF8LengthInUTF16 = &TsqlUTF8LengthInUTF16; } diff --git a/contrib/babelfishpg_common/src/babelfishpg_common.h b/contrib/babelfishpg_common/src/babelfishpg_common.h index fd1b3446ab0..e3c821031da 100644 --- a/contrib/babelfishpg_common/src/babelfishpg_common.h +++ b/contrib/babelfishpg_common/src/babelfishpg_common.h @@ -52,11 +52,14 @@ typedef struct common_utility_plugin bool (*is_tsql_sys_binary_datatype) (Oid oid); bool (*is_tsql_sys_varbinary_datatype) (Oid oid); bool (*is_tsql_varbinary_datatype) (Oid oid); + bool (*is_tsql_geography_datatype) (Oid oid); + bool (*is_tsql_geometry_datatype) (Oid oid); bool (*is_tsql_timestamp_datatype) (Oid oid); bool (*is_tsql_datetime2_datatype) (Oid oid); bool (*is_tsql_smalldatetime_datatype) (Oid oid); bool (*is_tsql_datetimeoffset_datatype) (Oid oid); bool (*is_tsql_decimal_datatype) (Oid oid); + bool (*is_tsql_sqlvariant_datatype) (Oid oid); bool (*is_tsql_rowversion_or_timestamp_datatype) (Oid oid); Datum (*datetime_in_str) (char *str, Node *escontext); Datum (*datetime2sqlvariant) (PG_FUNCTION_ARGS); @@ -77,6 +80,7 @@ typedef struct common_utility_plugin bool *isBaseDec, bool *isBaseBin, bool *isBaseDate, int *variantHeaderLen); Oid (*lookup_tsql_datatype_oid) (const char *typestr); + const char *(*resolve_pg_type_to_tsql) (Oid oid); int32_t (*GetUTF8CodePoint) (const unsigned char *in, int len, int *consumed_p); int (*TsqlUTF8LengthInUTF16) (const void *vin, int len); } common_utility_plugin; diff --git a/contrib/babelfishpg_common/src/collation.c b/contrib/babelfishpg_common/src/collation.c index abd1e150d8b..4fe0eb2ae5c 100644 --- a/contrib/babelfishpg_common/src/collation.c +++ b/contrib/babelfishpg_common/src/collation.c @@ -26,7 +26,7 @@ #define DATABASE_DEFAULT "database_default" #define CATALOG_DEFAULT "catalog_default" -collation_callbacks collation_callbacks_var = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; +collation_callbacks collation_callbacks_var = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; /* Cached values derived from server_collation_name */ static int server_collation_collidx = NOT_FOUND; @@ -1301,6 +1301,55 @@ is_collated_ci_as_internal(PG_FUNCTION_ARGS) PG_RETURN_BOOL(false); } +Datum +is_collated_ai_internal(PG_FUNCTION_ARGS) +{ + Oid colloid = PG_GET_COLLATION(); + HeapTuple tp; + char *collcollate = NULL; + char collprovider; + bool collisdeterministic; + Datum datum; + bool isnull; + + if (!OidIsValid(colloid) || GetDatabaseEncoding() != PG_UTF8) + PG_RETURN_BOOL(false); + + tp = SearchSysCache1(COLLOID, ObjectIdGetDatum(colloid)); + if (!HeapTupleIsValid(tp)) + elog(ERROR, "cache lookup failed for collation %u", colloid); + + collprovider = ((Form_pg_collation) GETSTRUCT(tp))->collprovider; + collisdeterministic = ((Form_pg_collation) GETSTRUCT(tp))->collisdeterministic; + + if (collisdeterministic == true || collprovider != COLLPROVIDER_ICU) + { + ReleaseSysCache(tp); + PG_RETURN_BOOL(false); + } + datum = SysCacheGetAttr(COLLOID, tp, Anum_pg_collation_colliculocale, &isnull); + + if (isnull) + { + ReleaseSysCache(tp); + PG_RETURN_BOOL(false); + } + + collcollate = TextDatumGetCString(datum); + ReleaseSysCache(tp); + + if (strstr(lowerstr(collcollate), lowerstr("colStrength=primary")) || + 0 != strstr(lowerstr(collcollate), "level1")) /* AI */ + { + pfree(collcollate); + PG_RETURN_BOOL(true); + } + + pfree(collcollate); + + PG_RETURN_BOOL(false); +} + const char * BabelfishTranslateCollation(const char *collname, Oid collnamespace, int32 encoding) { @@ -1524,6 +1573,7 @@ get_collation_callbacks(void) collation_callbacks_var.get_server_collation_oid_internal = &get_server_collation_oid_internal; collation_callbacks_var.collation_list_internal = &collation_list_internal; collation_callbacks_var.is_collated_ci_as_internal = &is_collated_ci_as_internal; + collation_callbacks_var.is_collated_ai_internal = &is_collated_ai_internal; collation_callbacks_var.collationproperty_helper = &collationproperty_helper; collation_callbacks_var.tdscollationproperty_helper = &tdscollationproperty_helper; collation_callbacks_var.lookup_collation_table_callback = &lookup_collation_table; diff --git a/contrib/babelfishpg_common/src/collation.h b/contrib/babelfishpg_common/src/collation.h index c74330210c8..b2baefa3d11 100644 --- a/contrib/babelfishpg_common/src/collation.h +++ b/contrib/babelfishpg_common/src/collation.h @@ -93,6 +93,8 @@ typedef struct collation_callbacks Datum (*is_collated_ci_as_internal) (PG_FUNCTION_ARGS); + Datum (*is_collated_ai_internal) (PG_FUNCTION_ARGS); + int (*collationproperty_helper) (const char *collationaname, const char *property); bytea *(*tdscollationproperty_helper) (const char *collationaname, const char *property); @@ -128,6 +130,7 @@ extern int find_locale(const char *given_locale); extern int get_server_collation_collidx(void); extern Datum collation_list_internal(PG_FUNCTION_ARGS); extern Datum is_collated_ci_as_internal(PG_FUNCTION_ARGS); +extern Datum is_collated_ai_internal(PG_FUNCTION_ARGS); extern int collationproperty_helper(const char *collationaname, const char *property); extern bytea *tdscollationproperty_helper(const char *collationname, const char *property); extern bool is_server_collation_CI_AS(void); diff --git a/contrib/babelfishpg_common/src/typecode.c b/contrib/babelfishpg_common/src/typecode.c index a40fb303cb3..0900df85c62 100644 --- a/contrib/babelfishpg_common/src/typecode.c +++ b/contrib/babelfishpg_common/src/typecode.c @@ -53,6 +53,8 @@ type_info_t type_infos[TOTAL_TYPECODE_COUNT] = {0, 1, "rowversion", "timestamp", 8, 32, 3}, {0, 1, "timestamp", "timestamp", 8, 33, 3}, {0, 1, "vector", "vector", 9, 34, 3}, + {0, 1, "sparsevec", "sparsevec", 9, 34, 3}, + {0, 1, "halfvec", "halfvec", 9, 34, 3}, /* * Geospatial types cannot be stored in SQL variant so setting sqlvariant header size to 1 */ @@ -283,6 +285,9 @@ Oid tsql_datetime2_oid = InvalidOid; Oid tsql_smalldatetime_oid = InvalidOid; Oid tsql_datetimeoffset_oid = InvalidOid; Oid tsql_decimal_oid = InvalidOid; +Oid tsql_sqlvariant_oid = InvalidOid; +Oid tsql_geography_oid = InvalidOid; +Oid tsql_geometry_oid = InvalidOid; Oid lookup_tsql_datatype_oid(const char *typename) @@ -298,6 +303,22 @@ lookup_tsql_datatype_oid(const char *typename) return typoid; } +/* type_infos will return const char * so caller should not attempt to modify it */ +const char * +resolve_pg_type_to_tsql(Oid oid) +{ + ht_oid2typecode_entry_t *entry; + + if (OidIsValid(oid)) + { + entry = hash_search(ht_oid2typecode, &oid, HASH_FIND, NULL); + + if (entry && entry->persist_id < TOTAL_TYPECODE_COUNT) + return type_infos[entry->persist_id].tsql_typname; + } + return NULL; +} + bool is_tsql_bpchar_datatype(Oid oid) { @@ -392,6 +413,22 @@ is_tsql_rowversion_datatype(Oid oid) return tsql_rowversion_oid == oid; } +bool +is_tsql_geometry_datatype(Oid oid) +{ + if (tsql_geometry_oid == InvalidOid) + tsql_geometry_oid = lookup_tsql_datatype_oid("geometry"); + return tsql_geometry_oid == oid; +} + +bool +is_tsql_geography_datatype(Oid oid) +{ + if (tsql_geography_oid == InvalidOid) + tsql_geography_oid = lookup_tsql_datatype_oid("geography"); + return tsql_geography_oid == oid; +} + bool is_tsql_timestamp_datatype(Oid oid) { @@ -438,6 +475,14 @@ is_tsql_decimal_datatype(Oid oid) return tsql_decimal_oid == oid; } +bool +is_tsql_sqlvariant_datatype(Oid oid) +{ + if (tsql_sqlvariant_oid == InvalidOid) + tsql_sqlvariant_oid = lookup_tsql_datatype_oid("sql_variant"); + return tsql_sqlvariant_oid == oid; +} + /* * handle_type_and_collation - is implemented to handle the domain id and * collation id assigned to FuncExpr of the target column. (Maily for target types diff --git a/contrib/babelfishpg_common/src/typecode.h b/contrib/babelfishpg_common/src/typecode.h index 71ccb9bbad4..37c1c52562b 100644 --- a/contrib/babelfishpg_common/src/typecode.h +++ b/contrib/babelfishpg_common/src/typecode.h @@ -45,7 +45,7 @@ #define FIXEDDECIMAL_MULTIPLIER 10000LL #endif -#define TOTAL_TYPECODE_COUNT 36 +#define TOTAL_TYPECODE_COUNT 38 struct Node; @@ -98,16 +98,20 @@ extern bool is_tsql_varbinary_datatype(Oid oid); extern bool is_tsql_sys_varbinary_datatype(Oid oid); extern bool is_tsql_rowversion_datatype(Oid oid); extern bool is_tsql_timestamp_datatype(Oid oid); +extern bool is_tsql_geography_datatype(Oid oid); +extern bool is_tsql_geometry_datatype(Oid oid); extern bool is_tsql_rowversion_or_timestamp_datatype(Oid oid); extern bool is_tsql_datetime2_datatype(Oid oid); extern bool is_tsql_smalldatetime_datatype(Oid oid); extern bool is_tsql_datetimeoffset_datatype(Oid oid); extern bool is_tsql_decimal_datatype(Oid oid); +extern bool is_tsql_sqlvariant_datatype(Oid oid); extern void handle_type_and_collation(struct Node *node, Oid typid, Oid collationid); extern bool check_target_type_is_sys_varchar(Oid funcid); extern type_info_t get_tsql_type_info(uint8_t type_code); extern Datum translate_pg_type_to_tsql(PG_FUNCTION_ARGS); +extern const char *resolve_pg_type_to_tsql(Oid oid); extern Oid get_tsql_datatype_oid(char *type_name); /* diff --git a/contrib/babelfishpg_tds/Makefile b/contrib/babelfishpg_tds/Makefile index 53dc10099a6..d734bfd2966 100644 --- a/contrib/babelfishpg_tds/Makefile +++ b/contrib/babelfishpg_tds/Makefile @@ -11,7 +11,7 @@ TSQL_SRC = ../babelfishpg_tsql PG_CFLAGS += -Werror -Wfloat-conversion PG_CFLAGS += -fstack-protector-strong -PG_CPPFLAGS += -I$(TSQL_SRC) -I$(PG_SRC) -I$(tds_top_dir) +PG_CPPFLAGS += -I$(TSQL_SRC) -I$(PG_SRC) -I$(tds_top_dir) -DFAULT_INJECTOR # Exclude the following files from the build (sometimes these # files are included in another c file) diff --git a/contrib/babelfishpg_tds/src/backend/tds/tds_data_map.c b/contrib/babelfishpg_tds/src/backend/tds/tds_data_map.c index 95470b96668..a377f4f3c76 100644 --- a/contrib/babelfishpg_tds/src/backend/tds/tds_data_map.c +++ b/contrib/babelfishpg_tds/src/backend/tds/tds_data_map.c @@ -189,6 +189,8 @@ TdsIoFunctionRawData TdsIoFunctionRawData_data[] = {"pg_catalog", "oid", TDS_TYPE_INTEGER, 4, 1, TDS_SEND_INTEGER, TDS_RECV_INVALID}, {"pg_catalog", "sql_identifier", TDS_TYPE_VARCHAR, -1, 1, TDS_SEND_VARCHAR, TDS_RECV_INVALID}, {"sys", "vector", TDS_TYPE_VARCHAR, -1, 2, TDS_SEND_VARCHAR, TDS_RECV_VARCHAR}, + {"sys", "halfvec", TDS_TYPE_VARCHAR, -1, 2, TDS_SEND_VARCHAR, TDS_RECV_VARCHAR}, + {"sys", "sparsevec", TDS_TYPE_VARCHAR, -1, 2, TDS_SEND_VARCHAR, TDS_RECV_VARCHAR}, {"pg_catalog", "name", TDS_TYPE_VARCHAR, -1, 1, TDS_SEND_VARCHAR, TDS_RECV_INVALID}, {"pg_catalog", "character_data", TDS_TYPE_VARCHAR, -1, 2, TDS_SEND_VARCHAR, TDS_RECV_INVALID}, {"pg_catalog", "bool", TDS_TYPE_BIT, 1, 1, TDS_SEND_BIT, TDS_RECV_INVALID}, diff --git a/contrib/babelfishpg_tds/src/backend/tds/tdsresponse.c b/contrib/babelfishpg_tds/src/backend/tds/tdsresponse.c index d1a19fed4c7..a6cd0721c42 100644 --- a/contrib/babelfishpg_tds/src/backend/tds/tdsresponse.c +++ b/contrib/babelfishpg_tds/src/backend/tds/tdsresponse.c @@ -25,8 +25,10 @@ #include "catalog/pg_proc.h" #include "catalog/pg_type.h" #include "miscadmin.h" +#include "nodes/makefuncs.h" #include "nodes/pathnodes.h" #include "parser/parse_coerce.h" +#include "parser/parse_type.h" #include "parser/parsetree.h" #include "utils/fmgroids.h" #include "utils/lsyscache.h" @@ -127,6 +129,9 @@ static TdsColumnMetaData *colMetaData = NULL; static List *relMetaDataInfoList = NULL; static Oid sys_vector_oid = InvalidOid; +static Oid sys_sparsevec_oid = InvalidOid; +static Oid sys_halfvec_oid = InvalidOid; +static Oid decimal_oid = InvalidOid; static void FillTabNameWithNumParts(StringInfo buf, uint8 numParts, TdsRelationMetaDataInfo relMetaDataInfo); static void FillTabNameWithoutNumParts(StringInfo buf, uint8 numParts, TdsRelationMetaDataInfo relMetaDataInfo); @@ -135,7 +140,7 @@ static void ResetTdsEstateErrorData(void); static void SetAttributesForColmetada(TdsColumnMetaData *col); static int32 resolve_numeric_typmod_from_exp(Plan *plan, Node *expr); static int32 resolve_numeric_typmod_outer_var(Plan *plan, AttrNumber attno); -static bool is_sys_vector_datatype(Oid oid); +static bool is_this_a_vector_datatype(Oid oid); static inline void SendPendingDone(bool more) @@ -512,6 +517,24 @@ resolve_numeric_typmod_outer_var(Plan *plan, AttrNumber attno) return resolve_numeric_typmod_from_exp(outerplan, (Node *)tle->expr); } +/* + * is_numeric_datatype - returns bool if given datatype is numeric or decimal. + */ +static bool +is_numeric_datatype(Oid typid) +{ + if (typid == NUMERICOID) + { + return true; + } + if (!OidIsValid(decimal_oid)) + { + TypeName *typename = makeTypeNameFromNameList(list_make2(makeString("sys"), makeString("decimal"))); + decimal_oid = LookupTypeNameOid(NULL, typename, false); + } + return decimal_oid == typid; +} + /* look for a typmod to return from a numeric expression */ static int32 resolve_numeric_typmod_from_exp(Plan *plan, Node *expr) @@ -525,15 +548,10 @@ resolve_numeric_typmod_from_exp(Plan *plan, Node *expr) Const *con = (Const *) expr; Numeric num; - /* - * TODO: We used a workaround here, that we will assume typmod - * is 0 if the value we have is not numeric. See walkaround in - * T_FuncExpr part of this function. JIRA: BABEL-1007 - */ - if (con->consttype != NUMERICOID || con->constisnull) + if (!is_numeric_datatype(con->consttype) || con->constisnull) { - return 0; - /* Typmod doesn 't really matter since it' s a const NULL. */ + /* typmod is undefined */ + return -1; } else { @@ -1090,8 +1108,8 @@ MakeEmptyParameterToken(char *name, int atttypid, int32 atttypmod, int attcollat temp->maxLen = 0xFFFF; break; case TDS_SEND_VARCHAR: - /* If this is vector datatype, we should adjust the typmod */ - if (is_sys_vector_datatype(col->pgTypeOid)) + /* If this is one of the vector datatypes we should adjust the typmod. */ + if (is_this_a_vector_datatype(col->pgTypeOid)) atttypmod = -1; SetColMetadataForCharTypeHelper(col, TDS_TYPE_VARCHAR, attcollation, (atttypmod == -1) ? @@ -1852,8 +1870,8 @@ PrepareRowDescription(TupleDesc typeinfo, PlannedStmt *plannedstmt, List *target att->attcollation, (atttypmod - 4) * 2); break; case TDS_SEND_VARCHAR: - /* If this is vector datatype, we should adjust the typmod */ - if (is_sys_vector_datatype(col->pgTypeOid)) + /* If this is one of the vector datatypes we should adjust the typmod. */ + if (is_this_a_vector_datatype(col->pgTypeOid)) atttypmod = -1; SetColMetadataForCharTypeHelper(col, TDS_TYPE_VARCHAR, @@ -3544,9 +3562,10 @@ SetAttributesForColmetada(TdsColumnMetaData *col) } static bool -is_sys_vector_datatype(Oid oid) +is_this_a_vector_datatype(Oid oid) { Oid nspoid; + if (sys_vector_oid == InvalidOid) { nspoid = get_namespace_oid("sys", true); @@ -3555,5 +3574,27 @@ is_sys_vector_datatype(Oid oid) sys_vector_oid = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid, CStringGetDatum("vector"), ObjectIdGetDatum(nspoid)); } - return sys_vector_oid == oid; + if (sys_vector_oid == oid) + return true; + + if (sys_halfvec_oid == InvalidOid) + { + nspoid = get_namespace_oid("sys", true); + if (nspoid == InvalidOid) + return false; + + sys_halfvec_oid = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid, CStringGetDatum("halfvec"), ObjectIdGetDatum(nspoid)); + } + if (sys_halfvec_oid == oid) + return true; + + if (sys_sparsevec_oid == InvalidOid) + { + nspoid = get_namespace_oid("sys", true); + if (nspoid == InvalidOid) + return false; + + sys_sparsevec_oid = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid, CStringGetDatum("sparsevec"), ObjectIdGetDatum(nspoid)); + } + return sys_sparsevec_oid == oid; } \ No newline at end of file diff --git a/contrib/babelfishpg_tsql/Makefile b/contrib/babelfishpg_tsql/Makefile index 84b5ab253fd..64b16953263 100644 --- a/contrib/babelfishpg_tsql/Makefile +++ b/contrib/babelfishpg_tsql/Makefile @@ -76,6 +76,7 @@ OBJS += src/table_variable_mvcc.o OBJS += src/extendedproperty.o OBJS += src/fts.o OBJS += src/fts_parser.o +OBJS += src/pltsql_partition.o export ANTLR4_JAVA_BIN=java export ANTLR4_RUNTIME_LIB=-lantlr4-runtime diff --git a/contrib/babelfishpg_tsql/Version.config b/contrib/babelfishpg_tsql/Version.config index 2fad35c5862..329eb430026 100644 --- a/contrib/babelfishpg_tsql/Version.config +++ b/contrib/babelfishpg_tsql/Version.config @@ -2,6 +2,6 @@ # places during the build process PGTSQL_MAJOR_VERSION=4 -PGTSQL_MINOR_VERSION=3 +PGTSQL_MINOR_VERSION=4 PGTSQL_MICRO_VERSION=0 diff --git a/contrib/babelfishpg_tsql/antlr/TSqlLexer.g4 b/contrib/babelfishpg_tsql/antlr/TSqlLexer.g4 index f3fe695a649..3d5554cea69 100644 --- a/contrib/babelfishpg_tsql/antlr/TSqlLexer.g4 +++ b/contrib/babelfishpg_tsql/antlr/TSqlLexer.g4 @@ -430,6 +430,10 @@ GROUPING_ID: G R O U P I N G UNDERLINE I D GROUP_MAX_REQUESTS: G R O U P UNDERLINE M A X UNDERLINE R E Q U E S T S; GUID: G U I D; HADR: H A D R; +HALFVEC_COSINE_OPS: H A L F V E C UNDERLINE C O S I N E UNDERLINE O P S; +HALFVEC_IP_OPS: H A L F V E C UNDERLINE I P UNDERLINE O P S; +HALFVEC_L1_OPS: H A L F V E C UNDERLINE L '1' UNDERLINE O P S; +HALFVEC_L2_OPS: H A L F V E C UNDERLINE L '2' UNDERLINE O P S; HASH: H A S H; HASHED: H A S H E D; HAVING: H A V I N G; @@ -729,6 +733,7 @@ PREDICATE: P R E D I C A T E; PREDICT: P R E D I C T; PRIMARY: P R I M A R Y; PRIMARY_ROLE: P R I M A R Y UNDERLINE R O L E; +PRIMARY_SQBRACKET: '[' P R I M A R Y ']'; PRINT: P R I N T; PRIOR: P R I O R; PRIORITY: P R I O R I T Y; @@ -923,6 +928,10 @@ SOFTNUMA: S O F T N U M A; SOME: S O M E; SOURCE: S O U R C E; SPARSE: S P A R S E; +SPARSEVEC_COSINE_OPS: S P A R S E V E C UNDERLINE C O S I N E UNDERLINE O P S; +SPARSEVEC_IP_OPS: S P A R S E V E C UNDERLINE I P UNDERLINE O P S; +SPARSEVEC_L1_OPS: S P A R S E V E C UNDERLINE L '1' UNDERLINE O P S; +SPARSEVEC_L2_OPS: S P A R S E V E C UNDERLINE L '2' UNDERLINE O P S; SPATIAL: S P A T I A L; SPATIAL_WINDOW_MAX_CELLS: S P A T I A L UNDERLINE W I N D O W UNDERLINE M A X UNDERLINE C E L L S; SPECIFICATION: S P E C I F I C A T I O N; @@ -936,6 +945,7 @@ STALE_CAPTURE_POLICY_THRESHOLD: S T A L E UNDERLINE C A P T U STALE_QUERY_THRESHOLD_DAYS: S T A L E UNDERLINE Q U E R Y UNDERLINE T H R E S H O L D UNDERLINE D A Y S; STANDBY: S T A N D B Y; START: S T A R T; +STAREA: 'STArea'; STARTED: S T A R T E D; STARTUP_STATE: S T A R T U P UNDERLINE S T A T E; START_DATE: S T A R T UNDERLINE D A T E; @@ -950,9 +960,11 @@ STATS: S T A T S; STATS_STREAM: S T A T S UNDERLINE S T R E A M; STATUS: S T A T U S; STATUSONLY: S T A T U S O N L Y; +STCONTAINS: 'STContains'; STDEV: S T D E V; STDEVP: S T D E V P; STDISTANCE: 'STDistance'; +STEQUALS: 'STEquals'; STOP: S T O P; STOPAT: S T O P A T; STOPATMARK: S T O P A T M A R K; @@ -962,6 +974,9 @@ STOPPED: S T O P P E D; STOP_ON_ERROR: S T O P UNDERLINE O N UNDERLINE E R R O R; STRING_AGG: S T R I N G UNDERLINE A G G; STRING_DELIMITER: S T R I N G UNDERLINE D E L I M I T E R; +STSRID: 'STSrid'; +STSRID_DOUBLE_QUOTE: ["] STSRID ["] {pltsql_quoted_identifier == true}?; +STSRID_SQBRACKET: '[' STSRID ']'; STUFF: S T U F F; STX: 'STX'; STX_DOUBLE_QUOTE: ["] STX ["] {pltsql_quoted_identifier == true}?; @@ -1023,6 +1038,7 @@ TRANSACTION: T R A N S A C T I O N; TRANSACTION_ID: T R A N S A C T I O N UNDERLINE I D; TRANSFER: T R A N S F E R; TRANSFORM_NOISE_WORDS: T R A N S F O R M UNDERLINE N O I S E UNDERLINE W O R D S; +TRANSLATE: T R A N S L A T E; TRIGGER: T R I G G E R; TRIM: T R I M; TRIPLE_DES: T R I P L E UNDERLINE D E S; @@ -1074,6 +1090,7 @@ VARP: V A R P; VARYING: V A R Y I N G; VECTOR_COSINE_OPS: V E C T O R UNDERLINE C O S I N E UNDERLINE O P S; VECTOR_IP_OPS: V E C T O R UNDERLINE I P UNDERLINE O P S; +VECTOR_L1_OPS: V E C T O R UNDERLINE L '1' UNDERLINE O P S; VECTOR_L2_OPS: V E C T O R UNDERLINE L '2' UNDERLINE O P S; VERBOSELOGGING: V E R B O S E L O G G I N G; VERSION: V E R S I O N; @@ -1181,6 +1198,8 @@ OR_ASSIGN: '|='; VECTOR_L2: '<->'; VECTOR_COSINE: '<=>'; VECTOR_IP: '<#>'; +VECTOR_L1: '<+>'; +VECTOR_CONCATENATE: '||'; DOT: '.'; UNDERLINE: '_'; diff --git a/contrib/babelfishpg_tsql/antlr/TSqlParser.g4 b/contrib/babelfishpg_tsql/antlr/TSqlParser.g4 index 83d5b211cf0..2285306061a 100644 --- a/contrib/babelfishpg_tsql/antlr/TSqlParser.g4 +++ b/contrib/babelfishpg_tsql/antlr/TSqlParser.g4 @@ -1172,7 +1172,12 @@ alter_partition_scheme ; create_partition_scheme - : CREATE PARTITION SCHEME partition_scheme_name=id AS PARTITION partition_function_name=id ALL? TO LR_BRACKET id (COMMA id)* RR_BRACKET + : CREATE PARTITION SCHEME partition_scheme_name=id AS PARTITION partition_function_name=id ALL? TO LR_BRACKET filegroup_type (COMMA filegroup_type)* RR_BRACKET + ; + +filegroup_type + : PRIMARY_SQBRACKET // primary filegroup + | id // user filegroup ; // https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-remote-service-binding-transact-sql @@ -2117,7 +2122,8 @@ file_table_option storage_partition_clause : id (LR_BRACKET id RR_BRACKET)? - | char_string // can be "DEFAULT" + | PRIMARY_SQBRACKET + | DEFAULT_DOUBLE_QUOTE ; // https://msdn.microsoft.com/en-us/library/ms187956.aspx @@ -2884,7 +2890,7 @@ deny_statement ; permission_object - : (object_type colon_colon)? full_object_name (LR_BRACKET column_name_list RR_BRACKET)? + : (permission_object_type colon_colon)? full_object_name (LR_BRACKET column_name_list RR_BRACKET)? ; principals @@ -2929,6 +2935,28 @@ single_permission | UNSAFE ASSEMBLY ; +permission_object_type + : (APPLICATION|SERVER)? ROLE + | ASSEMBLY + | (ASYMMETRIC|SYMMETRIC) KEY + | AVAILABILITY GROUP + | CERTIFICATE + | CONTRACT + | DATABASE (SCOPED CREDENTIAL)? + | ENDPOINT + | FULLTEXT (CATALOG|STOPLIST) + | LOGIN + | (MESSAGE)? TYPE + | OBJECT + | REMOTE SERVICE BINDING + | ROUTE + | SCHEMA + | SEARCH PROPERTY LIST + | SERVICE + | USER + | XML SCHEMA COLLECTION + ; + object_type : AGGREGATE | APPLICATION ROLE @@ -3789,7 +3817,7 @@ function_call ; partition_function_call - : (db_name=id DOT)? DOLLAR_PARTITION DOT func_name=id LR_BRACKET function_arg_list RR_BRACKET + : (db_name=id DOT)? DOLLAR_PARTITION DOT func_name=id LR_BRACKET expression RR_BRACKET ; freetext_function @@ -3869,7 +3897,10 @@ spatial_methods ; geospatial_col - : STX + : STSRID + | STSRID_DOUBLE_QUOTE + | STSRID_SQBRACKET + | STX | STX_SQBRACKET | STX_DOUBLE_QUOTE | STY @@ -3886,10 +3917,13 @@ geospatial_col geospatial_func_no_arg : STASTEXT | STASBINARY + | STAREA ; geospatial_func_arg : STDISTANCE + | STEQUALS + | STCONTAINS ; hierarchyid_methods @@ -4992,6 +5026,7 @@ keyword | STALE_QUERY_THRESHOLD_DAYS | STANDBY | START + | STAREA | STARTED | STARTUP_STATE | START_DATE @@ -5005,9 +5040,11 @@ keyword | STATS_STREAM | STATUS | STATUSONLY + | STCONTAINS | STDEV | STDEVP | STDISTANCE + | STEQUALS | STOP | STOPAT | STOPATMARK @@ -5017,6 +5054,9 @@ keyword | STOP_ON_ERROR | STRING_AGG | STRING_DELIMITER + | STSRID + | STSRID_DOUBLE_QUOTE + | STSRID_SQBRACKET | STUFF | STX | STX_DOUBLE_QUOTE @@ -5068,6 +5108,7 @@ keyword | TRANSACTION_ID | TRANSFER | TRANSFORM_NOISE_WORDS + | TRANSLATE | TRIM | TRIPLE_DES | TRIPLE_DES_3KEY @@ -5209,7 +5250,22 @@ column_name_list_with_order /* We introduce specific index methods so as to avoid PG syntax leaks. */ column_name_list_with_order_for_vector - : simple_column_name (ASC | DESC)? (VECTOR_COSINE_OPS | VECTOR_IP_OPS | VECTOR_L2_OPS)? (COMMA simple_column_name (ASC | DESC)? (VECTOR_COSINE_OPS | VECTOR_IP_OPS | VECTOR_L2_OPS)?)* + : simple_column_name (ASC | DESC)? vector_index_ops? (COMMA simple_column_name (ASC | DESC)? vector_index_ops?)* + ; + +vector_index_ops + : VECTOR_COSINE_OPS + | VECTOR_IP_OPS + | VECTOR_L1_OPS + | VECTOR_L2_OPS + | HALFVEC_COSINE_OPS + | HALFVEC_IP_OPS + | HALFVEC_L1_OPS + | HALFVEC_L2_OPS + | SPARSEVEC_COSINE_OPS + | SPARSEVEC_IP_OPS + | SPARSEVEC_L1_OPS + | SPARSEVEC_L2_OPS ; //For some reason, sql server allows any number of prefixes: Here, h is the column: a.b.c.d.e.f.g.h @@ -5256,7 +5312,11 @@ comparison_operator ; vector_operator - : VECTOR_COSINE | VECTOR_IP | VECTOR_L2 + : VECTOR_COSINE + | VECTOR_IP + | VECTOR_L2 + | VECTOR_L1 + | VECTOR_CONCATENATE ; assignment_operator diff --git a/contrib/babelfishpg_tsql/runtime/functions.c b/contrib/babelfishpg_tsql/runtime/functions.c index 00f32181c18..e31c1de69cd 100644 --- a/contrib/babelfishpg_tsql/runtime/functions.c +++ b/contrib/babelfishpg_tsql/runtime/functions.c @@ -6,6 +6,7 @@ #include "postgres.h" #include "access/hash.h" +#include "access/nbtree.h" #include "utils/builtins.h" #include "utils/date.h" #include "utils/datetime.h" @@ -59,6 +60,7 @@ #include "../src/catalog.h" #include "../src/timezone.h" #include "../src/collation.h" +#include "../src/hooks.h" #include "../src/rolecmds.h" #include "utils/fmgroids.h" #include "utils/acl.h" @@ -67,6 +69,7 @@ #include "catalog/pg_proc.h" #include "catalog/pg_trigger.h" #include "catalog/pg_constraint.h" +#include "parser/parse_oper.h" #define TSQL_STAT_GET_ACTIVITY_COLS 26 #define SP_DATATYPE_INFO_HELPER_COLS 23 @@ -139,6 +142,7 @@ PG_FUNCTION_INFO_V1(tsql_stat_get_activity); PG_FUNCTION_INFO_V1(get_current_full_xact_id); PG_FUNCTION_INFO_V1(checksum); PG_FUNCTION_INFO_V1(has_dbaccess); +PG_FUNCTION_INFO_V1(search_partition); PG_FUNCTION_INFO_V1(object_id); PG_FUNCTION_INFO_V1(object_name); PG_FUNCTION_INFO_V1(type_id); @@ -1916,6 +1920,193 @@ checksum(PG_FUNCTION_ARGS) PG_RETURN_INT32(result); } +/* + * tsql_bsearch_arg + * This function performs a binary search on a sorted array to find the + * position of a given key value. It compares the key with array elements + * using the provided comparator function and argument. + * + * Note: This is a modified version of the standard bsearch_arg() function + * to return the index of key instead of a boolean indicating the presence of + * the key value. + */ +static int +tsql_bsearch_arg(const void *key, const void *base0, + size_t nmemb, size_t size, + int (*compar) (const void *, const void *, void *), + void *arg) +{ + const char *base = (const char *) base0; + int lim, + cmp; + const void *p; + + for (lim = nmemb; lim != 0; lim >>= 1) + { + p = base + (lim >> 1) * size; + cmp = (*compar) (key, p, arg); + if (cmp == 0) + return (((const char *)p - (const char *)base0) / size) + 2; + if (cmp > 0) + { /* key > p: move right */ + base = (const char *) p + size; + lim--; + } /* else move left */ + } + return ((base - (const char *)base0) / size) + 1; +} + + +/* + * search_partition + * This function performs a search to find the partition number + * for a given value in a specified partition function by retrieving + * the partition function metadata, and performing a binary search + * on the sorted array of partition range values. + * + * Returns: + * - The index of the partition to which the input value belongs. + * - 1, if the provided value is NULL and partition function exists in provided database. + */ +Datum +search_partition(PG_FUNCTION_ARGS) +{ + char *partition_func_name = text_to_cstring(PG_GETARG_TEXT_P(0)); + int32 result; + Relation rel; + HeapTuple tuple; + SysScanDesc scan; + ScanKeyData scanKey[2]; + int16 dbid; + ArrayType *values; + bool isnull; + Datum arg; + Oid argtypeid; + char *func_param_typname = NULL; + Oid func_param_typoid; + Oid sqlvariant_typoid; + Datum *range_values; + bool *nulls; + int nelems; + Oid cmpfunction_oid; + tsql_compare_context cxt; + Oid *arg_types; + + if (!PG_ARGISNULL(2)) /* Database is specified. */ + { + char *db_name = text_to_cstring(PG_GETARG_TEXT_P(2)); + dbid = get_db_id(db_name); + if (!DbidIsValid(dbid)) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("Invalid database name '%s'.", db_name))); + pfree(db_name); + } + else /* Database is not specified. */ + dbid = get_cur_db_id(); + + /* Get OID of sql_variant type. */ + sqlvariant_typoid = (*common_utility_plugin_ptr->get_tsql_datatype_oid) ("sql_variant"); + + /* + * Get metadata of partition function for the provided partition + * function name, if it exists in the provided database. + */ + rel = table_open(get_bbf_partition_function_oid(), AccessShareLock); + + ScanKeyInit(&scanKey[0], + Anum_bbf_partition_function_dbid, + BTEqualStrategyNumber, F_INT2EQ, + Int16GetDatum(dbid)); + + ScanKeyEntryInitialize(&scanKey[1], 0, + Anum_bbf_partition_function_name, + BTEqualStrategyNumber, InvalidOid, + tsql_get_server_collation_oid_internal(false), + F_TEXTEQ, CStringGetTextDatum(partition_func_name)); + + /* Scan using index. */ + scan = systable_beginscan(rel, get_bbf_partition_function_pk_idx_oid(), + false, NULL, 2, scanKey); + + tuple = systable_getnext(scan); + if (HeapTupleIsValid(tuple)) + { + func_param_typname = TextDatumGetCString(heap_getattr(tuple, Anum_bbf_partition_function_input_parameter_type, RelationGetDescr(rel), &isnull)); + values = DatumGetArrayTypeP(heap_getattr(tuple, Anum_bbf_partition_function_range_values, RelationGetDescr(rel), &isnull)); + deconstruct_array(values, sqlvariant_typoid, + -1, false, 'i', &range_values, &nulls, &nelems); + } + systable_endscan(scan); + table_close(rel, AccessShareLock); + + /* Raise error if provided partition function doesn't exist in the provided database. */ + if (!func_param_typname) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("Invalid object name '%s'.", partition_func_name))); + + /* + * If the partition function exists in the provided database and + * provided value is NULL then return 1 because NULL values will always + * belong to first partition. + */ + if (PG_ARGISNULL(1)) + { + pfree(partition_func_name); + pfree(func_param_typname); + pfree(nulls); + pfree(range_values); + PG_RETURN_INT32(1); + } + + argtypeid = get_fn_expr_argtype(fcinfo->flinfo, 1); + arg = PG_GETARG_DATUM(1); + + /* Get OID of partition function parameter type. */ + func_param_typoid = (*common_utility_plugin_ptr->get_tsql_datatype_oid) (func_param_typname); + + /* + * Implicitly convert input value to parameter type of + * partition function and it will raise error if conversion fails. + */ + arg = pltsql_exec_tsql_cast_value(arg, &isnull, argtypeid, -1, func_param_typoid, -1); + + /* Cast it to sql_variant */ + arg = pltsql_exec_tsql_cast_value(arg, &isnull, + func_param_typoid, -1, + sqlvariant_typoid, -1); + + /* + * Find oid of comparator function for sqlvariant type, which will be + * used for comparison during binary search. Here, we are searching the + * for "sqlvarint_cmp" function in "sys" schema with sqlvariant arg types + * to ensure that we get a unique result. + */ + arg_types = (Oid *) palloc(2 * sizeof(Oid)); + arg_types[0] = sqlvariant_typoid; + arg_types[1] = sqlvariant_typoid; + cmpfunction_oid = GetSysCacheOid3(PROCNAMEARGSNSP, Anum_pg_proc_oid, + CStringGetDatum("sqlvariant_cmp"), + PointerGetDatum(buildoidvector(arg_types, 2)), + ObjectIdGetDatum(get_namespace_oid("sys", false))); + + cxt.function_oid = cmpfunction_oid; + cxt.colloid = tsql_get_server_collation_oid_internal(false); + + /* Perform binary search on sorted range values. */ + result = tsql_bsearch_arg(&arg, range_values, nelems, sizeof(Datum), tsql_compare_values, &cxt); + + /* Free the allocated memory. */ + pfree(arg_types); + pfree(partition_func_name); + pfree(func_param_typname); + pfree(nulls); + pfree(range_values); + + PG_RETURN_INT32(result); +} + /* * object_id * Returns the object ID with object name and object type as input where object type is optional @@ -2130,6 +2321,17 @@ object_id(PG_FUNCTION_ARGS) !strcmp(object_type, "pc") || !strcmp(object_type, "tf") || !strcmp(object_type, "rf") || !strcmp(object_type, "x")) { + /* + * If the object type is not specified as 'tr' and it's actually a trigger, + * then object_id() should return NULL. + */ + if (OidIsValid(tsql_get_trigger_oid(object_name, schema_oid, user_id))) + { + pfree(object_name); + pfree(object_type); + PG_RETURN_NULL(); + } + /* search in pg_proc by name and schema oid */ result = tsql_get_proc_oid(object_name, schema_oid, user_id); } diff --git a/contrib/babelfishpg_tsql/sql/babelfish_partitions.sql b/contrib/babelfishpg_tsql/sql/babelfish_partitions.sql new file mode 100644 index 00000000000..fecd4d28cec --- /dev/null +++ b/contrib/babelfishpg_tsql/sql/babelfish_partitions.sql @@ -0,0 +1,51 @@ +-- BBF_PARTITION_FUNCTION +-- This catalog stores the metadata of partition funtions. +CREATE TABLE sys.babelfish_partition_function +( + dbid SMALLINT NOT NULL, -- to maintain separation b/w databases + function_id INT NOT NULL UNIQUE, -- globally unique ID of partition function + partition_function_name sys.NVARCHAR(128) NOT NULL COLLATE sys.database_default, + input_parameter_type sys.sysname, -- data type of the column which will be used for partitioning + partition_option sys.bit, -- whether boundary option is LEFT or RIGHT + range_values sys.sql_variant[] CHECK (array_length(range_values, 1) < 15000), -- boundary values + create_date SYS.DATETIME NOT NULL, + modify_date SYS.DATETIME NOT NULL, + PRIMARY KEY(dbid, partition_function_name) +); + +-- SEQUENCE to maintain the ID of partition function. +CREATE SEQUENCE sys.babelfish_partition_function_seq MAXVALUE 2147483647 CYCLE; + +-- BBF_PARTITION_SCHEME +-- This catalog stores the metadata of partition schemes. +CREATE TABLE sys.babelfish_partition_scheme +( + dbid SMALLINT NOT NULL, -- to maintain separation between databases + scheme_id INT NOT NULL UNIQUE, -- globally unique ID of partition scheme + partition_scheme_name sys.NVARCHAR(128) NOT NULL COLLATE sys.database_default, + partition_function_name sys.NVARCHAR(128) NOT NULL COLLATE sys.database_default, + next_used sys.bit, -- next used filegroup is specified or not during creation + PRIMARY KEY(dbid, partition_scheme_name) +); + +-- SEQUENCE to maintain the ID of partition scheme. +-- The combination of the partition scheme ID and filegroup ID are used as +-- DATA_SPACE_ID, where the value 1 is reseverd for [PRIMARY] filegroup. +CREATE SEQUENCE sys.babelfish_partition_scheme_seq START 2 MAXVALUE 2147483647 CYCLE; + +-- BBF_PARTITION_DEPEND +-- This catalog tracks the dependecy between partition scheme and partitioned tables created using that. +CREATE TABLE sys.babelfish_partition_depend +( + dbid SMALLINT NOT NULL, -- to maintain separation between databases + partition_scheme_name sys.NVARCHAR(128) NOT NULL COLLATE sys.database_default, + schema_name sys.NVARCHAR(128) NOT NULL COLLATE sys.database_default, + table_name sys.NVARCHAR(128) NOT NULL COLLATE sys.database_default, + PRIMARY KEY(dbid, schema_name, table_name) +); + +SELECT pg_catalog.pg_extension_config_dump('sys.babelfish_partition_function', ''); +SELECT pg_catalog.pg_extension_config_dump('sys.babelfish_partition_scheme', ''); +SELECT pg_catalog.pg_extension_config_dump('sys.babelfish_partition_depend', ''); +SELECT pg_catalog.pg_extension_config_dump('sys.babelfish_partition_function_seq', ''); +SELECT pg_catalog.pg_extension_config_dump('sys.babelfish_partition_scheme_seq', ''); diff --git a/contrib/babelfishpg_tsql/sql/babelfishpg_tsql.in b/contrib/babelfishpg_tsql/sql/babelfishpg_tsql.in index 3c0d2f88428..d0c8c4a1620 100644 --- a/contrib/babelfishpg_tsql/sql/babelfishpg_tsql.in +++ b/contrib/babelfishpg_tsql/sql/babelfishpg_tsql.in @@ -15,6 +15,7 @@ SELECT set_config('search_path', 'sys, '||current_setting('search_path'), false) #include "sys_cast.sql" #include "coerce.sql" #include "object_definition_tsql.sql" +#include "babelfish_partitions.sql" #include "linked_servers_tsql.sql" #include "ownership.sql" #include "sys_views.sql" diff --git a/contrib/babelfishpg_tsql/sql/babelfishpg_tsql.sql b/contrib/babelfishpg_tsql/sql/babelfishpg_tsql.sql index cb16798e271..48d2a8405b8 100644 --- a/contrib/babelfishpg_tsql/sql/babelfishpg_tsql.sql +++ b/contrib/babelfishpg_tsql/sql/babelfishpg_tsql.sql @@ -640,6 +640,8 @@ BEGIN WHEN 'datetimeoffset' THEN tds_id = 43; WHEN 'timestamp' THEN tds_id = 173; WHEN 'vector' THEN tds_id = 167; -- Same as varchar + WHEN 'sparsevec' THEN tds_id = 167; -- Same as varchar + WHEN 'halfvec' THEN tds_id = 167; -- Same as varchar WHEN 'geometry' THEN tds_id = 240; WHEN 'geography' THEN tds_id = 240; ELSE tds_id = 0; @@ -977,16 +979,17 @@ END AS TABLE_TYPE, CAST(NULL AS varchar(254)) AS remarks FROM pg_catalog.pg_class AS t1, sys.pg_namespace_ext AS t2, sys.schemas AS t3 -WHERE t1.relnamespace = t3.schema_id AND t1.relnamespace = t2.oid AND t1.relkind IN ('r','v','m') +WHERE t1.relnamespace = t3.schema_id AND t1.relnamespace = t2.oid AND t1.relkind IN ('r','p','v','m') +AND t1.relispartition = false AND has_schema_privilege(t1.relnamespace, 'USAGE') AND has_table_privilege(t1.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER'); GRANT SELECT ON sys.sp_tables_view TO PUBLIC; CREATE OR REPLACE FUNCTION sys.sp_tables_internal( - in_table_name sys.nvarchar(384) = '', - in_table_owner sys.nvarchar(384) = '', - in_table_qualifier sys.sysname = '', - in_table_type sys.varchar(100) = '', + in_table_name sys.nvarchar(384) = NULL, + in_table_owner sys.nvarchar(384) = NULL, + in_table_qualifier sys.sysname = NULL, + in_table_type sys.varchar(100) = NULL, in_fusepattern sys.bit = '1') RETURNS TABLE ( out_table_qualifier sys.sysname, @@ -1015,12 +1018,10 @@ CREATE OR REPLACE FUNCTION sys.sp_tables_internal( CAST(table_type AS sys.varchar(32)) AS TABLE_TYPE, CAST(remarks AS sys.varchar(254)) AS REMARKS FROM sys.sp_tables_view - WHERE ((SELECT coalesce(in_table_name,'')) = '' OR table_name LIKE in_table_name collate sys.database_default) - AND ((SELECT coalesce(in_table_owner,'')) = '' OR table_owner LIKE in_table_owner collate sys.database_default) - AND ((SELECT coalesce(in_table_qualifier,'')) = '' OR table_qualifier LIKE in_table_qualifier collate sys.database_default) - AND ((SELECT coalesce(cs_as_in_table_type,'')) = '' - OR table_type = opt_table - OR table_type = opt_view) + WHERE (in_table_name IS NULL OR table_name LIKE in_table_name collate sys.database_default) + AND (in_table_owner IS NULL OR table_owner LIKE in_table_owner collate sys.database_default) + AND (in_table_qualifier IS NULL OR table_qualifier LIKE in_table_qualifier collate sys.database_default) + AND (cs_as_in_table_type IS NULL OR table_type = opt_table OR table_type = opt_view) ORDER BY table_qualifier, table_owner, table_name; ELSE RETURN query @@ -1031,30 +1032,40 @@ CREATE OR REPLACE FUNCTION sys.sp_tables_internal( CAST(table_type AS sys.varchar(32)) AS TABLE_TYPE, CAST(remarks AS sys.varchar(254)) AS REMARKS FROM sys.sp_tables_view - WHERE ((SELECT coalesce(in_table_name,'')) = '' OR table_name = in_table_name collate sys.database_default) - AND ((SELECT coalesce(in_table_owner,'')) = '' OR table_owner = in_table_owner collate sys.database_default) - AND ((SELECT coalesce(in_table_qualifier,'')) = '' OR table_qualifier = in_table_qualifier collate sys.database_default) - AND ((SELECT coalesce(cs_as_in_table_type,'')) = '' - OR table_type = opt_table - OR table_type = opt_view) + WHERE (in_table_name IS NULL OR table_name = in_table_name collate sys.database_default) + AND (in_table_owner IS NULL OR table_owner = in_table_owner collate sys.database_default) + AND (in_table_qualifier IS NULL OR table_qualifier = in_table_qualifier collate sys.database_default) + AND (cs_as_in_table_type IS NULL OR table_type = opt_table OR table_type = opt_view) ORDER BY table_qualifier, table_owner, table_name; END IF; END; $$ LANGUAGE plpgsql STABLE; - CREATE OR REPLACE PROCEDURE sys.sp_tables ( - "@table_name" sys.nvarchar(384) = '', - "@table_owner" sys.nvarchar(384) = '', - "@table_qualifier" sys.sysname = '', - "@table_type" sys.nvarchar(100) = '', + "@table_name" sys.nvarchar(384) = NULL, + "@table_owner" sys.nvarchar(384) = NULL, + "@table_qualifier" sys.sysname = NULL, + "@table_type" sys.nvarchar(100) = NULL, "@fusepattern" sys.bit = '1') AS $$ - DECLARE @opt_table sys.varchar(16) = ''; - DECLARE @opt_view sys.varchar(16) = ''; BEGIN - IF (@table_qualifier != '') AND (LOWER(@table_qualifier) != LOWER(sys.db_name())) + + -- Handle special case: Enumerate all databases when name and owner are blank but qualifier is '%' + IF (@table_qualifier = '%' AND @table_owner = '' AND @table_name = '') + BEGIN + SELECT + d.name AS TABLE_QUALIFIER, + CAST(NULL AS sys.sysname) AS TABLE_OWNER, + CAST(NULL AS sys.sysname) AS TABLE_NAME, + CAST(NULL AS sys.varchar(32)) AS TABLE_TYPE, + CAST(NULL AS sys.varchar(254)) AS REMARKS + FROM sys.databases d ORDER BY TABLE_QUALIFIER; + + RETURN; + END; + + IF (@table_qualifier != '' AND LOWER(@table_qualifier) != LOWER(sys.db_name())) BEGIN THROW 33557097, N'The database name component of the object qualifier must be the name of the current database.', 1; END @@ -2122,7 +2133,7 @@ BEGIN BEGIN IF EXISTS ( -- Search in the sys schema SELECT * FROM sys.sp_stored_procedures_view - WHERE (LOWER(LEFT(procedure_name, -2)) = LOWER(@sp_name)) + WHERE (LOWER(LEFT(procedure_name, LEN(procedure_name)-2)) = LOWER(@sp_name)) AND (LOWER(procedure_owner) = 'sys')) BEGIN SELECT PROCEDURE_QUALIFIER, @@ -2133,13 +2144,13 @@ BEGIN NUM_RESULT_SETS, REMARKS, PROCEDURE_TYPE FROM sys.sp_stored_procedures_view - WHERE (LOWER(LEFT(procedure_name, -2)) = LOWER(@sp_name)) + WHERE (LOWER(LEFT(procedure_name, LEN(procedure_name)-2)) = LOWER(@sp_name)) AND (LOWER(procedure_owner) = 'sys') ORDER BY procedure_qualifier, procedure_owner, procedure_name; END ELSE IF EXISTS ( SELECT * FROM sys.sp_stored_procedures_view - WHERE (LOWER(LEFT(procedure_name, -2)) = LOWER(@sp_name)) + WHERE (LOWER(LEFT(procedure_name, LEN(procedure_name)-2)) = LOWER(@sp_name)) AND (LOWER(procedure_owner) = LOWER(SCHEMA_NAME())) ) BEGIN @@ -2151,7 +2162,7 @@ BEGIN NUM_RESULT_SETS, REMARKS, PROCEDURE_TYPE FROM sys.sp_stored_procedures_view - WHERE (LOWER(LEFT(procedure_name, -2)) = LOWER(@sp_name)) + WHERE (LOWER(LEFT(procedure_name, LEN(procedure_name)-2)) = LOWER(@sp_name)) AND (LOWER(procedure_owner) = LOWER(SCHEMA_NAME())) ORDER BY procedure_qualifier, procedure_owner, procedure_name; END @@ -2165,7 +2176,7 @@ BEGIN NUM_RESULT_SETS, REMARKS, PROCEDURE_TYPE FROM sys.sp_stored_procedures_view - WHERE (LOWER(LEFT(procedure_name, -2)) = LOWER(@sp_name)) + WHERE (LOWER(LEFT(procedure_name, LEN(procedure_name)-2)) = LOWER(@sp_name)) AND (LOWER(procedure_owner) = 'dbo') ORDER BY procedure_qualifier, procedure_owner, procedure_name; END @@ -2182,7 +2193,7 @@ BEGIN NUM_RESULT_SETS, REMARKS, PROCEDURE_TYPE FROM sys.sp_stored_procedures_view - WHERE (LOWER(LEFT(procedure_name, -2)) = LOWER(@sp_name)) + WHERE (LOWER(LEFT(procedure_name, LEN(procedure_name)-2)) = LOWER(@sp_name)) AND (LOWER(procedure_owner) = LOWER(@sp_owner)) ORDER BY procedure_qualifier, procedure_owner, procedure_name; END @@ -2197,7 +2208,7 @@ BEGIN NUM_RESULT_SETS, REMARKS, PROCEDURE_TYPE FROM sys.sp_stored_procedures_view - WHERE ((SELECT COALESCE(@sp_name,'')) = '' OR LOWER(LEFT(procedure_name, -2)) LIKE LOWER(@sp_name)) + WHERE ((SELECT COALESCE(@sp_name,'')) = '' OR LOWER(LEFT(procedure_name, LEN(procedure_name)-2)) LIKE LOWER(@sp_name)) AND ((SELECT COALESCE(@sp_owner,'')) = '' OR LOWER(procedure_owner) LIKE LOWER(@sp_owner)) ORDER BY procedure_qualifier, procedure_owner, procedure_name; END @@ -3019,7 +3030,7 @@ AS $$ BEGIN SELECT (ROW_NUMBER() OVER (ORDER BY NULL)) as row, * INTO #sp_rename_temptable - FROM STRING_SPLIT(@input, '.') ORDER BY row DESC; + FROM sys.babelfish_split_identifier(@input) ORDER BY row DESC; SELECT (ROW_NUMBER() OVER (ORDER BY NULL)) as id, * INTO #sp_rename_temptable2 @@ -3334,8 +3345,8 @@ BEGIN -- Need to use a guaranteed-uniquely named table as intermediate step since we cannot -- access the metadata in case a #tmp table is passed as argument -- But when we copy the #tmp table into another table, we get all the attributes and metadata - DECLARE @tmptab sys.VARCHAR(63) = 'sp_babelfish_autoformat' + sys.REPLACE(NEWID(), '-', '') - DECLARE @tmptab2 sys.VARCHAR(63) = 'sp_babelfish_autoformat' + sys.REPLACE(NEWID(), '-', '') + DECLARE @tmptab sys.VARCHAR(63) = 'sp_babelfish_autoformat' + sys.REPLACE(CAST(NEWID() AS sys.NVARCHAR(36)), '-', '') + DECLARE @tmptab2 sys.VARCHAR(63) = 'sp_babelfish_autoformat' + sys.REPLACE(CAST(NEWID() AS sys.NVARCHAR(36)), '-', '') DECLARE @cmd sys.VARCHAR(1000) = 'SELECT * INTO ' + @tmptab + ' FROM ' + @tab BEGIN TRY @@ -3463,9 +3474,9 @@ BEGIN -- Get the executing statement for each spid and extract the main stmt type -- This is for informational purposes only - SELECT pid, query INTO #sp_who_tmp FROM pg_stat_activity pgsa + SELECT pid, CAST(query AS sys.VARCHAR(MAX)) INTO #sp_who_tmp FROM pg_stat_activity pgsa - UPDATE #sp_who_tmp SET query = ' ' + TRIM(UPPER(query)) + UPDATE #sp_who_tmp SET query = ' ' + TRIM(CAST(UPPER(query) AS sys.VARCHAR(MAX))) UPDATE #sp_who_tmp SET query = sys.REPLACE(query, chr(9), ' ') UPDATE #sp_who_tmp SET query = sys.REPLACE(query, chr(10), ' ') UPDATE #sp_who_tmp SET query = sys.REPLACE(query, chr(13), ' ') diff --git a/contrib/babelfishpg_tsql/sql/collation.sql b/contrib/babelfishpg_tsql/sql/collation.sql index d24fd5a549e..02d889f367a 100644 --- a/contrib/babelfishpg_tsql/sql/collation.sql +++ b/contrib/babelfishpg_tsql/sql/collation.sql @@ -201,8 +201,27 @@ INSERT INTO sys.babelfish_helpcollation VALUES (N'vietnamese_cs_as', N'Vietnames INSERT INTO sys.babelfish_helpcollation VALUES (N'vietnamese_ci_as', N'Vietnamese, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive'); INSERT INTO sys.babelfish_helpcollation VALUES (N'vietnamese_ci_ai', N'Vietnamese, case-insensitive, accent-insensitive, kanatype-insensitive, width-insensitive'); -create or replace function sys.remove_accents_internal(IN TEXT) RETURNS sys.NVARCHAR +CREATE OR REPLACE FUNCTION sys.remove_accents_internal(IN TEXT) RETURNS sys.NVARCHAR AS 'babelfishpg_tsql', 'remove_accents_internal' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; +CREATE OR REPLACE FUNCTION sys.remove_accents_internal_using_cache(IN TEXT) RETURNS sys.NVARCHAR +AS 'babelfishpg_tsql', 'remove_accents_internal_using_cache' +LANGUAGE C +IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.get_icu_major_version() RETURNS INT4 +AS 'babelfishpg_tsql', 'get_icu_major_version' +LANGUAGE C +IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.get_icu_minor_version() RETURNS INT4 +AS 'babelfishpg_tsql', 'get_icu_minor_version' +LANGUAGE C +IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.patindex_ai_collations(in pattern character varying, in expression character varying) returns bigint +AS 'babelfishpg_tsql', 'patindex_ai_collations' +LANGUAGE C +IMMUTABLE STRICT; diff --git a/contrib/babelfishpg_tsql/sql/information_schema_tsql.sql b/contrib/babelfishpg_tsql/sql/information_schema_tsql.sql index 2f37a85d600..e3c68f35001 100644 --- a/contrib/babelfishpg_tsql/sql/information_schema_tsql.sql +++ b/contrib/babelfishpg_tsql/sql/information_schema_tsql.sql @@ -57,7 +57,7 @@ $$SELECT THEN 1073741823 WHEN type = 'sysname' THEN 128 - WHEN type IN ('xml', 'vector', 'geometry', 'geography') + WHEN type IN ('xml', 'vector', 'halfvec', 'sparsevec', 'geometry', 'geography') THEN -1 WHEN type = 'sql_variant' THEN 0 @@ -241,16 +241,28 @@ CREATE OR REPLACE VIEW information_schema_tsql.columns_internal AS SELECT c.oid AS "TABLE_OID", CAST(nc.dbname AS sys.nvarchar(128)) AS "TABLE_CATALOG", CAST(ext.orig_name AS sys.nvarchar(128)) AS "TABLE_SCHEMA", - CAST(CASE - WHEN c.reloptions[1] LIKE 'bbf_original_rel_name=%' THEN substring(c.reloptions[1], 23) - ELSE c.relname - END AS sys.nvarchar(128)) AS "TABLE_NAME", - - CAST(CASE - WHEN a.attoptions[1] LIKE 'bbf_original_name=%' THEN substring(a.attoptions[1], 19) - ELSE a.attname - END AS sys.nvarchar(128)) AS "COLUMN_NAME", - + CAST( + COALESCE( + (SELECT string_agg( + CASE + WHEN option LIKE 'bbf_original_rel_name=%' THEN substring(option, 23 /* prefix length */) + ELSE NULL + END, ',') + FROM unnest(c.reloptions) AS option), + c.relname) + AS sys.nvarchar(128)) AS "TABLE_NAME", + + CAST( + COALESCE( + (SELECT string_agg( + CASE + WHEN option LIKE 'bbf_original_name=%' THEN substring(option, 19 /* prefix length */) + ELSE NULL + END, ',') + FROM unnest(a.attoptions) AS option), + a.attname) + AS sys.nvarchar(128)) AS "COLUMN_NAME", + CAST(a.attnum AS int) AS "ORDINAL_POSITION", CAST(CASE WHEN a.attgenerated = '' THEN pg_get_expr(ad.adbin, ad.adrelid) END AS sys.nvarchar(4000)) AS "COLUMN_DEFAULT", CAST(CASE WHEN a.attnotnull OR (t.typtype = 'd' AND t.typnotnull) THEN 'NO' ELSE 'YES' END @@ -333,6 +345,7 @@ CREATE OR REPLACE VIEW information_schema_tsql.columns_internal AS WHERE (NOT pg_is_other_temp_schema(nc.oid)) AND a.attnum > 0 AND NOT a.attisdropped AND c.relkind IN ('r', 'v', 'p') + AND c.relispartition = false AND (pg_has_role(c.relowner, 'USAGE') OR has_column_privilege(c.oid, a.attnum, 'SELECT, INSERT, UPDATE, REFERENCES')) @@ -448,9 +461,15 @@ CREATE VIEW information_schema_tsql.tables AS SELECT CAST(nc.dbname AS sys.nvarchar(128)) AS "TABLE_CATALOG", CAST(ext.orig_name AS sys.nvarchar(128)) AS "TABLE_SCHEMA", CAST( - CASE WHEN c.reloptions[1] LIKE 'bbf_original_rel_name%' THEN substring(c.reloptions[1], 23) - ELSE c.relname END - AS sys._ci_sysname) AS "TABLE_NAME", + COALESCE( + (SELECT string_agg( + CASE + WHEN option LIKE 'bbf_original_rel_name=%' THEN substring(option, 23) + ELSE NULL + END, ',') + FROM unnest(c.reloptions) AS option), + c.relname) + AS sys._ci_sysname) AS "TABLE_NAME", CAST( CASE WHEN c.relkind IN ('r', 'p') THEN 'BASE TABLE' @@ -463,6 +482,7 @@ CREATE VIEW information_schema_tsql.tables AS LEFT JOIN sys.table_types_internal tt on c.oid = tt.typrelid WHERE c.relkind IN ('r', 'v', 'p') + AND c.relispartition = false AND (NOT pg_is_other_temp_schema(nc.oid)) AND tt.typrelid IS NULL AND (pg_has_role(c.relowner, 'USAGE') @@ -502,6 +522,7 @@ CREATE VIEW information_schema_tsql.table_constraints AS AND c.conrelid = r.oid AND c.contype NOT IN ('t', 'x') AND r.relkind IN ('r', 'p') + AND relispartition = false AND (NOT pg_is_other_temp_schema(nr.oid)) AND (pg_has_role(r.relowner, 'USAGE') OR has_table_privilege(r.oid, 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER') @@ -565,6 +586,7 @@ CREATE VIEW information_schema_tsql.check_constraints AS AND c.conrelid = r.oid AND c.contype = 'c' AND r.relkind IN ('r', 'p') + AND r.relispartition = false AND (NOT pg_is_other_temp_schema(nc.oid)) AND (pg_has_role(r.relowner, 'USAGE') OR has_table_privilege(r.oid, 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER') @@ -605,6 +627,7 @@ FROM ( AND c.connamespace = nc.oid AND c.contype = 'c' AND r.relkind IN ('r', 'p') + AND r.relispartition = false AND NOT a.attisdropped AND (pg_has_role(r.relowner, 'USAGE') OR has_table_privilege(r.oid, 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER') @@ -627,6 +650,7 @@ FROM ( AND NOT a.attisdropped AND c.contype IN ('p', 'u', 'f') AND r.relkind IN ('r', 'p') + AND r.relispartition = false AND (pg_has_role(r.relowner, 'USAGE') OR has_table_privilege(r.oid, 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER') OR has_any_column_privilege(r.oid, 'SELECT, INSERT, UPDATE, REFERENCES')) @@ -809,7 +833,7 @@ CREATE OR REPLACE VIEW information_schema_tsql.key_column_usage AS CAST(ord AS int) AS "ORDINAL_POSITION" FROM pg_constraint c - JOIN pg_class r ON r.oid = c.conrelid AND c.contype in ('p','u','f') AND r.relkind in ('r','p') + JOIN pg_class r ON r.oid = c.conrelid AND c.contype in ('p','u','f') AND r.relkind in ('r','p') AND r.relispartition = false JOIN sys.pg_namespace_ext nc ON nc.oid = c.connamespace AND r.relnamespace = nc.oid JOIN sys.babelfish_namespace_ext ext ON ext.nspname = nc.nspname AND ext.dbid = sys.db_id() CROSS JOIN unnest(c.conkey) WITH ORDINALITY AS ak(j,ord) diff --git a/contrib/babelfishpg_tsql/sql/ownership.sql b/contrib/babelfishpg_tsql/sql/ownership.sql index a6a7b85deb2..dbbda19e433 100644 --- a/contrib/babelfishpg_tsql/sql/ownership.sql +++ b/contrib/babelfishpg_tsql/sql/ownership.sql @@ -41,7 +41,7 @@ CREATE TABLE sys.babelfish_function_ext ( create_date SYS.DATETIME NOT NULL, modify_date SYS.DATETIME NOT NULL, definition sys.NTEXT DEFAULT NULL, - PRIMARY KEY(nspname, funcsignature) + PRIMARY KEY(funcname, nspname, funcsignature) ); GRANT SELECT ON sys.babelfish_function_ext TO PUBLIC; @@ -290,6 +290,8 @@ BEGIN EXECUTE format('GRANT %I to bbf_role_admin WITH ADMIN TRUE;', sa_name); EXECUTE format('CREATE ROLE sysadmin CREATEDB CREATEROLE INHERIT ROLE %I', sa_name); EXECUTE format('GRANT sysadmin TO bbf_role_admin WITH ADMIN TRUE'); + EXECUTE format('GRANT USAGE, SELECT ON SEQUENCE sys.babelfish_partition_function_seq TO sysadmin WITH GRANT OPTION'); + EXECUTE format('GRANT USAGE, SELECT ON SEQUENCE sys.babelfish_partition_scheme_seq TO sysadmin WITH GRANT OPTION'); EXECUTE format('GRANT USAGE, SELECT ON SEQUENCE sys.babelfish_db_seq TO sysadmin WITH GRANT OPTION'); EXECUTE format('GRANT CREATE, CONNECT, TEMPORARY ON DATABASE %s TO sysadmin WITH GRANT OPTION', CURRENT_DATABASE()); EXECUTE format('ALTER DATABASE %s SET babelfishpg_tsql.enable_ownership_structure = true', CURRENT_DATABASE()); @@ -312,6 +314,8 @@ BEGIN CALL sys.babel_drop_all_logins(); EXECUTE format('ALTER DATABASE %s SET babelfishpg_tsql.enable_ownership_structure = false', CURRENT_DATABASE()); EXECUTE 'ALTER SEQUENCE sys.babelfish_db_seq RESTART'; + EXECUTE 'ALTER SEQUENCE sys.babelfish_partition_function_seq RESTART'; + EXECUTE 'ALTER SEQUENCE sys.babelfish_partition_scheme_seq RESTART'; DROP OWNED BY sysadmin; DROP ROLE sysadmin; DROP OWNED BY bbf_role_admin; @@ -362,10 +366,25 @@ CAST(CASE WHEN Ext.type = 'R' THEN 1 ELSE Ext.owning_principal_id END AS INT) AS CAST(CASE WHEN Ext.type = 'R' THEN 1 ELSE Ext.is_fixed_role END AS sys.BIT) AS is_fixed_role FROM pg_catalog.pg_roles AS Base INNER JOIN sys.babelfish_authid_login_ext AS Ext ON Base.rolname = Ext.rolname WHERE (pg_has_role(suser_id(), 'sysadmin'::TEXT, 'MEMBER') -OR Ext.orig_loginname = suser_name() -OR Ext.orig_loginname = (SELECT pg_get_userbyid(datdba) FROM pg_database WHERE datname = CURRENT_DATABASE()) COLLATE sys.database_default -OR Ext.type = 'R') -AND Ext.type != 'Z'; + OR Ext.orig_loginname = suser_name() + OR Ext.orig_loginname = (SELECT pg_get_userbyid(datdba) FROM pg_database WHERE datname = CURRENT_DATABASE()) COLLATE sys.database_default + OR Ext.type = 'R') + AND Ext.type != 'Z' +UNION ALL +SELECT +CAST('public' AS SYS.SYSNAME) AS name, +CAST(-1 AS INT) AS principal_id, +CAST(CAST(0 as INT) as sys.varbinary(85)) AS sid, +CAST('R' AS CHAR(1)) as type, +CAST('SERVER_ROLE' AS NVARCHAR(60)) AS type_desc, +CAST(0 AS INT) AS is_disabled, +CAST(NULL AS SYS.DATETIME) AS create_date, +CAST(NULL AS SYS.DATETIME) AS modify_date, +CAST(NULL AS SYS.SYSNAME) AS default_database_name, +CAST(NULL AS SYS.SYSNAME) AS default_language_name, +CAST(NULL AS INT) AS credential_id, +CAST(1 AS INT) AS owning_principal_id, +CAST(0 AS sys.BIT) AS is_fixed_role; GRANT SELECT ON sys.server_principals TO PUBLIC; @@ -431,6 +450,8 @@ ON Base.rolname = Ext.rolname LEFT OUTER JOIN pg_catalog.pg_roles Base2 ON Ext.login_name = Base2.rolname WHERE Ext.database_name = DB_NAME() + AND (Ext.orig_username IN ('dbo', 'db_owner', 'guest') -- system users should always be visible + OR pg_has_role(Ext.rolname, 'MEMBER')) -- Current user should be able to see users it has permission of UNION ALL SELECT CAST(name AS SYS.SYSNAME) AS name, @@ -493,6 +514,7 @@ CAST(CAST(Base2.oid AS INT) AS SYS.VARBINARY(85)) AS SID, CAST(Ext.orig_username AS SYS.NVARCHAR(128)) AS NAME, CAST(CASE WHEN Ext.type = 'U' THEN 'WINDOWS LOGIN' +WHEN Ext.type = 'R' THEN 'ROLE' ELSE 'SQL USER' END AS SYS.NVARCHAR(128)) AS TYPE, CAST('GRANT OR DENY' as SYS.NVARCHAR(128)) as USAGE @@ -501,8 +523,8 @@ ON Base.rolname = Ext.rolname LEFT OUTER JOIN pg_catalog.pg_roles Base2 ON Ext.login_name = Base2.rolname WHERE Ext.database_name = sys.DB_NAME() -AND Ext.rolname = CURRENT_USER -AND Ext.type in ('S','U') +AND ((Ext.rolname = CURRENT_USER AND Ext.type in ('S','U')) OR +((SELECT orig_username FROM sys.babelfish_authid_user_ext WHERE rolname = CURRENT_USER) != 'dbo' AND Ext.type = 'R' AND pg_has_role(current_user, Ext.rolname, 'MEMBER'))) UNION ALL SELECT CAST(-1 AS INT) AS principal_id, diff --git a/contrib/babelfishpg_tsql/sql/sys_function_helpers.sql b/contrib/babelfishpg_tsql/sql/sys_function_helpers.sql index a0e9fb8719a..de927953598 100644 --- a/contrib/babelfishpg_tsql/sql/sys_function_helpers.sql +++ b/contrib/babelfishpg_tsql/sql/sys_function_helpers.sql @@ -115,7 +115,7 @@ DECLARE DATATYPE_REGEXP CONSTANT VARCHAR COLLATE "C" := '^\s*(CHAR|NCHAR|VARCHAR|NVARCHAR|CHARACTER VARYING)\s*$'; DATATYPE_MASK_REGEXP CONSTANT VARCHAR COLLATE "C" := '^\s*(?:CHAR|NCHAR|VARCHAR|NVARCHAR|CHARACTER VARYING)\s*\(\s*(\d+|MAX)\s*\)\s*$'; BEGIN - v_datatype := upper(trim(p_datatype)); + v_datatype := pg_catalog.upper(trim(p_datatype)); v_style := floor(p_style)::SMALLINT; IF (scale(p_style) > 0) THEN @@ -131,7 +131,7 @@ BEGIN END IF; IF (v_datatype ~* DATATYPE_MASK_REGEXP) THEN - v_res_datatype := rtrim(split_part(v_datatype, '(', 1)); + v_res_datatype := PG_CATALOG.rtrim(split_part(v_datatype, '(', 1)); v_maxlength := CASE WHEN (v_res_datatype IN ('CHAR', 'VARCHAR')) THEN VARCHAR_MAX @@ -159,7 +159,7 @@ BEGIN ELSE sys.babelfish_conv_greg_to_hijri(p_dateval) + 1 END; - v_day := ltrim(to_char(v_dateval, 'DD'), '0'); + v_day := PG_CATALOG.ltrim(to_char(v_dateval, 'DD'), '0'); v_month := to_char(v_dateval, 'MM')::SMALLINT; v_language := CASE @@ -234,7 +234,7 @@ EXCEPTION WHEN interval_field_overflow THEN RAISE USING MESSAGE := pg_catalog.format('The size (%s) given to the convert specification ''%s'' exceeds the maximum allowed for any data type (%s).', v_lengthexpr, - lower(v_res_datatype), + pg_catalog.lower(v_res_datatype), v_maxlength), DETAIL := 'Use of incorrect size value of data type parameter during conversion process.', HINT := 'Change size component of data type parameter to the allowable value and try again.'; @@ -252,7 +252,7 @@ EXCEPTION WHEN invalid_text_representation THEN GET STACKED DIAGNOSTICS v_err_message = MESSAGE_TEXT; - v_err_message := substring(lower(v_err_message), 'integer\:\s\"(.*)\"'); + v_err_message := substring(pg_catalog.lower(v_err_message), 'integer\:\s\"(.*)\"'); RAISE USING MESSAGE := pg_catalog.format('Error while trying to convert "%s" value to SMALLINT (or INTEGER) data type.', v_err_message), @@ -299,15 +299,15 @@ DECLARE DATATYPE_MASK_REGEXP CONSTANT VARCHAR COLLATE "C" := '^\s*(?:CHAR|NCHAR|VARCHAR|NVARCHAR|CHARACTER VARYING)\s*\(\s*(\d+|MAX)\s*\)\s*$'; v_datetimeval TIMESTAMP(6) WITHOUT TIME ZONE; BEGIN - v_datatype := upper(trim(p_datatype)); - v_src_datatype := upper(trim(p_src_datatype)); + v_datatype := pg_catalog.upper(trim(p_datatype)); + v_src_datatype := pg_catalog.upper(trim(p_src_datatype)); v_style := floor(p_style)::SMALLINT; IF (v_src_datatype ~* SRCDATATYPE_MASK_REGEXP) THEN v_scale := substring(v_src_datatype, SRCDATATYPE_MASK_REGEXP)::SMALLINT; - v_src_datatype := rtrim(split_part(v_src_datatype, '(', 1)); + v_src_datatype := PG_CATALOG.rtrim(split_part(v_src_datatype, '(', 1)); IF (v_src_datatype <> 'DATETIME2' AND v_scale IS NOT NULL) THEN RAISE invalid_indicator_parameter_value; @@ -331,7 +331,7 @@ BEGIN END IF; IF (v_datatype ~* DATATYPE_MASK_REGEXP) THEN - v_res_datatype := rtrim(split_part(v_datatype, '(', 1)); + v_res_datatype := PG_CATALOG.rtrim(split_part(v_datatype, '(', 1)); v_maxlength := CASE WHEN (v_res_datatype IN ('CHAR', 'VARCHAR')) THEN VARCHAR_MAX @@ -360,8 +360,8 @@ BEGIN ELSE sys.babelfish_conv_greg_to_hijri(p_datetimeval) + INTERVAL '1 day' END; - v_day := ltrim(to_char(v_datetimeval, 'DD'), '0'); - v_hour := ltrim(to_char(v_datetimeval, 'HH12'), '0'); + v_day := PG_CATALOG.ltrim(to_char(v_datetimeval, 'DD'), '0'); + v_hour := PG_CATALOG.ltrim(to_char(v_datetimeval, 'HH12'), '0'); v_month := to_char(v_datetimeval, 'MM')::SMALLINT; v_language := CASE @@ -522,7 +522,7 @@ EXCEPTION WHEN interval_field_overflow THEN RAISE USING MESSAGE := pg_catalog.format('The size (%s) given to the convert specification ''%s'' exceeds the maximum allowed for any data type (%s).', - v_lengthexpr, lower(v_res_datatype), v_maxlength), + v_lengthexpr, pg_catalog.lower(v_res_datatype), v_maxlength), DETAIL := 'Use of incorrect size value of data type parameter during conversion process.', HINT := 'Change size component of data type parameter to the allowable value and try again.'; @@ -539,7 +539,7 @@ EXCEPTION WHEN invalid_text_representation THEN GET STACKED DIAGNOSTICS v_err_message = MESSAGE_TEXT; - v_err_message := substring(lower(v_err_message), 'integer\:\s\"(.*)\"'); + v_err_message := substring(pg_catalog.lower(v_err_message), 'integer\:\s\"(.*)\"'); RAISE USING MESSAGE := pg_catalog.format('Error while trying to convert "%s" value to SMALLINT data type.', v_err_message), @@ -1311,12 +1311,12 @@ DECLARE FULL_DIGITMASK1_0_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^(', HHMMSSFS_PART_REGEXP, ')?\s*\d{8}\s*(', HHMMSSFS_PART_REGEXP, ')?$'); BEGIN v_datatype := trim(p_datatype); - v_datetimestring := upper(trim(p_datetimestring)); + v_datetimestring := pg_catalog.upper(trim(p_datetimestring)); v_style := floor(p_style)::SMALLINT; v_datatype_groups := regexp_matches(v_datatype, DATATYPE_REGEXP, 'gi'); - v_res_datatype := upper(v_datatype_groups[1]); + v_res_datatype := pg_catalog.upper(v_datatype_groups[1]); v_scale := v_datatype_groups[2]::SMALLINT; IF (v_res_datatype IS NULL) THEN @@ -1773,7 +1773,7 @@ EXCEPTION WHEN invalid_text_representation THEN GET STACKED DIAGNOSTICS v_err_message = MESSAGE_TEXT; - v_err_message := substring(lower(v_err_message), 'integer\:\s\"(.*)\"'); + v_err_message := substring(pg_catalog.lower(v_err_message), 'integer\:\s\"(.*)\"'); RAISE USING MESSAGE := pg_catalog.format('Error while trying to convert "%s" value to SMALLINT data type.', v_err_message), @@ -1820,12 +1820,12 @@ DECLARE DATATYPE_REGEXP CONSTANT VARCHAR COLLATE "C" := '^(TIME)\s*(?:\()?\s*((?:-)?\d+)?\s*(?:\))?$'; BEGIN v_datatype := trim(regexp_replace(p_datatype, 'DATETIME', 'TIME', 'gi')); - v_timestring := upper(trim(p_timestring)); + v_timestring := pg_catalog.upper(trim(p_timestring)); v_style := floor(p_style)::SMALLINT; v_datatype_groups := regexp_matches(v_datatype, DATATYPE_REGEXP, 'gi'); - v_src_datatype := upper(v_datatype_groups[1]); + v_src_datatype := pg_catalog.upper(v_datatype_groups[1]); v_scale := v_datatype_groups[2]::SMALLINT; IF (v_src_datatype IS NULL) THEN @@ -1924,7 +1924,7 @@ EXCEPTION WHEN invalid_text_representation THEN GET STACKED DIAGNOSTICS v_err_message = MESSAGE_TEXT; - v_err_message := substring(lower(v_err_message), 'integer\:\s\"(.*)\"'); + v_err_message := substring(pg_catalog.lower(v_err_message), 'integer\:\s\"(.*)\"'); RAISE USING MESSAGE := pg_catalog.format('Error while trying to convert "%s" value to SMALLINT data type.', v_err_message), @@ -1965,8 +1965,8 @@ DECLARE DATATYPE_MASK_REGEXP CONSTANT VARCHAR COLLATE "C" := '^\s*(?:CHAR|NCHAR|VARCHAR|NVARCHAR|CHARACTER VARYING)\s*\(\s*(\d+|MAX)\s*\)\s*$'; SRCDATATYPE_MASK_REGEXP VARCHAR COLLATE "C" := '^\s*(?:TIME)\s*(?:\s*\(\s*(\d+)\s*\)\s*)?\s*$'; BEGIN - v_datatype := upper(trim(p_datatype)); - v_src_datatype := upper(trim(p_src_datatype)); + v_datatype := pg_catalog.upper(trim(p_datatype)); + v_src_datatype := pg_catalog.upper(trim(p_src_datatype)); v_style := floor(p_style)::SMALLINT; IF (v_src_datatype ~* SRCDATATYPE_MASK_REGEXP) @@ -1982,7 +1982,7 @@ BEGIN IF (v_datatype ~* DATATYPE_MASK_REGEXP) THEN - v_res_datatype := rtrim(split_part(v_datatype, '(', 1)); + v_res_datatype := PG_CATALOG.rtrim(split_part(v_datatype, '(', 1)); v_res_maxlength := CASE WHEN (v_res_datatype IN ('CHAR', 'VARCHAR')) THEN VARCHAR_MAX @@ -2022,7 +2022,7 @@ BEGIN RAISE invalid_datetime_format; END IF; - v_hours := ltrim(to_char(p_timeval, 'HH12'), '0'); + v_hours := PG_CATALOG.ltrim(to_char(p_timeval, 'HH12'), '0'); v_fseconds := sys.babelfish_get_microsecs_from_fractsecs(to_char(p_timeval, 'US'), v_scale); IF (v_scale = 7) THEN @@ -2084,7 +2084,7 @@ EXCEPTION WHEN interval_field_overflow THEN RAISE USING MESSAGE := pg_catalog.format('The size (%s) given to the convert specification ''%s'' exceeds the maximum allowed for any data type (%s).', - v_lengthexpr, lower(v_res_datatype), v_res_maxlength), + v_lengthexpr, pg_catalog.lower(v_res_datatype), v_res_maxlength), DETAIL := 'Use of incorrect size value of target data type parameter during conversion process.', HINT := 'Change size component of data type parameter to the allowable value and try again.'; @@ -2105,7 +2105,7 @@ EXCEPTION WHEN invalid_datetime_format THEN RAISE USING MESSAGE := pg_catalog.format('Error converting data type TIME to %s.', - rtrim(split_part(trim(p_datatype), '(', 1))), + PG_CATALOG.rtrim(split_part(trim(p_datatype), '(', 1))), DETAIL := 'Incorrect using of pair of input parameters values during conversion process.', HINT := 'Check the input parameters values, correct them if needed, and try again.'; END; @@ -2261,7 +2261,7 @@ DECLARE v_lang_spec_culture VARCHAR COLLATE "C"; v_is_cached BOOLEAN := FALSE; BEGIN - v_lang_spec_culture := upper(trim(p_lang_spec_culture)); + v_lang_spec_culture := pg_catalog.upper(trim(p_lang_spec_culture)); IF (char_length(v_lang_spec_culture) > 0) THEN @@ -2275,7 +2275,7 @@ BEGIN IF (v_lang_data_jsonb IS NULL) THEN - v_lang_spec_culture := upper(regexp_replace(v_lang_spec_culture, '-\s*', '_', 'gi')); + v_lang_spec_culture := pg_catalog.upper(regexp_replace(v_lang_spec_culture, '-\s*', '_', 'gi')); IF (v_lang_spec_culture IN ('AR', 'FI') OR v_lang_spec_culture ~ '_') THEN @@ -2301,7 +2301,7 @@ BEGIN ELSE substring(v_lang_spec_culture, '(.*)(?:\.)') END; - v_lang_spec_culture := upper(regexp_replace(v_lang_spec_culture, ',\s*', '_', 'gi')); + v_lang_spec_culture := pg_catalog.upper(regexp_replace(v_lang_spec_culture, ',\s*', '_', 'gi')); BEGIN v_lang_data_jsonb := nullif(current_setting(format('sys.lang_metadata_json.%s', @@ -2427,18 +2427,18 @@ DECLARE v_monthname TEXT; v_monthnum SMALLINT; BEGIN - v_monthname := lower(trim(p_monthname)); + v_monthname := pg_catalog.lower(trim(p_monthname)); - v_monthnum := array_position(ARRAY(SELECT lower(jsonb_array_elements_text(p_lang_metadata_json -> 'months_shortnames'))), v_monthname); + v_monthnum := array_position(ARRAY(SELECT pg_catalog.lower(jsonb_array_elements_text(p_lang_metadata_json -> 'months_shortnames'))), v_monthname); v_monthnum := coalesce(v_monthnum, - array_position(ARRAY(SELECT lower(jsonb_array_elements_text(p_lang_metadata_json -> 'months_names'))), v_monthname)); + array_position(ARRAY(SELECT pg_catalog.lower(jsonb_array_elements_text(p_lang_metadata_json -> 'months_names'))), v_monthname)); v_monthnum := coalesce(v_monthnum, - array_position(ARRAY(SELECT lower(jsonb_array_elements_text(p_lang_metadata_json -> 'months_extrashortnames'))), v_monthname)); + array_position(ARRAY(SELECT pg_catalog.lower(jsonb_array_elements_text(p_lang_metadata_json -> 'months_extrashortnames'))), v_monthname)); v_monthnum := coalesce(v_monthnum, - array_position(ARRAY(SELECT lower(jsonb_array_elements_text(p_lang_metadata_json -> 'months_extranames'))), v_monthname)); + array_position(ARRAY(SELECT pg_catalog.lower(jsonb_array_elements_text(p_lang_metadata_json -> 'months_extranames'))), v_monthname)); IF (v_monthnum IS NULL) THEN RAISE datetime_field_overflow; @@ -2507,8 +2507,8 @@ DECLARE HHMM_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, '$'); HH_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', TIMEUNIT_REGEXP, '$'); BEGIN - v_timepart := upper(trim(p_timepart)); - v_timeunit := upper(trim(p_timeunit)); + v_timepart := pg_catalog.upper(trim(p_timepart)); + v_timeunit := pg_catalog.upper(trim(p_timeunit)); v_daypart := substring(v_timepart, 'AM|PM'); v_timepart := trim(regexp_replace(v_timepart, coalesce(v_daypart, ''), '')); @@ -2561,7 +2561,7 @@ EXCEPTION WHEN invalid_text_representation THEN GET STACKED DIAGNOSTICS v_err_message = MESSAGE_TEXT; - v_err_message := substring(lower(v_err_message), 'integer\:\s\"(.*)\"'); + v_err_message := substring(pg_catalog.lower(v_err_message), 'integer\:\s\"(.*)\"'); RAISE USING MESSAGE := pg_catalog.format('Error while trying to convert "%s" value to SMALLINT data type.', v_err_message), DETAIL := 'Supplied value contains illegal characters.', @@ -2598,15 +2598,15 @@ DECLARE v_weekdayname TEXT; v_weekdaynum SMALLINT; BEGIN - v_weekdayname := lower(trim(p_weekdayname)); + v_weekdayname := pg_catalog.lower(trim(p_weekdayname)); - v_weekdaynum := array_position(ARRAY(SELECT lower(jsonb_array_elements_text(p_lang_metadata_json -> 'days_names'))), v_weekdayname); + v_weekdaynum := array_position(ARRAY(SELECT pg_catalog.lower(jsonb_array_elements_text(p_lang_metadata_json -> 'days_names'))), v_weekdayname); v_weekdaynum := coalesce(v_weekdaynum, - array_position(ARRAY(SELECT lower(jsonb_array_elements_text(p_lang_metadata_json -> 'days_shortnames'))), v_weekdayname)); + array_position(ARRAY(SELECT pg_catalog.lower(jsonb_array_elements_text(p_lang_metadata_json -> 'days_shortnames'))), v_weekdayname)); v_weekdaynum := coalesce(v_weekdaynum, - array_position(ARRAY(SELECT lower(jsonb_array_elements_text(p_lang_metadata_json -> 'days_extrashortnames'))), v_weekdayname)); + array_position(ARRAY(SELECT pg_catalog.lower(jsonb_array_elements_text(p_lang_metadata_json -> 'days_extrashortnames'))), v_weekdayname)); IF (v_weekdaynum IS NULL) THEN RAISE datetime_field_overflow; @@ -2688,26 +2688,26 @@ BEGIN IF name IN('[' COLLATE "C", ']' COLLATE "C", '"' COLLATE "C") THEN RETURN NULL; - ELSIF length(name) >= 2 AND left(name, 1) = '[' COLLATE "C" AND right(name, 1) = ']' COLLATE "C" THEN + ELSIF length(name) >= 2 AND PG_CATALOG.left(name, 1) = '[' COLLATE "C" AND PG_CATALOG.right(name, 1) = ']' COLLATE "C" THEN IF length(name) = 2 THEN RETURN ''; ELSE RETURN substring(name from 2 for length(name)-2); END IF; - ELSIF length(name) >= 2 AND left(name, 1) = '[' COLLATE "C" AND right(name, 1) != ']' COLLATE "C" THEN + ELSIF length(name) >= 2 AND PG_CATALOG.left(name, 1) = '[' COLLATE "C" AND PG_CATALOG.right(name, 1) != ']' COLLATE "C" THEN RETURN NULL; - ELSIF length(name) >= 2 AND left(name, 1) != '[' COLLATE "C" AND right(name, 1) = ']' COLLATE "C" THEN + ELSIF length(name) >= 2 AND PG_CATALOG.left(name, 1) != '[' COLLATE "C" AND PG_CATALOG.right(name, 1) = ']' COLLATE "C" THEN RETURN NULL; - ELSIF length(name) >= 2 AND left(name, 1) = '"' COLLATE "C" AND right(name, 1) = '"' COLLATE "C" THEN + ELSIF length(name) >= 2 AND PG_CATALOG.left(name, 1) = '"' COLLATE "C" AND PG_CATALOG.right(name, 1) = '"' COLLATE "C" THEN IF length(name) = 2 THEN RETURN ''; ELSE RETURN substring(name from 2 for length(name)-2); END IF; - ELSIF length(name) >= 2 AND left(name, 1) = '"' COLLATE "C" AND right(name, 1) != '"' COLLATE "C" THEN + ELSIF length(name) >= 2 AND PG_CATALOG.left(name, 1) = '"' COLLATE "C" AND PG_CATALOG.right(name, 1) != '"' COLLATE "C" THEN RETURN NULL; - ELSIF length(name) >= 2 AND left(name, 1) != '"' COLLATE "C" AND right(name, 1) = '"' COLLATE "C" THEN + ELSIF length(name) >= 2 AND PG_CATALOG.left(name, 1) != '"' COLLATE "C" AND PG_CATALOG.right(name, 1) = '"' COLLATE "C" THEN RETURN NULL; END IF; @@ -3111,10 +3111,10 @@ DECLARE CONVERSION_LANG CONSTANT VARCHAR COLLATE "C" := ''; DATE_FORMAT CONSTANT VARCHAR COLLATE "C" := ''; BEGIN - v_datestring := upper(trim(p_datestring)); - v_culture := coalesce(nullif(upper(trim(p_culture)), ''), 'EN-US'); + v_datestring := pg_catalog.upper(trim(p_datestring)); + v_culture := coalesce(nullif(pg_catalog.upper(trim(p_culture)), ''), 'EN-US'); - v_dayparts := ARRAY(SELECT upper(array_to_string(regexp_matches(v_datestring, '[AP]M|ص|م', 'gi'), ''))); + v_dayparts := ARRAY(SELECT pg_catalog.upper(array_to_string(regexp_matches(v_datestring, '[AP]M|ص|م', 'gi'), ''))); IF (array_length(v_dayparts, 1) > 1) THEN RAISE invalid_datetime_format; @@ -3156,7 +3156,7 @@ BEGIN 'gi'); END IF; - v_date_format := coalesce(nullif(upper(trim(DATE_FORMAT)), ''), v_lang_metadata_json ->> 'date_format'); + v_date_format := coalesce(nullif(pg_catalog.upper(trim(DATE_FORMAT)), ''), v_lang_metadata_json ->> 'date_format'); v_compmonth_regexp := array_to_string(array_cat(array_cat(ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'months_shortnames')), @@ -3647,7 +3647,7 @@ BEGIN IF (char_length(v_timestring) > 0 AND v_timestring NOT IN ('AM', 'ص', 'PM', 'م')) THEN IF (v_culture = 'FI') THEN - v_timestring := translate(v_timestring, '.,', ': '); + v_timestring := PG_CATALOG.translate(v_timestring, '.,', ': '); IF (char_length(split_part(v_timestring, ':', 4)) > 0) THEN v_timestring := regexp_replace(v_timestring, ':(?=\s*\d+\s*:?\s*(?:[AP]M|ص|م)?\s*$)', '.'); @@ -3710,7 +3710,7 @@ EXCEPTION WHEN invalid_text_representation THEN GET STACKED DIAGNOSTICS v_err_message = MESSAGE_TEXT; - v_err_message := substring(lower(v_err_message), 'integer\:\s\"(.*)\"'); + v_err_message := substring(pg_catalog.lower(v_err_message), 'integer\:\s\"(.*)\"'); RAISE USING MESSAGE := pg_catalog.format('Error while trying to convert "%s" value to SMALLINT data type.', v_err_message), @@ -4100,12 +4100,12 @@ DECLARE DATE_FORMAT CONSTANT VARCHAR COLLATE "C" := ''; BEGIN v_datatype := trim(p_datatype); - v_datetimestring := upper(trim(p_datetimestring)); - v_culture := coalesce(nullif(upper(trim(p_culture)), ''), 'EN-US'); + v_datetimestring := pg_catalog.upper(trim(p_datetimestring)); + v_culture := coalesce(nullif(pg_catalog.upper(trim(p_culture)), ''), 'EN-US'); v_datatype_groups := regexp_matches(v_datatype, DATATYPE_REGEXP, 'gi'); - v_res_datatype := upper(v_datatype_groups[1]); + v_res_datatype := pg_catalog.upper(v_datatype_groups[1]); v_scale := v_datatype_groups[2]::SMALLINT; IF (v_res_datatype IS NULL) THEN @@ -4120,7 +4120,7 @@ BEGIN v_scale := 7; END IF; - v_dayparts := ARRAY(SELECT upper(array_to_string(regexp_matches(v_datetimestring, '[AP]M|ص|م', 'gi'), ''))); + v_dayparts := ARRAY(SELECT pg_catalog.upper(array_to_string(regexp_matches(v_datetimestring, '[AP]M|ص|م', 'gi'), ''))); IF (array_length(v_dayparts, 1) > 1) THEN RAISE invalid_datetime_format; @@ -4162,7 +4162,7 @@ BEGIN 'gi'); END IF; - v_date_format := coalesce(nullif(upper(trim(DATE_FORMAT)), ''), v_lang_metadata_json ->> 'date_format'); + v_date_format := coalesce(nullif(pg_catalog.upper(trim(DATE_FORMAT)), ''), v_lang_metadata_json ->> 'date_format'); v_compmonth_regexp := array_to_string(array_cat(array_cat(ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'months_shortnames')), @@ -4653,7 +4653,7 @@ BEGIN IF (char_length(v_timestring) > 0 AND v_timestring NOT IN ('AM', 'ص', 'PM', 'م')) THEN IF (v_culture = 'FI') THEN - v_timestring := translate(v_timestring, '.,', ': '); + v_timestring := PG_CATALOG.translate(v_timestring, '.,', ': '); IF (char_length(split_part(v_timestring, ':', 4)) > 0) THEN v_timestring := regexp_replace(v_timestring, ':(?=\s*\d+\s*:?\s*(?:[AP]M|ص|م)?\s*$)', '.'); @@ -4768,7 +4768,7 @@ EXCEPTION WHEN invalid_text_representation THEN GET STACKED DIAGNOSTICS v_err_message = MESSAGE_TEXT; - v_err_message := substring(lower(v_err_message), 'integer\:\s\"(.*)\"'); + v_err_message := substring(pg_catalog.lower(v_err_message), 'integer\:\s\"(.*)\"'); RAISE USING MESSAGE := pg_catalog.format('Error while trying to convert "%s" value to SMALLINT data type.', v_err_message), @@ -5158,12 +5158,12 @@ DECLARE DATE_FORMAT CONSTANT VARCHAR COLLATE "C" := ''; BEGIN v_datatype := trim(p_datatype); - v_srctimestring := upper(trim(p_srctimestring)); - v_culture := coalesce(nullif(upper(trim(p_culture)), ''), 'EN-US'); + v_srctimestring := pg_catalog.upper(trim(p_srctimestring)); + v_culture := coalesce(nullif(pg_catalog.upper(trim(p_culture)), ''), 'EN-US'); v_datatype_groups := regexp_matches(v_datatype, DATATYPE_REGEXP, 'gi'); - v_res_datatype := upper(v_datatype_groups[1]); + v_res_datatype := pg_catalog.upper(v_datatype_groups[1]); v_scale := v_datatype_groups[2]::SMALLINT; IF (v_res_datatype IS NULL) THEN @@ -5175,7 +5175,7 @@ BEGIN v_scale := 7; END IF; - v_dayparts := ARRAY(SELECT upper(array_to_string(regexp_matches(v_srctimestring, '[AP]M|ص|م', 'gi'), ''))); + v_dayparts := ARRAY(SELECT pg_catalog.upper(array_to_string(regexp_matches(v_srctimestring, '[AP]M|ص|م', 'gi'), ''))); IF (array_length(v_dayparts, 1) > 1) THEN RAISE invalid_datetime_format; @@ -5217,7 +5217,7 @@ BEGIN 'gi'); END IF; - v_date_format := coalesce(nullif(upper(trim(DATE_FORMAT)), ''), v_lang_metadata_json ->> 'date_format'); + v_date_format := coalesce(nullif(pg_catalog.upper(trim(DATE_FORMAT)), ''), v_lang_metadata_json ->> 'date_format'); v_compmonth_regexp := array_to_string(array_cat(array_cat(ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'months_shortnames')), @@ -5718,7 +5718,7 @@ BEGIN IF (char_length(v_timestring) > 0 AND v_timestring NOT IN ('AM', 'ص', 'PM', 'م')) THEN IF (v_culture = 'FI') THEN - v_timestring := translate(v_timestring, '.,', ': '); + v_timestring := PG_CATALOG.translate(v_timestring, '.,', ': '); IF (char_length(split_part(v_timestring, ':', 4)) > 0) THEN v_timestring := regexp_replace(v_timestring, ':(?=\s*\d+\s*:?\s*(?:[AP]M|ص|م)?\s*$)', '.'); @@ -5796,7 +5796,7 @@ EXCEPTION WHEN invalid_text_representation THEN GET STACKED DIAGNOSTICS v_err_message = MESSAGE_TEXT; - v_err_message := substring(lower(v_err_message), 'integer\:\s\"(.*)\"'); + v_err_message := substring(pg_catalog.lower(v_err_message), 'integer\:\s\"(.*)\"'); RAISE USING MESSAGE := pg_catalog.format('Error while trying to convert "%s" value to SMALLINT data type.', v_err_message), @@ -5923,14 +5923,14 @@ DECLARE var_originating_server_id INT DEFAULT 0; BEGIN /* Remove any leading/trailing spaces from parameters (except @owner_login_name) */ - SELECT UPPER(LTRIM(RTRIM(par_originating_server))) INTO par_originating_server; - SELECT LTRIM(RTRIM(par_job_name)) INTO par_job_name; - SELECT LTRIM(RTRIM(par_description)) INTO par_description; + SELECT UPPER(PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_originating_server))) INTO par_originating_server; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_job_name)) INTO par_job_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_description)) INTO par_description; SELECT '[Uncategorized (Local)]' INTO par_category_name; SELECT 0 INTO par_category_id; - SELECT LTRIM(RTRIM(par_notify_email_operator_name)) INTO par_notify_email_operator_name; - SELECT LTRIM(RTRIM(par_notify_netsend_operator_name)) INTO par_notify_netsend_operator_name; - SELECT LTRIM(RTRIM(par_notify_page_operator_name)) INTO par_notify_page_operator_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_notify_email_operator_name)) INTO par_notify_email_operator_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_notify_netsend_operator_name)) INTO par_notify_netsend_operator_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_notify_page_operator_name)) INTO par_notify_page_operator_name; SELECT NULL INTO var_originating_server_id; /* Turn [nullable] empty string parameters into NULLs */ SELECT NULL INTO par_job_id; @@ -6418,9 +6418,9 @@ DECLARE var_orig_server_id INT; BEGIN /* Remove any leading/trailing spaces from parameters */ - SELECT LTRIM(RTRIM(par_schedule_name)) - , LTRIM(RTRIM(par_owner_login_name)) - , UPPER(LTRIM(RTRIM(par_originating_server))) + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_schedule_name)) + , PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_owner_login_name)) + , UPPER(PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_originating_server))) , 0 INTO par_schedule_name , par_owner_login_name @@ -6912,7 +6912,7 @@ DECLARE var_job_owner_sid CHAR(85); BEGIN /* Remove any leading/trailing spaces from parameters */ - SELECT LTRIM(RTRIM(par_name)) INTO par_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_name)) INTO par_name; /* Check that we can uniquely identify the job */ SELECT t.par_job_name @@ -7636,25 +7636,25 @@ BEGIN /* Not updatable */ /* Remove any leading/trailing spaces from parameters (except @owner_login_name) */ SELECT - LTRIM(RTRIM(par_job_name)) + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_job_name)) INTO par_job_name; SELECT - LTRIM(RTRIM(par_new_name)) + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_new_name)) INTO par_new_name; SELECT - LTRIM(RTRIM(par_description)) + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_description)) INTO par_description; SELECT - LTRIM(RTRIM(par_category_name)) + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_category_name)) INTO par_category_name; SELECT - LTRIM(RTRIM(par_notify_email_operator_name)) + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_notify_email_operator_name)) INTO par_notify_email_operator_name; SELECT - LTRIM(RTRIM(par_notify_netsend_operator_name)) + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_notify_netsend_operator_name)) INTO par_notify_netsend_operator_name; SELECT - LTRIM(RTRIM(par_notify_page_operator_name)) + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_notify_page_operator_name)) INTO par_notify_page_operator_name /* Are we modifying an attribute which tsql agent caches? */; @@ -7890,10 +7890,10 @@ DECLARE BEGIN /* Remove any leading/trailing spaces from parameters */ SELECT - LTRIM(RTRIM(par_name)) + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_name)) INTO par_name; SELECT - LTRIM(RTRIM(par_new_name)) + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_new_name)) INTO par_new_name /* Turn [nullable] empty string parameters into NULLs */; @@ -8104,14 +8104,14 @@ DECLARE BEGIN SELECT NULL INTO var_new_proxy_id; /* Remove any leading/trailing spaces from parameters */ - SELECT LTRIM(RTRIM(par_step_name)) INTO par_step_name; - SELECT LTRIM(RTRIM(par_subsystem)) INTO par_subsystem; - SELECT LTRIM(RTRIM(par_command)) INTO par_command; - SELECT LTRIM(RTRIM(par_server)) INTO par_server; - SELECT LTRIM(RTRIM(par_database_name)) INTO par_database_name; - SELECT LTRIM(RTRIM(par_database_user_name)) INTO par_database_user_name; - SELECT LTRIM(RTRIM(par_output_file_name)) INTO par_output_file_name; - SELECT LTRIM(RTRIM(par_proxy_name)) INTO par_proxy_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_step_name)) INTO par_step_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_subsystem)) INTO par_subsystem; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_command)) INTO par_command; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_server)) INTO par_server; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_database_name)) INTO par_database_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_database_user_name)) INTO par_database_user_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_output_file_name)) INTO par_output_file_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_proxy_name)) INTO par_proxy_name; /* Make sure Dts is translated into new subsystem's name SSIS */ /* IF (@subsystem IS NOT NULL AND UPPER(@subsystem collate SQL_Latin1_General_CP1_CS_AS) = N'DTS') */ /* BEGIN */ @@ -8331,13 +8331,13 @@ DECLARE BEGIN /* Remove any leading/trailing spaces from parameters */ SELECT - LTRIM(RTRIM(par_name)) + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_name)) INTO par_name; SELECT - LTRIM(RTRIM(par_new_name)) + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_new_name)) INTO par_new_name; SELECT - LTRIM(RTRIM(par_owner_login_name)) + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_owner_login_name)) INTO par_owner_login_name /* Turn [nullable] empty string parameters into NULLs */; @@ -8535,9 +8535,9 @@ DECLARE var_valid_range VARCHAR(50); BEGIN /* Remove any leading/trailing spaces from parameters */ - SELECT LTRIM(RTRIM(par_name)) INTO par_name; - SELECT LTRIM(RTRIM(par_category_name)) INTO par_category_name; - SELECT UPPER(LTRIM(RTRIM(par_originating_server))) INTO par_originating_server; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_name)) INTO par_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_category_name)) INTO par_category_name; + SELECT UPPER(PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_originating_server))) INTO par_originating_server; IF ( EXISTS ( @@ -8615,7 +8615,7 @@ RETURNS integer AS $body$ BEGIN /* Remove any leading/trailing spaces from parameters */ - SELECT LTRIM(RTRIM(par_date_name)) INTO par_date_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_date_name)) INTO par_date_name; /* Success */ returncode := 0; @@ -8641,9 +8641,9 @@ DECLARE var_job_id_as_char VARCHAR(36); BEGIN /* Remove any leading/trailing spaces from parameters */ - SELECT LTRIM(RTRIM(par_name_of_name_parameter)) INTO par_name_of_name_parameter; - SELECT LTRIM(RTRIM(par_name_of_id_parameter)) INTO par_name_of_id_parameter; - SELECT LTRIM(RTRIM(par_job_name)) INTO par_job_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_name_of_name_parameter)) INTO par_name_of_name_parameter; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_name_of_id_parameter)) INTO par_name_of_id_parameter; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_job_name)) INTO par_job_name; IF (par_job_name = '') THEN @@ -8728,7 +8728,7 @@ DECLARE var_second INT; BEGIN /* Remove any leading/trailing spaces from parameters */ - SELECT LTRIM(RTRIM(par_time_name)) INTO par_time_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_time_name)) INTO par_time_name; IF ((par_time < 0) OR (par_time > 235959)) THEN @@ -8803,9 +8803,9 @@ DECLARE var_owner_name VARCHAR(128); BEGIN /* Remove any leading/trailing spaces from parameters */ - SELECT LTRIM(RTRIM(par_subsystem)) INTO par_subsystem; - SELECT LTRIM(RTRIM(par_server)) INTO par_server; - SELECT LTRIM(RTRIM(par_output_file_name)) INTO par_output_file_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_subsystem)) INTO par_subsystem; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_server)) INTO par_server; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_output_file_name)) INTO par_output_file_name; /* Get current maximum step id */ SELECT COALESCE(MAX(step_id), 0) @@ -8937,7 +8937,7 @@ DECLARE var_isAdmin INT; BEGIN /* Remove any leading/trailing spaces from parameters */ - SELECT LTRIM(RTRIM(par_name)) INTO par_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_name)) INTO par_name; /* Make sure that NULL input/output parameters - if NULL - are initialized to 0 */ SELECT COALESCE(par_freq_interval, 0) INTO par_freq_interval; @@ -9226,9 +9226,9 @@ DECLARE var_sch_name_count INT; BEGIN /* Remove any leading/trailing spaces from parameters */ - SELECT LTRIM(RTRIM(par_name_of_name_parameter)) INTO par_name_of_name_parameter; - SELECT LTRIM(RTRIM(par_name_of_id_parameter)) INTO par_name_of_id_parameter; - SELECT LTRIM(RTRIM(par_schedule_name)) INTO par_schedule_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_name_of_name_parameter)) INTO par_name_of_name_parameter; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_name_of_id_parameter)) INTO par_name_of_id_parameter; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_schedule_name)) INTO par_schedule_name; SELECT 0 INTO var_sch_name_count; IF (par_schedule_name = '') @@ -10122,7 +10122,7 @@ BEGIN IF (length(name) <= 2 AND (position('"' IN name) != 0 OR position(']' IN name) != 0 OR position('[' IN name) != 0)) -- invalid name THEN RETURN 0; - ELSIF left(name, 1) = '[' THEN + ELSIF PG_CATALOG.left(name, 1) = '[' THEN pos = position('].' IN name); IF pos = 0 THEN -- invalid name @@ -10130,9 +10130,9 @@ BEGIN ELSE RETURN pos + 1; END IF; - ELSIF left(name, 1) = '"' THEN + ELSIF PG_CATALOG.left(name, 1) = '"' THEN -- search from position 1 in case name starts with a double quote. - pos = position('".' IN right(name, length(name) - 1)); + pos = position('".' IN PG_CATALOG.right(name, length(name) - 1)); IF pos = 0 THEN -- invalid name RETURN 0; @@ -10160,7 +10160,7 @@ DECLARE counter int; cur_pos int; BEGIN - lower_object_name = lower(rtrim(name)); + lower_object_name = lower(PG_CATALOG.rtrim(name)); counter = 1; cur_pos = babelfish_get_name_delimiter_pos(lower_object_name); @@ -10172,7 +10172,7 @@ BEGIN RETURN; END IF; - names[counter] = babelfish_remove_delimiter_pair(rtrim(left(lower_object_name, cur_pos - 1))); + names[counter] = babelfish_remove_delimiter_pair(PG_CATALOG.rtrim(PG_CATALOG.left(lower_object_name, cur_pos - 1))); -- invalid name IF names[counter] IS NULL THEN @@ -10199,7 +10199,7 @@ BEGIN END CASE; -- Assign each name accordingly - object_name = sys.babelfish_truncate_identifier(babelfish_remove_delimiter_pair(rtrim(lower_object_name))); + object_name = sys.babelfish_truncate_identifier(babelfish_remove_delimiter_pair(PG_CATALOG.rtrim(lower_object_name))); END; $$ LANGUAGE plpgsql @@ -10360,3 +10360,17 @@ LANGUAGE C IMMUTABLE STRICT; CREATE OR REPLACE FUNCTION sys.bbf_get_context_info() RETURNS sys.VARBINARY(128) AS 'babelfishpg_tsql', 'bbf_get_context_info' LANGUAGE C STABLE; + +/* + * bbf_get_immediate_base_type_of_UDT() + * This function returns the Immediate base type for UDT. + * Returns NULL if given type is not an UDT + */ +CREATE OR REPLACE FUNCTION sys.bbf_get_immediate_base_type_of_UDT(OID) +RETURNS OID +AS 'babelfishpg_tsql', 'get_immediate_base_type_of_UDT' +LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.babelfish_split_identifier(IN identifier VARCHAR, OUT value VARCHAR) +RETURNS SETOF VARCHAR AS 'babelfishpg_tsql', 'split_identifier_internal' +LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; diff --git a/contrib/babelfishpg_tsql/sql/sys_functions.sql b/contrib/babelfishpg_tsql/sql/sys_functions.sql index 5bc97245950..02c604a5bef 100644 --- a/contrib/babelfishpg_tsql/sql/sys_functions.sql +++ b/contrib/babelfishpg_tsql/sql/sys_functions.sql @@ -792,6 +792,17 @@ RETURNS INTEGER AS 'babelfishpg_tsql', 'object_id' LANGUAGE C STABLE; +CREATE OR REPLACE FUNCTION sys.search_partition(IN func_name sys.NVARCHAR(128), IN arg anyelement, IN db_name sys.NVARCHAR(128) DEFAULT NULL) +RETURNS INTEGER AS +'babelfishpg_tsql', 'search_partition' +LANGUAGE C STABLE; + +-- Duplicate function with arg TEXT since ANYELEMNT cannot handle constant NULL and string literal (unknown type). +CREATE OR REPLACE FUNCTION sys.search_partition(IN func_name sys.NVARCHAR(128), IN arg text, IN db_name sys.NVARCHAR(128) DEFAULT NULL) +RETURNS INTEGER AS +'babelfishpg_tsql', 'search_partition' +LANGUAGE C STABLE; + CREATE OR REPLACE FUNCTION sys.parsename(object_name sys.NVARCHAR, object_piece int) RETURNS sys.NVARCHAR(128) AS 'babelfishpg_tsql', 'parsename' @@ -931,6 +942,8 @@ RETURNS INTEGER AS $BODY$ SELECT CASE +WHEN expressionToFind = '' THEN + 0 WHEN start_location <= 0 THEN strpos(expressionToSearch, expressionToFind) ELSE @@ -1151,10 +1164,10 @@ BEGIN result := (SELECT input_expr_tmz AT TIME ZONE tz_name)::TEXT; tz_diff := (SELECT result::TIMESTAMPTZ - input_expr_tmz)::TEXT; - if LEFT(tz_diff,1) <> '-' THEN + if PG_CATALOG.LEFT(tz_diff,1) <> '-' THEN tz_diff := concat('+',tz_diff); END IF; - tz_offset := left(tz_diff,6); + tz_offset := PG_CATALOG.left(tz_diff,6); input_expr_tx := concat(input_expr_tx,tz_offset); return cast(input_expr_tx as sys.datetimeoffset); ELSIF pg_typeof(input_expr) = 'sys.DATETIMEOFFSET'::regtype THEN @@ -1162,10 +1175,10 @@ BEGIN input_expr_tmz := input_expr_tx :: TIMESTAMPTZ; result := (SELECT input_expr_tmz AT TIME ZONE tz_name)::TEXT; tz_diff := (SELECT result::TIMESTAMPTZ - input_expr_tmz)::TEXT; - if LEFT(tz_diff,1) <> '-' THEN + if PG_CATALOG.LEFT(tz_diff,1) <> '-' THEN tz_diff := concat('+',tz_diff); END IF; - tz_offset := left(tz_diff,6); + tz_offset := PG_CATALOG.left(tz_diff,6); result := concat(result,tz_offset); return cast(result as sys.datetimeoffset); ELSE @@ -1431,36 +1444,63 @@ $BODY$ LANGUAGE plpgsql IMMUTABLE; --- Duplicate functions with arg TEXT since ANYELEMNT cannot handle type unknown. -CREATE OR REPLACE FUNCTION sys.stuff(expr TEXT, start INTEGER, length INTEGER, replace_expr TEXT) -RETURNS TEXT AS +-- wrapper functions for stuff -- +CREATE OR REPLACE FUNCTION sys.stuff(expr sys.VARBINARY, start INTEGER, length INTEGER, replace_expr sys.VARCHAR) +RETURNS VARBINARY +AS $BODY$ -SELECT -CASE -WHEN start <= 0 or start > length(expr) or length < 0 THEN - NULL -WHEN replace_expr is NULL THEN - overlay (expr placing '' from start for length) -ELSE - overlay (expr placing replace_expr from start for length) +BEGIN + IF start IS NULL OR expr IS NULL OR length IS NULL THEN + RETURN NULL; + END IF; + IF start <= 0 OR start > sys.len(expr) OR length < 0 THEN + RETURN NULL; + END IF; + IF replace_expr IS NULL THEN + RETURN (SELECT (overlay (expr::sys.VARCHAR placing '' from start for length))::sys.VARCHAR)::VARBINARY; + END IF; + RETURN (SELECT (overlay (expr::sys.VARCHAR placing replace_expr::sys.VARCHAR from start for length))::sys.VARCHAR)::VARBINARY; END; $BODY$ -LANGUAGE SQL; +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; -CREATE OR REPLACE FUNCTION sys.stuff(expr ANYELEMENT, start INTEGER, length INTEGER, replace_expr ANYELEMENT) -RETURNS ANYELEMENT AS +CREATE OR REPLACE FUNCTION sys.stuff(expr sys.VARCHAR, start INTEGER, length INTEGER, replace_expr sys.VARCHAR) +RETURNS sys.VARCHAR +AS $BODY$ -SELECT -CASE -WHEN start <= 0 or start > length(expr) or length < 0 THEN - NULL -WHEN replace_expr is NULL THEN - overlay (expr placing '' from start for length) -ELSE - overlay (expr placing replace_expr from start for length) +BEGIN + IF start IS NULL OR expr IS NULL OR length IS NULL THEN + RETURN NULL; + END IF; + IF start <= 0 OR start > length(expr) OR length < 0 THEN + RETURN NULL; + END IF; + IF replace_expr IS NULL THEN + RETURN (SELECT overlay (expr placing '' from start for length)); + END IF; + RETURN (SELECT overlay (expr placing replace_expr from start for length)); END; $BODY$ -LANGUAGE SQL; +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.stuff(expr sys.NVARCHAR, start INTEGER, length INTEGER, replace_expr sys.NVARCHAR) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + IF start IS NULL OR expr IS NULL OR length IS NULL THEN + RETURN NULL; + END IF; + IF start <= 0 OR start > length(expr) OR length < 0 THEN + RETURN NULL; + END IF; + IF replace_expr IS NULL THEN + RETURN (SELECT overlay (expr placing '' from start for length)); + END IF; + RETURN (SELECT overlay (expr placing replace_expr from start for length)); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; CREATE OR REPLACE FUNCTION sys.len(expr TEXT) RETURNS INTEGER AS $BODY$ @@ -1517,10 +1557,13 @@ STRICT LANGUAGE SQL IMMUTABLE; CREATE OR REPLACE FUNCTION sys.space(IN number INTEGER, OUT result SYS.VARCHAR) AS $$ --- sys.varchar has default length of 1, so we have to pass in 'number' to be the --- type modifier. BEGIN - EXECUTE pg_catalog.format(E'SELECT repeat(\' \', %s)::SYS.VARCHAR(%s)', number, number) INTO result; + IF number < 0 THEN + result := NULL; + ELSE + -- TSQL has a limitation of 8000 character spaces for space function. + result := PG_CATALOG.repeat(' ',least(number, 8000)); + END IF; END; $$ STRICT @@ -1554,6 +1597,10 @@ $$ $$ LANGUAGE SQL VOLATILE PARALLEL SAFE; +CREATE OR REPLACE FUNCTION sys.is_collated_ai(IN input_string TEXT) RETURNS BOOL +AS 'babelfishpg_tsql', 'is_collated_ai_internal' +LANGUAGE C VOLATILE PARALLEL SAFE; + create or replace function sys.PATINDEX(in pattern varchar, in expression varchar) returns bigint as $body$ declare @@ -1564,13 +1611,16 @@ begin if pattern is null or expression is null then return null; end if; - if left(pattern, 1) = '%' collate sys.database_default then + if sys.is_collated_ai(expression) then + return sys.patindex_ai_collations(pattern, expression); + end if; + if PG_CATALOG.left(pattern, 1) = '%' collate sys.database_default then v_regexp_pattern := regexp_replace(pattern, '^%', '%#"', 'i'); else v_regexp_pattern := '#"' || pattern; end if; - if right(pattern, 1) = '%' collate sys.database_default then + if PG_CATALOG.right(pattern, 1) = '%' collate sys.database_default then v_regexp_pattern := regexp_replace(v_regexp_pattern, '%$', '#"%', 'i'); else v_regexp_pattern := v_regexp_pattern || '#"'; @@ -2013,16 +2063,97 @@ CREATE AGGREGATE sys.count_big("any") parallel = safe ); -CREATE OR REPLACE FUNCTION sys.REPLICATE(string TEXT, number INTEGER) -RETURNS VARCHAR AS +-- wrapper functions for replicate +CREATE OR REPLACE FUNCTION sys.replicate(string ANYELEMENT, i INTEGER) +RETURNS sys.VARCHAR +AS $BODY$ -SELECT - CASE - WHEN number >= 0 THEN repeat(string, number) - ELSE null - END; +DECLARE + string_arg_datatype text; + string_arg_typeid oid; + string_basetype oid; +BEGIN + string_arg_typeid := pg_typeof(string)::oid; + string_arg_datatype := sys.translate_pg_type_to_tsql(string_arg_typeid); + IF string_arg_datatype IS NULL THEN + -- for User Defined Datatype, use immediate base type to check for argument datatype validation + string_basetype := sys.bbf_get_immediate_base_type_of_UDT(string_arg_typeid); + string_arg_datatype := sys.translate_pg_type_to_tsql(string_basetype); + END IF; + + -- restricting arguments with invalid datatypes for replicate function + IF string_arg_datatype IN ('image', 'sql_variant', 'xml', 'geometry', 'geography') THEN + RAISE EXCEPTION 'Argument data type % is invalid for argument 1 of replicate function.', string_arg_datatype; + END IF; + + IF i < 0 THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.repeat(string::sys.varchar, i); +END; $BODY$ -LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE; +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.replicate(string sys.NCHAR, i INTEGER) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + IF i < 0 THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.repeat(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.replicate(string sys.NVARCHAR, i INTEGER) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + IF i < 0 THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.repeat(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Adding following definition will make sure that replicate with text input +-- will use following definition instead of PG replicate +CREATE OR REPLACE FUNCTION sys.replicate(string TEXT, i INTEGER) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + IF i < 0 THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.repeat(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Adding following definition will make sure that replicate with ntext input +-- will use following definition instead of PG replicate +CREATE OR REPLACE FUNCTION sys.replicate(string NTEXT, i INTEGER) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + IF i < 0 THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.repeat(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; -- @@ functions CREATE OR REPLACE FUNCTION sys.rowcount() @@ -2739,11 +2870,11 @@ BEGIN -- Lower-case to avoid case issues, remove trailing whitespace to match SQL SERVER behavior -- Objects created in Babelfish are stored in lower-case in pg_class/pg_proc - cs_as_securable = lower(rtrim(cs_as_securable)); - cs_as_securable_class = lower(rtrim(cs_as_securable_class)); - cs_as_permission = lower(rtrim(cs_as_permission)); - cs_as_sub_securable = lower(rtrim(cs_as_sub_securable)); - cs_as_sub_securable_class = lower(rtrim(cs_as_sub_securable_class)); + cs_as_securable = lower(PG_CATALOG.rtrim(cs_as_securable)); + cs_as_securable_class = lower(PG_CATALOG.rtrim(cs_as_securable_class)); + cs_as_permission = lower(PG_CATALOG.rtrim(cs_as_permission)); + cs_as_sub_securable = lower(PG_CATALOG.rtrim(cs_as_sub_securable)); + cs_as_sub_securable_class = lower(PG_CATALOG.rtrim(cs_as_sub_securable_class)); -- Assert that sub_securable and sub_securable_class are either both NULL or both defined IF cs_as_sub_securable IS NOT NULL AND cs_as_sub_securable_class IS NULL THEN @@ -3062,152 +3193,969 @@ IS 'This function returns column or parameter information. Currently only works -- substring -- CREATE OR REPLACE FUNCTION sys.substring(string TEXT, i INTEGER, j INTEGER) RETURNS sys.VARCHAR -AS 'babelfishpg_tsql', 'tsql_varchar_substr' LANGUAGE C IMMUTABLE PARALLEL SAFE; +AS 'babelfishpg_tsql', 'tsql_varchar_substr' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.substring(string NTEXT, i INTEGER, j INTEGER) +RETURNS sys.NVARCHAR +AS 'babelfishpg_tsql', 'tsql_varchar_substr' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; CREATE OR REPLACE FUNCTION sys.substring(string sys.VARCHAR, i INTEGER, j INTEGER) RETURNS sys.VARCHAR -AS 'babelfishpg_tsql', 'tsql_varchar_substr' LANGUAGE C IMMUTABLE PARALLEL SAFE; +AS 'babelfishpg_tsql', 'tsql_varchar_substr' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; -CREATE OR REPLACE FUNCTION sys.substring(string sys.VARCHAR, i INTEGER, j INTEGER) +CREATE OR REPLACE FUNCTION sys.substring(string sys.BPCHAR, i INTEGER, j INTEGER) RETURNS sys.VARCHAR -AS 'babelfishpg_tsql', 'tsql_varchar_substr' LANGUAGE C IMMUTABLE PARALLEL SAFE; +AS 'babelfishpg_tsql', 'tsql_varchar_substr' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; CREATE OR REPLACE FUNCTION sys.substring(string sys.NVARCHAR, i INTEGER, j INTEGER) RETURNS sys.NVARCHAR -AS 'babelfishpg_tsql', 'tsql_varchar_substr' LANGUAGE C IMMUTABLE PARALLEL SAFE; +AS 'babelfishpg_tsql', 'tsql_varchar_substr' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; CREATE OR REPLACE FUNCTION sys.substring(string sys.NCHAR, i INTEGER, j INTEGER) RETURNS sys.NVARCHAR -AS 'babelfishpg_tsql', 'tsql_varchar_substr' LANGUAGE C IMMUTABLE PARALLEL SAFE; +AS 'babelfishpg_tsql', 'tsql_varchar_substr' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; --- For getting host os from PG_VERSION_STR -CREATE OR REPLACE FUNCTION sys.get_host_os() -RETURNS sys.NVARCHAR -AS 'babelfishpg_tsql', 'host_os' LANGUAGE C IMMUTABLE PARALLEL SAFE; - -CREATE OR REPLACE FUNCTION sys.tsql_stat_get_activity( - IN view_name text, - OUT procid int, - OUT client_version int, - OUT library_name VARCHAR(32), - OUT language VARCHAR(128), - OUT quoted_identifier bool, - OUT arithabort bool, - OUT ansi_null_dflt_on bool, - OUT ansi_defaults bool, - OUT ansi_warnings bool, - OUT ansi_padding bool, - OUT ansi_nulls bool, - OUT concat_null_yields_null bool, - OUT textsize int, - OUT datefirst int, - OUT lock_timeout int, - OUT transaction_isolation int2, - OUT client_pid int, - OUT row_count bigint, - OUT error int, - OUT trancount int, - OUT protocol_version int, - OUT packet_size int, - OUT encrypyt_option VARCHAR(40), - OUT database_id int2, - OUT host_name varchar(128), - OUT context_info bytea) -RETURNS SETOF RECORD -AS 'babelfishpg_tsql', 'tsql_stat_get_activity' -LANGUAGE C VOLATILE STRICT; +CREATE OR REPLACE FUNCTION sys.substring(string sys.VARBINARY, i INTEGER, j INTEGER) +RETURNS sys.VARBINARY +AS 'babelfishpg_tsql', 'tsql_varbinary_substr' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; -/* - * Table type can identified by reverse dependency between table and - * type in pg_depend. - * If a table is dependent upon it's row type with dependency type - * as DEPENDENCY_INTERNAL (i) then it's a T-SQL table type. - */ -CREATE OR REPLACE FUNCTION sys.is_table_type(object_id oid) RETURNS bool AS +CREATE OR REPLACE FUNCTION sys.substring(string ANYELEMENT, i INTEGER, j INTEGER) +RETURNS sys.VARBINARY +AS $BODY$ -SELECT - EXISTS( - SELECT 1 - FROM pg_catalog.pg_type pt - INNER JOIN pg_catalog.pg_depend dep - ON pt.typrelid = dep.objid AND pt.oid = dep.refobjid - join sys.schemas sch on pt.typnamespace = sch.schema_id - JOIN pg_catalog.pg_class pc ON pc.oid = dep.objid - WHERE pt.typtype = 'c' AND dep.deptype = 'i' AND pt.typrelid = object_id AND pc.relkind = 'r' - AND dep.classid = 'pg_catalog.pg_class'::regclass AND dep.refclassid = 'pg_catalog.pg_type'::regclass); +DECLARE + type_oid oid; + string_arg_datatype text; + string_basetype oid; +BEGIN + type_oid := pg_typeof(string); + string_arg_datatype := sys.translate_pg_type_to_tsql(type_oid); + IF string_arg_datatype IS NULL THEN + -- for User Defined Datatype, use immediate base type to check for argument datatype validation + string_basetype := sys.bbf_get_immediate_base_type_of_UDT(type_oid); + string_arg_datatype := sys.translate_pg_type_to_tsql(string_basetype); + END IF; + + -- restricting arguments with invalid datatypes for substring function + IF string_arg_datatype NOT IN ('binary', 'image') THEN + RAISE EXCEPTION 'Argument data type % is invalid for argument 1 of substring function.', string_arg_datatype; + END IF; + + RETURN sys.substring(string::sys.VARBINARY, i, j); +END; $BODY$ -LANGUAGE SQL STABLE STRICT; +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; --- JSON Functions -CREATE OR REPLACE FUNCTION sys.isjson(json_string text) -RETURNS INTEGER -AS 'babelfishpg_tsql', 'tsql_isjson' LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; +-- wrapper functions for upper -- +-- Function to handle datatypes which are implicitly convertable to VARCHAR +CREATE OR REPLACE FUNCTION sys.upper(ANYELEMENT) +RETURNS sys.VARCHAR +AS $$ +DECLARE + type_oid oid; + typ_base_oid oid; + typnam text; +BEGIN + typnam := NULL; + type_oid := pg_typeof($1); + typnam := sys.translate_pg_type_to_tsql(type_oid); + IF typnam IS NULL THEN + typ_base_oid := sys.bbf_get_immediate_base_type_of_UDT(type_oid); + typnam := sys.translate_pg_type_to_tsql(typ_base_oid); + END IF; + IF typnam IN ('image', 'sql_variant', 'xml', 'geometry', 'geography') THEN + RAISE EXCEPTION 'Argument data type % is invalid for argument 1 of upper function.', typnam; + END IF; + IF $1 IS NULL THEN + RETURN NULL; + END IF; + -- Call the underlying function after preprocessing + RETURN pg_catalog.upper($1::sys.varchar); +END; +$$ LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; -CREATE OR REPLACE FUNCTION sys.json_value(json_string text, path text) -RETURNS sys.NVARCHAR(4000) -AS 'babelfishpg_tsql', 'tsql_json_value' LANGUAGE C IMMUTABLE PARALLEL SAFE; +-- Function to handle NCHAR because of return type NVARCHAR +CREATE OR REPLACE FUNCTION sys.upper(sys.NCHAR) +RETURNS sys.NVARCHAR +AS $$ +BEGIN + RETURN pg_catalog.upper($1); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; -CREATE OR REPLACE FUNCTION sys.json_query(json_string text, path text default '$') +-- Function to handle NVARCHAR because of return type NVARCHAR +CREATE OR REPLACE FUNCTION sys.upper(sys.NVARCHAR) RETURNS sys.NVARCHAR -AS 'babelfishpg_tsql', 'tsql_json_query' LANGUAGE C IMMUTABLE PARALLEL SAFE; +AS $$ +BEGIN + RETURN pg_catalog.upper($1); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; -/* - * JSON MODIFY - * This function is used to update the value of a property in a JSON string and returns the updated JSON string. - * It has been implemented in three parts: - * 1) Set the append and create_if_missing flag as postgres functions do not directly take append and lax/strict mode in the jsonb_path. - * 2) To convert the input path into the expected jsonb_path. - * 3) To implement the main logic of the JSON_MODIFY function by dividing it into 8 different cases. - */ -CREATE OR REPLACE FUNCTION sys.json_modify(in expression sys.NVARCHAR,in path_json TEXT, in new_value ANYELEMENT, in escape bool) +-- Function to handle TEXT because of return type VARCHAR +CREATE OR REPLACE FUNCTION sys.upper(TEXT) +RETURNS sys.VARCHAR +AS $$ +BEGIN + RETURN pg_catalog.upper($1); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Function to handle NTEXT because of return type VARCHAR +CREATE OR REPLACE FUNCTION sys.upper(NTEXT) RETURNS sys.NVARCHAR -AS -$BODY$ +AS $$ +BEGIN + RETURN pg_catalog.upper($1); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- wrapper functions for lower -- +-- Function to handle datatypes which are implicitly convertable to VARCHAR +CREATE OR REPLACE FUNCTION sys.lower(ANYELEMENT) +RETURNS sys.VARCHAR +AS $$ DECLARE - json_path TEXT; - json_path_convert TEXT; - new_jsonb_path TEXT[]; - key_value_type TEXT; - path_split_array TEXT[]; - comparison_string TEXT COLLATE "C"; - len_array INTEGER; - word_count INTEGER; - create_if_missing BOOL = TRUE; - append_modifier BOOL = FALSE; - key_exists BOOL; - key_value JSONB; - json_expression JSONB = expression::JSONB; - json_new_value JSONB; - result_json sys.NVARCHAR; + type_oid oid; + typ_base_oid oid; + typnam text; BEGIN - path_split_array = regexp_split_to_array(TRIM(path_json) COLLATE "C",'\s+'); - word_count = array_length(path_split_array,1); - /* - * This if else block is added to set the create_if_missing and append_modifier flags. - * These flags will be used to know the mode and if the optional modifier append is present in the input path_json. - * It is necessary as postgres functions do not directly take append and lax/strict mode in the jsonb_path. - * Comparisons for comparison_string are case-sensitive. - */ - IF word_count = 1 THEN - json_path = path_split_array[1]; - create_if_missing = TRUE; - append_modifier = FALSE; - ELSIF word_count = 2 THEN - json_path = path_split_array[2]; - comparison_string = path_split_array[1]; -- append or lax/strict mode - IF comparison_string = 'append' THEN - append_modifier = TRUE; - ELSIF comparison_string = 'strict' THEN - create_if_missing = FALSE; - ELSIF comparison_string = 'lax' THEN - create_if_missing = TRUE; - ELSE - RAISE invalid_json_text; - END IF; - ELSIF word_count = 3 THEN - json_path = path_split_array[3]; - comparison_string = path_split_array[1]; -- append mode - IF comparison_string = 'append' THEN + typnam := NULL; + type_oid := pg_typeof($1); + typnam := sys.translate_pg_type_to_tsql(type_oid); + IF typnam IS NULL THEN + typ_base_oid := sys.bbf_get_immediate_base_type_of_UDT(type_oid); + typnam := sys.translate_pg_type_to_tsql(typ_base_oid); + END IF; + IF typnam IN ('image', 'sql_variant', 'xml', 'geometry', 'geography') THEN + RAISE EXCEPTION 'Argument data type % is invalid for argument 1 of lower function.', typnam; + END IF; + IF $1 IS NULL THEN + RETURN NULL; + END IF; + -- Call the underlying function after preprocessing + RETURN pg_catalog.lower($1::sys.varchar); +END; +$$ LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +-- Function to handle NCHAR because of return type NVARCHAR +CREATE OR REPLACE FUNCTION sys.lower(sys.NCHAR) +RETURNS sys.NVARCHAR +AS $$ +BEGIN + RETURN pg_catalog.lower($1); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Function to handle NVARCHAR because of return type NVARCHAR +CREATE OR REPLACE FUNCTION sys.lower(sys.NVARCHAR) +RETURNS sys.NVARCHAR +AS $$ +BEGIN + RETURN pg_catalog.lower($1); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Function to handle TEXT because of return type VARCHAR +CREATE OR REPLACE FUNCTION sys.lower(TEXT) +RETURNS sys.VARCHAR +AS $$ +BEGIN + RETURN pg_catalog.lower($1); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Function to handle NTEXT because of return type VARCHAR +CREATE OR REPLACE FUNCTION sys.lower(NTEXT) +RETURNS sys.NVARCHAR +AS $$ +BEGIN + RETURN pg_catalog.lower($1); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- wrapper functions for TRIM +CREATE OR REPLACE FUNCTION sys.TRIM(string sys.BPCHAR) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.btrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.TRIM(string sys.VARCHAR) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.btrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.TRIM(string sys.NCHAR) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.btrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.TRIM(string sys.NVARCHAR) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.btrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.TRIM(string ANYELEMENT) +RETURNS sys.VARCHAR +AS +$BODY$ +DECLARE + string_arg_datatype text; + string_basetype oid; +BEGIN + string_arg_datatype := sys.translate_pg_type_to_tsql(pg_typeof(string)::oid); + IF string_arg_datatype IS NULL THEN + -- for User Defined Datatype, use immediate base type to check for argument datatype validation + string_basetype := sys.bbf_get_immediate_base_type_of_UDT(pg_typeof(string)::oid); + string_arg_datatype := sys.translate_pg_type_to_tsql(string_basetype); + END IF; + + -- restricting arguments with invalid datatypes for trim function + IF string_arg_datatype NOT IN ('char', 'varchar', 'nchar', 'nvarchar', 'text', 'ntext') THEN + RAISE EXCEPTION 'Argument data type % is invalid for argument 1 of Trim function.', string_arg_datatype; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.btrim(string::sys.varchar); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +-- Additional handling is added for TRIM function with 2 arguments, +-- hence only following two definitions are required. +CREATE OR REPLACE FUNCTION sys.TRIM(characters sys.VARCHAR, string sys.NVARCHAR) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.btrim(string, characters); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.TRIM(characters sys.VARCHAR, string sys.VARCHAR) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.btrim(string, characters); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- wrapper functions for LTRIM +CREATE OR REPLACE FUNCTION sys.LTRIM(string ANYELEMENT) +RETURNS sys.VARCHAR +AS +$BODY$ +DECLARE + string_arg_datatype text; + string_basetype oid; +BEGIN + string_arg_datatype := sys.translate_pg_type_to_tsql(pg_typeof(string)::oid); + IF string_arg_datatype IS NULL THEN + -- for User Defined Datatype, use immediate base type to check for argument datatype validation + string_basetype := sys.bbf_get_immediate_base_type_of_UDT(pg_typeof(string)::oid); + string_arg_datatype := sys.translate_pg_type_to_tsql(string_basetype); + END IF; + + -- restricting arguments with invalid datatypes for ltrim function + IF string_arg_datatype IN ('image', 'sql_variant', 'xml', 'geometry', 'geography') THEN + RAISE EXCEPTION 'Argument data type % is invalid for argument 1 of ltrim function.', string_arg_datatype; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.ltrim(string::sys.varchar); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.LTRIM(string sys.BPCHAR) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.ltrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.LTRIM(string sys.VARCHAR) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.ltrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.LTRIM(string sys.NCHAR) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.ltrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.LTRIM(string sys.NVARCHAR) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.ltrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Adding following definition will make sure that ltrim with text input +-- will use following definition instead of PG ltrim +CREATE OR REPLACE FUNCTION sys.LTRIM(string TEXT) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.ltrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Adding following definition will make sure that ltrim with ntext input +-- will use following definition instead of PG ltrim +CREATE OR REPLACE FUNCTION sys.LTRIM(string NTEXT) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.ltrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- wrapper functions for RTRIM +CREATE OR REPLACE FUNCTION sys.RTRIM(string ANYELEMENT) +RETURNS sys.VARCHAR +AS +$BODY$ +DECLARE + string_arg_datatype text; + string_basetype oid; +BEGIN + string_arg_datatype := sys.translate_pg_type_to_tsql(pg_typeof(string)::oid); + IF string_arg_datatype IS NULL THEN + -- for User Defined Datatype, use immediate base type to check for argument datatype validation + string_basetype := sys.bbf_get_immediate_base_type_of_UDT(pg_typeof(string)::oid); + string_arg_datatype := sys.translate_pg_type_to_tsql(string_basetype); + END IF; + + -- restricting arguments with invalid datatypes for rtrim function + IF string_arg_datatype IN ('image', 'sql_variant', 'xml', 'geometry', 'geography') THEN + RAISE EXCEPTION 'Argument data type % is invalid for argument 1 of rtrim function.', string_arg_datatype; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.rtrim(string::sys.varchar); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.RTRIM(string sys.BPCHAR) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.rtrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.RTRIM(string sys.VARCHAR) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.rtrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.RTRIM(string sys.NCHAR) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.rtrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.RTRIM(string sys.NVARCHAR) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.rtrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Adding following definition will make sure that rtrim with text input +-- will use following definition instead of PG rtrim +CREATE OR REPLACE FUNCTION sys.RTRIM(string TEXT) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.rtrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Adding following definition will make sure that rtrim with ntext input +-- will use following definition instead of PG rtrim +CREATE OR REPLACE FUNCTION sys.RTRIM(string NTEXT) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.rtrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + + +-- wrapper functions for LEFT +CREATE OR REPLACE FUNCTION sys.LEFT(string ANYELEMENT, i INTEGER) +RETURNS sys.VARCHAR +AS +$BODY$ +DECLARE + string_arg_datatype text; + string_basetype oid; +BEGIN + string_arg_datatype := sys.translate_pg_type_to_tsql(pg_typeof(string)::oid); + IF string_arg_datatype IS NULL THEN + -- for User Defined Datatype, use immediate base type to check for argument datatype validation + string_basetype := sys.bbf_get_immediate_base_type_of_UDT(pg_typeof(string)::oid); + string_arg_datatype := sys.translate_pg_type_to_tsql(string_basetype); + END IF; + + -- restricting arguments with invalid datatypes for left function + IF string_arg_datatype IN ('image', 'sql_variant', 'xml', 'geometry', 'geography') THEN + RAISE EXCEPTION 'Argument data type % is invalid for argument 1 of left function.', string_arg_datatype; + END IF; + + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the left function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.left(string::sys.varchar, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.LEFT(string sys.BPCHAR, i INTEGER) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the left function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.left(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.LEFT(string sys.VARCHAR, i INTEGER) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the left function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.left(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.LEFT(string sys.NCHAR, i INTEGER) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the left function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.left(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.LEFT(string sys.NVARCHAR, i INTEGER) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the left function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.left(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +-- Adding following definition will make sure that left with text input +-- will use following definition instead of PG left +CREATE OR REPLACE FUNCTION sys.LEFT(string TEXT, i INTEGER) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the left function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.left(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +-- Adding following definition will make sure that left with ntext input +-- will use following definition instead of PG left +CREATE OR REPLACE FUNCTION sys.LEFT(string NTEXT, i INTEGER) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the left function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.left(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + + +-- wrapper functions for RIGHT +CREATE OR REPLACE FUNCTION sys.RIGHT(string ANYELEMENT, i INTEGER) +RETURNS sys.VARCHAR +AS +$BODY$ +DECLARE + string_arg_datatype text; + string_basetype oid; +BEGIN + string_arg_datatype := sys.translate_pg_type_to_tsql(pg_typeof(string)::oid); + IF string_arg_datatype IS NULL THEN + -- for User Defined Datatype, use immediate base type to check for argument datatype validation + string_basetype := sys.bbf_get_immediate_base_type_of_UDT(pg_typeof(string)::oid); + string_arg_datatype := sys.translate_pg_type_to_tsql(string_basetype); + END IF; + + -- restricting arguments with invalid datatypes for right function + IF string_arg_datatype IN ('image', 'sql_variant', 'xml', 'geometry', 'geography') THEN + RAISE EXCEPTION 'Argument data type % is invalid for argument 1 of right function.', string_arg_datatype; + END IF; + + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the right function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + RETURN PG_CATALOG.right(string::sys.varchar, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.RIGHT(string sys.BPCHAR, i INTEGER) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the right function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.right(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.RIGHT(string sys.VARCHAR, i INTEGER) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the right function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.right(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.RIGHT(string sys.NCHAR, i INTEGER) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the right function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.right(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.RIGHT(string sys.NVARCHAR, i INTEGER) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the right function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.right(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +-- Adding following definition will make sure that right with text input +-- will use following definition instead of PG right +CREATE OR REPLACE FUNCTION sys.RIGHT(string TEXT, i INTEGER) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the right function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.right(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +-- Adding following definition will make sure that right with ntext input +-- will use following definition instead of PG right +CREATE OR REPLACE FUNCTION sys.RIGHT(string NTEXT, i INTEGER) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the right function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.right(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +-- wrapper functions for translate -- +CREATE OR REPLACE FUNCTION sys.translate(string sys.VARCHAR, characters sys.VARCHAR, translations sys.VARCHAR) +RETURNS sys.VARCHAR +AS $$ +BEGIN + IF length(characters) != length(translations) THEN + RAISE EXCEPTION 'The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.'; + END IF; + + RETURN PG_CATALOG.TRANSLATE(string, characters, translations); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.translate(string sys.NVARCHAR, characters sys.VARCHAR, translations sys.VARCHAR) +RETURNS sys.NVARCHAR +AS $$ +BEGIN + IF length(characters) != length(translations) THEN + RAISE EXCEPTION 'The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.'; + END IF; + + RETURN PG_CATALOG.TRANSLATE(string, characters, translations); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- For getting host os from PG_VERSION_STR +CREATE OR REPLACE FUNCTION sys.get_host_os() +RETURNS sys.NVARCHAR +AS 'babelfishpg_tsql', 'host_os' LANGUAGE C IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.tsql_stat_get_activity( + IN view_name text, + OUT procid int, + OUT client_version int, + OUT library_name VARCHAR(32), + OUT language VARCHAR(128), + OUT quoted_identifier bool, + OUT arithabort bool, + OUT ansi_null_dflt_on bool, + OUT ansi_defaults bool, + OUT ansi_warnings bool, + OUT ansi_padding bool, + OUT ansi_nulls bool, + OUT concat_null_yields_null bool, + OUT textsize int, + OUT datefirst int, + OUT lock_timeout int, + OUT transaction_isolation int2, + OUT client_pid int, + OUT row_count bigint, + OUT error int, + OUT trancount int, + OUT protocol_version int, + OUT packet_size int, + OUT encrypyt_option VARCHAR(40), + OUT database_id int2, + OUT host_name varchar(128), + OUT context_info bytea) +RETURNS SETOF RECORD +AS 'babelfishpg_tsql', 'tsql_stat_get_activity' +LANGUAGE C VOLATILE STRICT; + +/* + * Table type can identified by reverse dependency between table and + * type in pg_depend. + * If a table is dependent upon it's row type with dependency type + * as DEPENDENCY_INTERNAL (i) then it's a T-SQL table type. + */ +CREATE OR REPLACE FUNCTION sys.is_table_type(object_id oid) RETURNS bool AS +$BODY$ +SELECT + EXISTS( + SELECT 1 + FROM pg_catalog.pg_type pt + INNER JOIN pg_catalog.pg_depend dep + ON pt.typrelid = dep.objid AND pt.oid = dep.refobjid + join sys.schemas sch on pt.typnamespace = sch.schema_id + JOIN pg_catalog.pg_class pc ON pc.oid = dep.objid + WHERE pt.typtype = 'c' AND dep.deptype = 'i' AND pt.typrelid = object_id AND pc.relkind = 'r' + AND dep.classid = 'pg_catalog.pg_class'::regclass AND dep.refclassid = 'pg_catalog.pg_type'::regclass); +$BODY$ +LANGUAGE SQL STABLE STRICT; + +-- JSON Functions +CREATE OR REPLACE FUNCTION sys.isjson(json_string text) +RETURNS INTEGER +AS 'babelfishpg_tsql', 'tsql_isjson' LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.json_value(json_string text, path text) +RETURNS sys.NVARCHAR(4000) +AS 'babelfishpg_tsql', 'tsql_json_value' LANGUAGE C IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.json_query(json_string text, path text default '$') +RETURNS sys.NVARCHAR +AS 'babelfishpg_tsql', 'tsql_json_query' LANGUAGE C IMMUTABLE PARALLEL SAFE; + +/* + * JSON MODIFY + * This function is used to update the value of a property in a JSON string and returns the updated JSON string. + * It has been implemented in three parts: + * 1) Set the append and create_if_missing flag as postgres functions do not directly take append and lax/strict mode in the jsonb_path. + * 2) To convert the input path into the expected jsonb_path. + * 3) To implement the main logic of the JSON_MODIFY function by dividing it into 8 different cases. + */ +CREATE OR REPLACE FUNCTION sys.json_modify(in expression sys.NVARCHAR,in path_json TEXT, in new_value ANYELEMENT, in escape bool) +RETURNS sys.NVARCHAR +AS +$BODY$ +DECLARE + json_path TEXT; + json_path_convert TEXT; + new_jsonb_path TEXT[]; + key_value_type TEXT; + path_split_array TEXT[]; + comparison_string TEXT COLLATE "C"; + len_array INTEGER; + word_count INTEGER; + create_if_missing BOOL = TRUE; + append_modifier BOOL = FALSE; + key_exists BOOL; + key_value JSONB; + json_expression JSONB = expression::JSONB; + json_new_value JSONB; + result_json sys.NVARCHAR; +BEGIN + path_split_array = regexp_split_to_array(TRIM(path_json) COLLATE "C",'\s+'); + word_count = array_length(path_split_array,1); + /* + * This if else block is added to set the create_if_missing and append_modifier flags. + * These flags will be used to know the mode and if the optional modifier append is present in the input path_json. + * It is necessary as postgres functions do not directly take append and lax/strict mode in the jsonb_path. + * Comparisons for comparison_string are case-sensitive. + */ + IF word_count = 1 THEN + json_path = path_split_array[1]; + create_if_missing = TRUE; + append_modifier = FALSE; + ELSIF word_count = 2 THEN + json_path = path_split_array[2]; + comparison_string = path_split_array[1]; -- append or lax/strict mode + IF comparison_string = 'append' THEN + append_modifier = TRUE; + ELSIF comparison_string = 'strict' THEN + create_if_missing = FALSE; + ELSIF comparison_string = 'lax' THEN + create_if_missing = TRUE; + ELSE + RAISE invalid_json_text; + END IF; + ELSIF word_count = 3 THEN + json_path = path_split_array[3]; + comparison_string = path_split_array[1]; -- append mode + IF comparison_string = 'append' THEN append_modifier = TRUE; ELSE RAISE invalid_json_text; @@ -3423,9 +4371,35 @@ LANGUAGE C STABLE PARALLEL SAFE; CREATE OR REPLACE FUNCTION sys.is_member(IN role sys.SYSNAME) RETURNS INT AS $$ - SELECT sys.is_rolemember_internal(role, NULL); +DECLARE + is_windows_grp boolean := (CHARINDEX('\', role) != 0); +BEGIN + -- Always return 1 for 'public' + IF (role = 'public') + THEN RETURN 1; + END IF; + + IF EXISTS (SELECT orig_loginname FROM sys.babelfish_authid_login_ext WHERE orig_loginname = role AND type != 'S') -- do not consider sql logins + THEN + IF ((EXISTS (SELECT name FROM sys.login_token WHERE name = role AND type IN ('SERVER ROLE', 'SQL LOGIN'))) OR is_windows_grp) -- do not consider sql logins, server roles + THEN RETURN NULL; -- Also return NULL if session is not a windows auth session but argument is a windows group + ELSIF EXISTS (SELECT name FROM sys.login_token WHERE name = role AND type NOT IN ('SERVER ROLE', 'SQL LOGIN')) + THEN RETURN 1; -- Return 1 if current session user is a member of role or windows group + ELSE RETURN 0; -- Return 0 if current session user is not a member of role or windows group + END IF; + ELSIF EXISTS (SELECT orig_username FROM sys.babelfish_authid_user_ext WHERE orig_username = role) + THEN + IF EXISTS (SELECT name FROM sys.user_token WHERE name = role) + THEN RETURN 1; -- Return 1 if current session user is a member of role or windows group + ELSIF (is_windows_grp) + THEN RETURN NULL; -- Return NULL if session is not a windows auth session but argument is a windows group + ELSE RETURN 0; -- Return 0 if current session user is not a member of role or windows group + END IF; + ELSE RETURN NULL; -- Return NULL if role/group does not exist + END IF; +END; $$ -LANGUAGE SQL STRICT STABLE PARALLEL SAFE; +LANGUAGE plpgsql STRICT STABLE; CREATE OR REPLACE FUNCTION sys.is_rolemember(IN role sys.SYSNAME) RETURNS INT AS @@ -3444,20 +4418,38 @@ $$ $$ LANGUAGE SQL STRICT STABLE PARALLEL SAFE; -CREATE OR REPLACE FUNCTION sys.replace (in input_string text, in pattern text, in replacement text) returns TEXT as -$body$ -begin - if pattern is null or replacement is null then - return null; - elsif pattern = '' then +CREATE OR REPLACE FUNCTION sys.replace (input_string sys.VARCHAR, pattern sys.VARCHAR, replacement sys.VARCHAR) +RETURNS sys.VARCHAR AS +$BODY$ +BEGIN + if PG_CATALOG.length(pattern) = 0 then return input_string; + elsif sys.is_collated_ai(input_string) then + return pg_catalog.replace(input_string, pattern, replacement); elsif sys.is_collated_ci_as(input_string) then return regexp_replace(input_string, '***=' || pattern, replacement, 'ig'); else return regexp_replace(input_string, '***=' || pattern, replacement, 'g'); end if; -end -$body$ +END +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE STRICT; + +CREATE OR REPLACE FUNCTION sys.replace (input_string sys.NVARCHAR, pattern sys.NVARCHAR, replacement sys.NVARCHAR) +RETURNS sys.NVARCHAR AS +$BODY$ +BEGIN + if PG_CATALOG.length(pattern) = 0 then + return input_string; + elsif sys.is_collated_ai(input_string) then + return pg_catalog.replace(input_string, pattern, replacement); + elsif sys.is_collated_ci_as(input_string) then + return regexp_replace(input_string, '***=' || pattern, replacement, 'ig'); + else + return regexp_replace(input_string, '***=' || pattern, replacement, 'g'); + end if; +END +$BODY$ LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE STRICT; CREATE OR REPLACE FUNCTION objectproperty( @@ -3475,7 +4467,7 @@ CREATE OR REPLACE FUNCTION OBJECTPROPERTYEX( RETURNS SYS.SQL_VARIANT AS $$ BEGIN - property := RTRIM(LOWER(COALESCE(property, ''))); + property := PG_CATALOG.RTRIM(LOWER(COALESCE(property, ''))); IF NOT EXISTS(SELECT ao.object_id FROM sys.all_objects ao WHERE object_id = id) THEN @@ -4028,7 +5020,7 @@ BEGIN -- Here, converting TIMESTAMP into datetimeoffset datatype with the same timezone as of date argument. IF date_arg_datatype = 'sys.datetimeoffset'::regtype THEN timezone = sys.babelfish_get_datetimeoffset_tzoffset(date)::INTEGER; - offset_string = right(date::PG_CATALOG.TEXT, 6); + offset_string = PG_CATALOG.right(date::PG_CATALOG.TEXT, 6); result_date = result_date + make_interval(mins => timezone); RETURN concat(result_date, ' ', offset_string)::sys.datetimeoffset; ELSE @@ -4151,8 +5143,8 @@ BEGIN input_expr_timestamp = date::timestamp; -- preserving offset_string value in the case of datetimeoffset datatype before converting it to timestamps IF date_arg_datatype = 'sys.datetimeoffset'::regtype THEN - offset_string = RIGHT(date::PG_CATALOG.TEXT, 6); - input_expr_timestamp := LEFT(date::PG_CATALOG.TEXT, -6)::timestamp; + offset_string = PG_CATALOG.RIGHT(date::PG_CATALOG.TEXT, 6); + input_expr_timestamp := PG_CATALOG.LEFT(date::PG_CATALOG.TEXT, -6)::timestamp; END IF; CASE WHEN datepart IN ('year', 'quarter', 'month', 'week', 'hour', 'minute', 'second', 'millisecond', 'microsecond') THEN @@ -4212,4 +5204,80 @@ LANGUAGE plpgsql STABLE; CREATE OR REPLACE FUNCTION sys.bbf_pivot() RETURNS setof record AS 'babelfishpg_tsql', 'bbf_pivot' -LANGUAGE C STABLE; \ No newline at end of file +LANGUAGE C STABLE; + +-- wrapper functions for reverse +CREATE OR REPLACE FUNCTION sys.reverse(string ANYELEMENT) +RETURNS sys.VARCHAR +AS +$BODY$ +DECLARE + string_arg_datatype text; + string_arg_typeid oid; + string_basetype oid; +BEGIN + string_arg_typeid := pg_typeof(string)::oid; + string_arg_datatype := sys.translate_pg_type_to_tsql(string_arg_typeid); + IF string_arg_datatype IS NULL THEN + -- for User Defined Datatype, use immediate base type to check for argument datatype validation + string_basetype := sys.bbf_get_immediate_base_type_of_UDT(string_arg_typeid); + string_arg_datatype := sys.translate_pg_type_to_tsql(string_basetype); + END IF; + + -- restricting arguments with invalid datatypes for reverse function + IF string_arg_datatype IN ('image', 'sql_variant', 'xml', 'geometry', 'geography') THEN + RAISE EXCEPTION 'Argument data type % is invalid for argument 1 of reverse function.', string_arg_datatype; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.reverse(string::sys.varchar); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.reverse(string sys.NCHAR) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.reverse(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.reverse(string sys.NVARCHAR) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.reverse(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Adding following definition will make sure that reverse with text input +-- will use following definition instead of PG reverse +CREATE OR REPLACE FUNCTION sys.reverse(string TEXT) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.reverse(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +-- Adding following definition will make sure that reverse with ntext input +-- will use following definition instead of PG reverse +CREATE OR REPLACE FUNCTION sys.reverse(string NTEXT) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.reverse(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; \ No newline at end of file diff --git a/contrib/babelfishpg_tsql/sql/sys_views.sql b/contrib/babelfishpg_tsql/sql/sys_views.sql index 4da9b50435f..072fd89274b 100644 --- a/contrib/babelfishpg_tsql/sql/sys_views.sql +++ b/contrib/babelfishpg_tsql/sql/sys_views.sql @@ -70,7 +70,8 @@ from pg_class t inner join sys.schemas sch on sch.schema_id = t.relnamespace left join tt_internal tt on t.oid = tt.typrelid where tt.typrelid is null -and t.relkind = 'r' +and (t.relkind = 'r' or t.relkind = 'p') +and t.relispartition = false and has_schema_privilege(t.relnamespace, 'USAGE') and has_table_privilege(t.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER'); GRANT SELECT ON sys.tables TO PUBLIC; @@ -359,6 +360,8 @@ BEGIN END IF; WHEN 'timestamp' THEN max_length = 8; WHEN 'vector' THEN max_length = -1; -- dummy as varchar max + WHEN 'halfvec' THEN max_length = -1; -- dummy as varchar max + WHEN 'sparsevec' THEN max_length = -1; -- dummy as varchar max ELSE max_length = typelen; END CASE; RETURN max_length; @@ -450,6 +453,7 @@ where not a.attisdropped and (s.nspname = 'sys' or ext.nspname is not null) -- r = ordinary table, i = index, S = sequence, t = TOAST table, v = view, m = materialized view, c = composite type, f = foreign table, p = partitioned table and c.relkind in ('r', 'v', 'm', 'f', 'p') +and c.relispartition = false and has_schema_privilege(s.oid, 'USAGE') and has_column_privilege(quote_ident(s.nspname) ||'.'||quote_ident(c.relname), a.attname, 'SELECT,INSERT,UPDATE,REFERENCES') and a.attnum > 0; @@ -574,6 +578,7 @@ BEGIN AND a.attnum > 0 -- r = ordinary table, i = index, S = sequence, t = TOAST table, v = view, m = materialized view, c = composite type, f = foreign table, p = partitioned table AND c.relkind IN ('r', 'v', 'm', 'f', 'p') + AND c.relispartition = false AND has_schema_privilege(sch.schema_id, 'USAGE') AND has_column_privilege(a.attrelid, a.attname, 'SELECT,INSERT,UPDATE,REFERENCES') union all @@ -838,7 +843,7 @@ select , cast(case when X.indisclustered then 1 else 2 end as sys.tinyint) as type , cast(case when X.indisclustered then 'CLUSTERED' else 'NONCLUSTERED' end as sys.nvarchar(60)) as type_desc , cast(case when X.indisunique then 1 else 0 end as sys.bit) as is_unique - , cast(I.reltablespace as int) as data_space_id + , cast(case when ps.scheme_id is null then 1 else ps.scheme_id end as int) as data_space_id , cast(0 as sys.bit) as ignore_dup_key , cast(case when X.indisprimary then 1 else 0 end as sys.bit) as is_primary_key , cast(case when const.oid is null then 0 else 1 end as sys.bit) as is_unique_constraint @@ -854,9 +859,14 @@ select , cast(imap.index_id as int) as index_id from pg_index X inner join index_id_map imap on imap.indexrelid = X.indexrelid -inner join pg_class I on I.oid = X.indexrelid and I.relkind = 'i' +inner join pg_class I on I.oid = X.indexrelid +inner join pg_class ptbl on ptbl.oid = X.indrelid and ptbl.relispartition = false inner join pg_namespace nsp on nsp.oid = I.relnamespace left join sys.babelfish_namespace_ext ext on (nsp.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.babelfish_partition_depend pd on + (ext.orig_name = pd.schema_name COLLATE sys.database_default + and CAST(ptbl.relname AS sys.nvarchar(128)) = pd.table_name COLLATE sys.database_default and pd.dbid = sys.db_id() and ptbl.relkind = 'p') +left join sys.babelfish_partition_scheme ps on (ps.partition_scheme_name = pd.partition_scheme_name and ps.dbid = sys.db_id()) -- check if index is a unique constraint left join pg_constraint const on const.conindid = I.oid and const.contype = 'u' where has_schema_privilege(I.relnamespace, 'USAGE') @@ -873,7 +883,7 @@ select , cast(0 as sys.tinyint) as type , cast('HEAP' as sys.nvarchar(60)) as type_desc , cast(0 as sys.bit) as is_unique - , cast(1 as int) as data_space_id + , cast(case when ps.scheme_id is null then 1 else ps.scheme_id end as int) as data_space_id , cast(0 as sys.bit) as ignore_dup_key , cast(0 as sys.bit) as is_primary_key , cast(0 as sys.bit) as is_unique_constraint @@ -890,7 +900,12 @@ select from pg_class t inner join pg_namespace nsp on nsp.oid = t.relnamespace left join sys.babelfish_namespace_ext ext on (nsp.nspname = ext.nspname and ext.dbid = sys.db_id()) -where t.relkind = 'r' +left join sys.babelfish_partition_depend pd on + (ext.orig_name = pd.schema_name COLLATE sys.database_default + and CAST(t.relname AS sys.nvarchar(128)) = pd.table_name COLLATE sys.database_default and pd.dbid = sys.db_id()) +left join sys.babelfish_partition_scheme ps on (ps.partition_scheme_name = pd.partition_scheme_name and ps.dbid = sys.db_id()) +where (t.relkind = 'r' or t.relkind = 'p') +and t.relispartition = false -- filter to get all the objects that belong to sys or babelfish schemas and (nsp.nspname = 'sys' or ext.nspname is not null) and has_schema_privilege(t.relnamespace, 'USAGE') @@ -1339,7 +1354,8 @@ left join sys.table_types_internal tt on t.oid = tt.typrelid left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) left join sys.shipped_objects_not_in_sys nis on nis.name = t.relname and nis.schemaid = s.oid and nis.type = 'U' where t.relpersistence in ('p', 'u', 't') -and t.relkind = 'r' +and (t.relkind = 'r' or t.relkind = 'p') +and t.relispartition = false and s.nspname <> 'sys' and nis.name is null and ext.nspname is not null and tt.typrelid is null @@ -1441,7 +1457,9 @@ union all -- details of system defined procedures select p.proname::sys.sysname as name - , p.oid as object_id + , case + when t.typname = 'trigger' then tr.oid else p.oid + end as object_id , null::integer as principal_id , s.oid as schema_id , cast (case when tr.tgrelid is not null @@ -1516,7 +1534,9 @@ union all -- details of user defined procedures select p.proname::sys.sysname as name - , p.oid as object_id + , case + when t.typname = 'trigger' then tr.oid else p.oid + end as object_id , null::integer as principal_id , s.oid as schema_id , cast (case when tr.tgrelid is not null @@ -1735,7 +1755,7 @@ CREATE OR REPLACE VIEW sys.triggers AS SELECT CAST(p.proname as sys.sysname) as name, - CAST(p.oid as int) as object_id, + CAST(tr.oid as int) as object_id, CAST(1 as sys.tinyint) as parent_class, CAST('OBJECT_OR_COLUMN' as sys.nvarchar(60)) AS parent_class_desc, CAST(tr.tgrelid as int) AS parent_id, @@ -1845,7 +1865,7 @@ select CAST(tr.name as sys.sysname) as name , CAST(tr.object_id as int) as object_id , CAST(NULL as int) as principal_id - , CAST(p.pronamespace as int) as schema_id + , CAST(p.relnamespace as int) as schema_id , CAST(tr.parent_id as int) as parent_object_id , CAST(tr.type as char(2)) as type , CAST(tr.type_desc as sys.nvarchar(60)) as type_desc @@ -1855,7 +1875,7 @@ select , CAST(0 as sys.bit) as is_published , CAST(0 as sys.bit) as is_schema_published from sys.triggers tr - inner join pg_proc p on p.oid = tr.object_id + inner join pg_class p on p.oid = tr.parent_id union all select CAST(def.name as sys.sysname) as name @@ -1972,7 +1992,7 @@ CREATE OR REPLACE VIEW sys.all_sql_modules_internal AS SELECT ao.object_id AS object_id , CAST( - CASE WHEN ao.type in ('P', 'FN', 'IN', 'TF', 'RF', 'IF', 'TR') THEN COALESCE(f.definition, '') + CASE WHEN ao.type in ('P', 'FN', 'IN', 'TF', 'RF', 'IF') THEN COALESCE(f.definition, '') WHEN ao.type = 'V' THEN COALESCE(bvd.definition, '') ELSE NULL END @@ -2005,7 +2025,26 @@ LEFT OUTER JOIN sys.babelfish_view_def bvd LEFT JOIN pg_proc p ON ao.object_id = CAST(p.oid AS INT) LEFT JOIN sys.babelfish_function_ext f ON ao.name = f.funcname COLLATE "C" AND ao.schema_id::regnamespace::name = f.nspname AND sys.babelfish_get_pltsql_function_signature(ao.object_id) = f.funcsignature COLLATE "C" -WHERE ao.type in ('P', 'RF', 'V', 'TR', 'FN', 'IF', 'TF', 'R'); +WHERE ao.type in ('P', 'RF', 'V', 'FN', 'IF', 'TF', 'R') +UNION ALL +SELECT + ao.object_id AS object_id + , CAST(COALESCE(f.definition, '') AS sys.nvarchar) AS definition + , CAST(1 as sys.bit) AS uses_ansi_nulls + , CAST(1 as sys.bit) AS uses_quoted_identifier + , CAST(0 as sys.bit) AS is_schema_bound + , CAST(0 as sys.bit) AS uses_database_collation + , CAST(0 as sys.bit) AS is_recompiled + , CAST(0 AS sys.bit) as null_on_null_input + , null::integer as execute_as_principal_id + , CAST(0 as sys.bit) as uses_native_compilation + , CAST(ao.is_ms_shipped as INT) as is_ms_shipped +FROM sys.all_objects ao +LEFT OUTER JOIN sys.pg_namespace_ext nmext on ao.schema_id = nmext.oid +LEFT JOIN pg_trigger tr ON ao.object_id = CAST(tr.oid AS INT) +LEFT JOIN sys.babelfish_function_ext f ON ao.name = f.funcname COLLATE "C" AND ao.schema_id::regnamespace::name = f.nspname +AND sys.babelfish_get_pltsql_function_signature(tr.tgfoid) = f.funcsignature COLLATE "C" +WHERE ao.type = 'TR'; GRANT SELECT ON sys.all_sql_modules_internal TO PUBLIC; CREATE OR REPLACE VIEW sys.all_sql_modules AS @@ -2161,7 +2200,7 @@ SELECT FROM pg_index i INNER JOIN index_id_map imap ON imap.indexrelid = i.indexrelid - INNER JOIN pg_class c ON i.indrelid = c.oid + INNER JOIN pg_class c ON i.indrelid = c.oid and c.relispartition = false INNER JOIN pg_namespace nsp ON nsp.oid = c.relnamespace LEFT JOIN sys.babelfish_namespace_ext ext ON (nsp.nspname = ext.nspname AND ext.dbid = sys.db_id()) LEFT JOIN unnest(i.indkey) WITH ORDINALITY AS a(attnum, index_column_id) ON true @@ -2169,7 +2208,52 @@ WHERE has_schema_privilege(c.relnamespace, 'USAGE') AND has_table_privilege(c.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') AND (nsp.nspname = 'sys' OR ext.nspname is not null) AND - i.indislive; + i.indislive +UNION ALL +-- entries for index of partitioned table +SELECT + CAST(i.indrelid AS INT) AS object_id, + -- should match index_id of sys.indexes + CAST(imap.index_id AS INT) AS index_id, + CAST(ARRAY_LENGTH(i.indkey, 1) + 1 AS INT) AS index_column_id, + CAST(a.attnum AS INT) AS column_id, + CAST(0 AS SYS.TINYINT) AS key_ordinal, + CAST(a.ordinal_position AS SYS.TINYINT) AS partition_ordinal, + CAST(0 AS SYS.BIT) AS is_descending_key, + CAST(0 AS SYS.BIT) AS is_included_column +FROM + pg_index i + INNER JOIN index_id_map imap ON imap.indexrelid = i.indexrelid + INNER JOIN pg_class tbl on tbl.oid = i.indrelid and tbl.relkind = 'p' + INNER JOIN pg_namespace nsp on tbl.relnamespace = nsp.oid + INNER JOIN sys.babelfish_namespace_ext ext on (nsp.nspname = ext.nspname and ext.dbid = sys.db_id()) + INNER JOIN pg_partitioned_table ppt ON ppt.partrelid = tbl.oid + LEFT JOIN unnest(ppt.partattrs) WITH ORDINALITY AS a(attnum, ordinal_position) ON true +WHERE + has_schema_privilege(tbl.relnamespace, 'USAGE') AND + has_table_privilege(tbl.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') AND + i.indislive +UNION ALL +-- Heap entries for partitioned table +SELECT + CAST(t.oid as int) as object_id, + CAST(0 AS INT) AS index_id, + CAST(a.ordinal_position AS INT) AS index_column_id, + CAST(a.attnum AS INT) AS column_id, + CAST(0 AS SYS.TINYINT) AS key_ordinal, + CAST(a.ordinal_position AS SYS.TINYINT) AS partition_ordinal, + CAST(0 AS SYS.BIT) AS is_descending_key, + CAST(0 AS SYS.BIT) AS is_included_column +FROM + pg_class t + INNER JOIN pg_namespace nsp on t.relnamespace = nsp.oid + INNER JOIN sys.babelfish_namespace_ext ext on (nsp.nspname = ext.nspname and ext.dbid = sys.db_id()) + INNER JOIN pg_partitioned_table ppt ON ppt.partrelid = t.oid + LEFT JOIN unnest(ppt.partattrs) WITH ORDINALITY AS a(attnum, ordinal_position) ON true +WHERE + t.relkind = 'p' + AND has_schema_privilege(t.relnamespace, 'USAGE') + AND has_table_privilege(t.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER'); GRANT SELECT ON sys.index_columns TO PUBLIC; -- internal function that returns relevant info needed @@ -2478,15 +2562,106 @@ SELECT WHERE FALSE; GRANT SELECT ON sys.dm_hadr_database_replica_states TO PUBLIC; +CREATE OR REPLACE VIEW sys.partition_functions AS +SELECT + partition_function_name as name, + function_id, + CAST('R' as sys.bpchar(2)) as type, + CAST('RANGE' as sys.nvarchar(60)) as type_desc, + CAST(ARRAY_LENGTH(range_values, 1)+1 as int) fanout, + CAST(partition_option as sys.bit) as boundary_value_on_right, + CAST(0 as sys.bit) as is_system, + create_date, + modify_date +FROM + sys.babelfish_partition_function +WHERE + dbid = sys.db_id(); +GRANT SELECT ON sys.partition_functions TO PUBLIC; + +CREATE OR REPLACE VIEW sys.partition_range_values AS +SELECT + function_id, + CAST(1 as int) as parameter_id, + CAST(t.boundary_id as int), + t.value +FROM + sys.babelfish_partition_function, + unnest(range_values) WITH ORDINALITY as t(value, boundary_id) +where + dbid = sys.db_id(); +GRANT SELECT ON sys.partition_range_values TO PUBLIC; + +CREATE OR REPLACE VIEW sys.partition_parameters AS +SELECT + function_id, + cast(1 as int) as parameter_id, + st.system_type_id, + st.max_length, + st.precision, + st.scale, + st.collation_name, + st.user_type_id +FROM + sys.babelfish_partition_function pf +INNER JOIN + sys.types st on (pf.input_parameter_type = st.name and st.user_type_id = st.system_type_id) +WHERE + dbid = sys.db_id(); +GRANT SELECT ON sys.partition_parameters TO PUBLIC; + +CREATE OR REPLACE VIEW sys.partition_schemes AS +SELECT + partition_scheme_name as name, + scheme_id as data_space_id, + CAST('PS' as sys.bpchar(2)) as type, + CAST('PARTITION_SCHEME' as sys.nvarchar(60)) as type_desc, + CAST(0 as sys.bit) as is_default, + CAST(0 as sys.bit) as is_system, + pf.function_id +FROM + sys.babelfish_partition_scheme ps +INNER JOIN + sys.babelfish_partition_function pf ON (pf.partition_function_name = ps.partition_function_name and ps.dbid = pf.dbid) +WHERE + ps.dbid = sys.db_id(); +GRANT SELECT ON sys.partition_schemes TO PUBLIC; + +CREATE OR REPLACE VIEW sys.destination_data_spaces as +SELECT + ps.scheme_id as partition_scheme_id, + cast(s.n as int) as destination_id, + cast(1 as int) as data_space_id -- primary filegroup +FROM + sys.babelfish_partition_scheme ps +INNER JOIN + sys.partition_functions pf ON pf.name = ps.partition_function_name +CROSS JOIN + generate_series(1, pf.fanout + cast(ps.next_used as int)) s(n) +WHERE + ps.dbid = sys.db_id(); +GRANT SELECT ON sys.destination_data_spaces TO PUBLIC; + CREATE OR REPLACE VIEW sys.data_spaces AS +-- entry for [PRIMARY] filegroup SELECT - CAST('PRIMARY' as SYSNAME) AS name, + CAST('PRIMARY' as sys.NVARCHAR(128)) AS name, CAST(1 as INT) AS data_space_id, CAST('FG' as sys.bpchar(2)) AS type, - CAST('ROWS_FILEGROUP' as NVARCHAR(60)) AS type_desc, + CAST('ROWS_FILEGROUP' as sys.NVARCHAR(60)) AS type_desc, CAST(1 as sys.BIT) AS is_default, - CAST(0 as sys.BIT) AS is_system; + CAST(0 as sys.BIT) AS is_system +UNION ALL +-- entries for Partition Schemes +SELECT + name, + data_space_id, + type, + type_desc, + is_default, + is_system +FROM sys.partition_schemes; GRANT SELECT ON sys.data_spaces TO PUBLIC; CREATE OR REPLACE VIEW sys.database_mirroring @@ -2772,7 +2947,7 @@ GRANT SELECT ON sys.registered_search_property_lists TO PUBLIC; CREATE OR REPLACE VIEW sys.filegroups AS SELECT - CAST(ds.name AS sys.SYSNAME), + CAST(ds.name AS sys.NVARCHAR(128)), CAST(ds.data_space_id AS INT), CAST(ds.type AS sys.BPCHAR(2)) COLLATE sys.database_default, CAST(ds.type_desc AS sys.NVARCHAR(60)), @@ -3113,7 +3288,7 @@ GRANT SELECT ON sys.numbered_procedures TO PUBLIC; CREATE OR REPLACE VIEW sys.events AS SELECT - CAST(pt.tgfoid as int) AS object_id + CAST(pt.oid as int) AS object_id , CAST( CASE WHEN tr.event_manipulation='INSERT' THEN 1 @@ -3149,19 +3324,110 @@ FROM sys.events e WHERE e.is_trigger_event = 1; GRANT SELECT ON sys.trigger_events TO PUBLIC; +-- Note that: sys.partitions also list the entries for non-partitioned +-- tables/indexes apart from partitioned tables/indexes CREATE OR REPLACE VIEW sys.partitions AS +with index_id_map as MATERIALIZED( + select + *, + case + when indisclustered then 1 + else 1+row_number() over(partition by indrelid order by indexrelid) + end as index_id + from pg_index +), +tt_internal as MATERIALIZED +( + select * from sys.table_types_internal +) +-- entries for non-partitioned tables +SELECT + CAST(t.oid as sys.BIGINT) as partition_id, + CAST(t.oid as int) as object_id, + CAST(0 as int) as index_id, + CAST(1 as int) as partition_number, + CAST(0 as sys.bigint) AS hobt_id, + CAST(case when t.reltuples = -1 then 0 else t.reltuples end as sys.bigint) AS rows, + CAST(0 as smallint) as filestream_filegroup_id, + CAST(0 as sys.tinyint) as data_compression, + CAST('NONE' as sys.nvarchar(60)) as data_compression_desc, + CAST(0 as sys.bit) as xml_compression, + CAST('OFF' as sys.varchar(3)) as xml_compression_desc +FROM pg_class t +INNER JOIN pg_namespace nsp on t.relnamespace = nsp.oid +INNER JOIN sys.babelfish_namespace_ext ext on (nsp.nspname = ext.nspname and ext.dbid = sys.db_id()) +LEFT JOIN tt_internal tt on t.oid = tt.typrelid +WHERE tt.typrelid is null +AND t.relkind = 'r' +AND t.relispartition = false +AND has_schema_privilege(t.relnamespace, 'USAGE') +AND has_table_privilege(t.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') + +UNION ALL +-- entries for non-partitioned indexes +SELECT + CAST(idx.indexrelid as sys.BIGINT) as partition_id, + CAST(idx.indrelid as int) as object_id, + CAST(imap.index_id as int) as index_id, + CAST(1 as int) as partition_number, + CAST(0 as sys.bigint) AS hobt_id, + CAST(case when t.reltuples = -1 then 0 else t.reltuples end as sys.bigint) AS rows, + CAST(0 as smallint) as filestream_filegroup_id, + CAST(0 as sys.tinyint) as data_compression, + CAST('NONE' as sys.nvarchar(60)) as data_compression_desc, + CAST(0 as sys.bit) as xml_compression, + CAST('OFF' as sys.varchar(3)) as xml_compression_desc +FROM pg_index idx +INNER JOIN index_id_map imap on imap.indexrelid = idx.indexrelid +INNER JOIN pg_class t on t.oid = idx.indrelid and t.relkind = 'r' and t.relispartition = false +INNER JOIN pg_namespace nsp on t.relnamespace = nsp.oid +INNER JOIN sys.babelfish_namespace_ext ext on (nsp.nspname = ext.nspname and ext.dbid = sys.db_id()) +where idx.indislive +and has_schema_privilege(t.relnamespace, 'USAGE') + +UNION ALL +-- entries for partitions of partitioned tables SELECT - (to_char( i.object_id, 'FM9999999999' ) || to_char( i.index_id, 'FM9999999999' ) || '1')::bigint AS partition_id - , i.object_id - , i.index_id - , 1::integer AS partition_number - , 0::bigint AS hobt_id - , c.reltuples::bigint AS "rows" - , 0::smallint AS filestream_filegroup_id - , 0::sys.tinyint AS data_compression - , 'NONE'::sys.nvarchar(60) AS data_compression_desc -FROM sys.indexes AS i -INNER JOIN pg_catalog.pg_class AS c ON i.object_id = c."oid"; + CAST(pgi.inhrelid as sys.BIGINT) as partition_id, + CAST(pgi.inhparent as int) as object_id, + CAST(0 as int) as index_id, + CAST(row_number() over(partition by pgi.inhparent order by ctbl.relname) as int) as partition_number, + CAST(0 as sys.bigint) AS hobt_id, + CAST(case when ctbl.reltuples = -1 then 0 else ctbl.reltuples end as sys.bigint) AS rows, + CAST(0 as smallint) as filestream_filegroup_id, + CAST(0 as sys.tinyint) as data_compression, + CAST('NONE' as sys.nvarchar(60)) as data_compression_desc, + CAST(0 as sys.bit) as xml_compression, + CAST('OFF' as sys.varchar(3)) as xml_compression_desc +FROM pg_inherits pgi +INNER JOIN pg_class ctbl on (ctbl.oid = pgi.inhrelid and ctbl.relkind = 'r' and ctbl.relispartition) +INNER JOIN pg_namespace nsp on ctbl.relnamespace = nsp.oid +INNER JOIN sys.babelfish_namespace_ext ext on (nsp.nspname = ext.nspname and ext.dbid = sys.db_id()) +WHERE has_schema_privilege(ctbl.relnamespace, 'USAGE') +AND has_table_privilege(ctbl.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') + +UNION ALL +-- entries for partitions of partitioned indexes +SELECT + CAST(pgi.inhrelid as sys.BIGINT) as partition_id, + CAST(pidx.indrelid as int) as object_id, + CAST(cidx.index_id as int) as index_id, + CAST(row_number() over(partition by pgi.inhparent order by ctbl.relname) as int) as partition_number, + CAST(0 as sys.bigint) AS hobt_id, + CAST(case when ctbl.reltuples = -1 then 0 else ctbl.reltuples end as sys.bigint) AS rows, + CAST(0 as smallint) as filestream_filegroup_id, + CAST(0 as sys.tinyint) as data_compression, + CAST('NONE' as sys.nvarchar(60)) as data_compression_desc, + CAST(0 as sys.bit) as xml_compression, + CAST('OFF' as sys.varchar(3)) as xml_compression_desc +FROM pg_inherits pgi +INNER JOIN index_id_map cidx on cidx.indexrelid = pgi.inhrelid +INNER JOIN index_id_map pidx on pidx.indexrelid = pgi.inhparent +INNER JOIN pg_class ctbl on (ctbl.oid = cidx.indrelid and ctbl.relkind = 'r' and ctbl.relispartition) +INNER JOIN pg_namespace nsp on ctbl.relnamespace = nsp.oid +INNER JOIN sys.babelfish_namespace_ext ext on (nsp.nspname = ext.nspname and ext.dbid = sys.db_id()) +WHERE cidx.indislive +AND has_schema_privilege(ctbl.relnamespace, 'USAGE'); GRANT SELECT ON sys.partitions TO PUBLIC; CREATE OR REPLACE VIEW sys.servers @@ -3313,4 +3579,25 @@ AS SELECT , CAST(0 as sys.BIGINT) AS sequence_number , CAST(0 as sys.BIT) AS is_contained WHERE FALSE; -GRANT SELECT ON sys.availability_groups TO PUBLIC; \ No newline at end of file +GRANT SELECT ON sys.availability_groups TO PUBLIC; + +CREATE OR REPLACE VIEW sys.sequences +AS SELECT + so.*, + CAST(0 as sys.sql_variant) AS start_value + , CAST(0 as sys.sql_variant) AS increment + , CAST(0 as sys.sql_variant) AS minimum_value + , CAST(0 as sys.sql_variant) AS maximum_value + , CAST(0 as sys.BIT) AS is_cycling + , CAST(0 as sys.BIT) AS is_cached + , CAST(0 as INT) AS cache_size + , CAST(0 as INT) AS system_type_id + , CAST(0 as INT) AS user_type_id + , CAST(0 as sys.TINYINT) AS precision + , CAST(0 as sys.TINYINT) AS scale + , CAST(0 as sys.sql_variant) AS current_value + , CAST(0 as sys.BIT) AS is_exhausted + , CAST(0 as sys.sql_variant) AS last_used_value +FROM sys.objects so +WHERE FALSE; +GRANT SELECT ON sys.sequences TO PUBLIC; diff --git a/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--2.11.0--3.0.0.sql b/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--2.11.0--3.0.0.sql new file mode 100644 index 00000000000..6720bc86746 --- /dev/null +++ b/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--2.11.0--3.0.0.sql @@ -0,0 +1,103 @@ +-- complain if script is sourced in psql, rather than via ALTER EXTENSION +\echo Use "ALTER EXTENSION ""babelfishpg_tsql"" UPDATE TO '3.0.0'" to load this file. \quit + +-- add 'sys' to search path for the convenience +SELECT set_config('search_path', 'sys, '||current_setting('search_path'), false); + +-- please add your SQL here + +CREATE OR REPLACE FUNCTION sys.babelfish_update_server_collation_name() RETURNS VOID +LANGUAGE C +AS 'babelfishpg_common', 'babelfish_update_server_collation_name'; + +SELECT sys.babelfish_update_server_collation_name(); + +DROP FUNCTION sys.babelfish_update_server_collation_name(); + +-- reset babelfishpg_tsql.restored_server_collation_name GUC +do +language plpgsql +$$ + declare + query text; + begin + query := pg_catalog.format('alter database %s reset babelfishpg_tsql.restored_server_collation_name', CURRENT_DATABASE()); + execute query; + end; +$$; + +CREATE OR REPLACE FUNCTION sys.datepart_internal(IN datepart PG_CATALOG.TEXT, IN arg anyelement,IN df_tz INTEGER DEFAULT 0) RETURNS INTEGER AS $$ +DECLARE + result INTEGER; + first_day DATE; + first_week_end INTEGER; + day INTEGER; +BEGIN + CASE datepart + WHEN 'dow' THEN + result = (date_part(datepart, arg)::INTEGER - current_setting('babelfishpg_tsql.datefirst')::INTEGER + 7) % 7 + 1; + WHEN 'tsql_week' THEN + first_day = make_date(date_part('year', arg)::INTEGER, 1, 1); + first_week_end = 8 - sys.datepart_internal('dow', first_day)::INTEGER; + day = date_part('doy', arg)::INTEGER; + IF day <= first_week_end THEN + result = 1; + ELSE + result = 2 + (day - first_week_end - 1) / 7; + END IF; + WHEN 'second' THEN + result = TRUNC(date_part(datepart, arg))::INTEGER; + WHEN 'millisecond' THEN + result = right(date_part(datepart, arg)::TEXT, 3)::INTEGER; + WHEN 'microsecond' THEN + result = right(date_part(datepart, arg)::TEXT, 6)::INTEGER; + WHEN 'nanosecond' THEN + -- Best we can do - Postgres does not support nanosecond precision + result = right(date_part('microsecond', arg)::TEXT, 6)::INTEGER * 1000; + WHEN 'tzoffset' THEN + -- timezone for datetimeoffset + result = df_tz; + ELSE + result = date_part(datepart, arg)::INTEGER; + END CASE; + RETURN result; +EXCEPTION WHEN invalid_parameter_value or feature_not_supported THEN + -- date_part() throws an exception when trying to get day/month/year etc. from + -- TIME, so we just need to catch the exception in this case + -- date_part() returns 0 when trying to get hour/minute/second etc. from + -- DATE, which is the desirable behavior for datepart() as well. + -- If the date argument data type does not have the specified datepart, + -- date_part() will return the default value for that datepart. + CASE datepart + -- Case for datepart is year, yy and yyyy, all mappings are defined in gram.y. + WHEN 'year' THEN RETURN 1900; + -- Case for datepart is quater, qq and q + WHEN 'quarter' THEN RETURN 1; + -- Case for datepart is month, mm and m + WHEN 'month' THEN RETURN 1; + -- Case for datepart is day, dd and d + WHEN 'day' THEN RETURN 1; + -- Case for datepart is dayofyear, dy + WHEN 'doy' THEN RETURN 1; + -- Case for datepart is y(also refers to dayofyear) + WHEN 'y' THEN RETURN 1; + -- Case for datepart is week, wk and ww + WHEN 'tsql_week' THEN RETURN 1; + -- Case for datepart is iso_week, isowk and isoww + WHEN 'week' THEN RETURN 1; + -- Case for datepart is tzoffset and tz + WHEN 'tzoffset' THEN RETURN 0; + -- Case for datepart is weekday and dw, return dow according to datefirst + WHEN 'dow' THEN + RETURN (1 - current_setting('babelfishpg_tsql.datefirst')::INTEGER + 7) % 7 + 1 ; + ELSE + RAISE EXCEPTION '''%'' is not a recognized datepart option', datepart; + RETURN -1; + END CASE; +END; +$$ +STRICT +LANGUAGE plpgsql IMMUTABLE; + +-- Reset search_path to not affect any subsequent scripts +SELECT set_config('search_path', trim(leading 'sys, ' from current_setting('search_path')), false); diff --git a/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--3.8.0--4.0.0.sql b/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--3.8.0--4.0.0.sql new file mode 100644 index 00000000000..0b216bb778e --- /dev/null +++ b/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--3.8.0--4.0.0.sql @@ -0,0 +1,555 @@ +-- complain if script is sourced in psql, rather than via ALTER EXTENSION +\echo Use "ALTER EXTENSION ""babelfishpg_tsql"" UPDATE TO '4.0.0'" to load this file. \quit + +-- add 'sys' to search path for the convenience +SELECT set_config('search_path', 'sys, '||current_setting('search_path'), false); + +-- please add your SQL here +/* + * Note: These SQL statements may get executed multiple times specially when some features get backpatched. + * So make sure that any SQL statement (DDL/DML) being added here can be executed multiple times without affecting + * final behaviour. + */ + +CREATE OR REPLACE FUNCTION sys.babelfish_update_server_collation_name() RETURNS VOID +LANGUAGE C +AS 'babelfishpg_common', 'babelfish_update_server_collation_name'; + +SELECT sys.babelfish_update_server_collation_name(); + +DROP FUNCTION sys.babelfish_update_server_collation_name(); + +-- reset babelfishpg_tsql.restored_server_collation_name GUC +do +language plpgsql +$$ + declare + query text; + begin + query := pg_catalog.format('alter database %s reset babelfishpg_tsql.restored_server_collation_name', CURRENT_DATABASE()); + execute query; + end; +$$; + +-- Give bbf_role_admin privileges on every Babelfish role +DO +LANGUAGE plpgsql +$$ +DECLARE temprow RECORD; +DECLARE query TEXT; +BEGIN + IF EXISTS ( + SELECT FROM pg_catalog.pg_roles + WHERE rolname = 'bbf_role_admin') + THEN + RAISE EXCEPTION 'Role "bbf_role_admin" already exists.'; + ELSE + EXECUTE format('CREATE ROLE bbf_role_admin WITH CREATEDB CREATEROLE INHERIT PASSWORD NULL'); + EXECUTE format('GRANT CREATE ON DATABASE %s TO bbf_role_admin WITH GRANT OPTION', CURRENT_DATABASE()); + CALL sys.babel_initialize_logins('bbf_role_admin'); + FOR temprow IN + SELECT rolname FROM sys.babelfish_authid_login_ext WHERE rolname != 'bbf_role_admin' UNION SELECT rolname FROM sys.babelfish_authid_user_ext + LOOP + query := pg_catalog.format('GRANT %I to bbf_role_admin WITH ADMIN TRUE;', temprow.rolname); + EXECUTE query; + END LOOP; + END IF; +END; +$$; + +CREATE OR REPLACE VIEW sys.server_principals +AS SELECT +CAST(Ext.orig_loginname AS sys.SYSNAME) AS name, +CAST(Base.oid As INT) AS principal_id, +CAST(CAST(Base.oid as INT) as sys.varbinary(85)) AS sid, +CAST(Ext.type AS CHAR(1)) as type, +CAST( + CASE + WHEN Ext.type = 'S' THEN 'SQL_LOGIN' + WHEN Ext.type = 'R' THEN 'SERVER_ROLE' + WHEN Ext.type = 'U' THEN 'WINDOWS_LOGIN' + ELSE NULL + END + AS NVARCHAR(60)) AS type_desc, +CAST(Ext.is_disabled AS INT) AS is_disabled, +CAST(Ext.create_date AS SYS.DATETIME) AS create_date, +CAST(Ext.modify_date AS SYS.DATETIME) AS modify_date, +CAST(CASE WHEN Ext.type = 'R' THEN NULL ELSE Ext.default_database_name END AS SYS.SYSNAME) AS default_database_name, +CAST(Ext.default_language_name AS SYS.SYSNAME) AS default_language_name, +CAST(CASE WHEN Ext.type = 'R' THEN NULL ELSE Ext.credential_id END AS INT) AS credential_id, +CAST(CASE WHEN Ext.type = 'R' THEN 1 ELSE Ext.owning_principal_id END AS INT) AS owning_principal_id, +CAST(CASE WHEN Ext.type = 'R' THEN 1 ELSE Ext.is_fixed_role END AS sys.BIT) AS is_fixed_role +FROM pg_catalog.pg_roles AS Base INNER JOIN sys.babelfish_authid_login_ext AS Ext ON Base.rolname = Ext.rolname +WHERE (pg_has_role(suser_id(), 'sysadmin'::TEXT, 'MEMBER') +OR Ext.orig_loginname = suser_name() +OR Ext.orig_loginname = (SELECT pg_get_userbyid(datdba) FROM pg_database WHERE datname = CURRENT_DATABASE()) COLLATE sys.database_default +OR Ext.type = 'R') +AND Ext.type != 'Z'; + +CREATE OR REPLACE VIEW sys.server_role_members AS +SELECT +CAST(Authmbr.roleid AS INT) AS role_principal_id, +CAST(Authmbr.member AS INT) AS member_principal_id +FROM pg_catalog.pg_auth_members AS Authmbr +INNER JOIN pg_catalog.pg_roles AS Auth1 ON Auth1.oid = Authmbr.roleid +INNER JOIN pg_catalog.pg_roles AS Auth2 ON Auth2.oid = Authmbr.member +INNER JOIN sys.babelfish_authid_login_ext AS Ext1 ON Auth1.rolname = Ext1.rolname +INNER JOIN sys.babelfish_authid_login_ext AS Ext2 ON Auth2.rolname = Ext2.rolname +WHERE Ext1.type = 'R' AND Ext1.type != 'Z'; + +CREATE OR REPLACE PROCEDURE sys.sp_helpsrvrolemember("@srvrolename" sys.SYSNAME = NULL) AS +$$ +BEGIN + -- If server role is not specified, return info for all server roles + IF @srvrolename IS NULL + BEGIN + SELECT CAST(Ext1.rolname AS sys.SYSNAME) AS 'ServerRole', + CAST(Ext2.rolname AS sys.SYSNAME) AS 'MemberName', + CAST(CAST(Base2.oid AS INT) AS sys.VARBINARY(85)) AS 'MemberSID' + FROM pg_catalog.pg_auth_members AS Authmbr + INNER JOIN pg_catalog.pg_roles AS Base1 ON Base1.oid = Authmbr.roleid + INNER JOIN pg_catalog.pg_roles AS Base2 ON Base2.oid = Authmbr.member + INNER JOIN sys.babelfish_authid_login_ext AS Ext1 ON Base1.rolname = Ext1.rolname + INNER JOIN sys.babelfish_authid_login_ext AS Ext2 ON Base2.rolname = Ext2.rolname + WHERE Ext1.type = 'R' AND Ext2.type != 'Z' + ORDER BY ServerRole, MemberName; + END + -- If a valid server role is specified, return its member info + -- If the role is a SQL server predefined role (i.e. serveradmin), + -- do not raise an error even if it does not exist + ELSE IF EXISTS (SELECT 1 + FROM sys.babelfish_authid_login_ext + WHERE (rolname = RTRIM(@srvrolename) + OR lower(rolname) = lower(RTRIM(@srvrolename))) + AND type = 'R') + OR lower(RTRIM(@srvrolename)) IN ( + 'serveradmin', 'setupadmin', 'securityadmin', 'processadmin', + 'dbcreator', 'diskadmin', 'bulkadmin') + BEGIN + SELECT CAST(Ext1.rolname AS sys.SYSNAME) AS 'ServerRole', + CAST(Ext2.rolname AS sys.SYSNAME) AS 'MemberName', + CAST(CAST(Base2.oid AS INT) AS sys.VARBINARY(85)) AS 'MemberSID' + FROM pg_catalog.pg_auth_members AS Authmbr + INNER JOIN pg_catalog.pg_roles AS Base1 ON Base1.oid = Authmbr.roleid + INNER JOIN pg_catalog.pg_roles AS Base2 ON Base2.oid = Authmbr.member + INNER JOIN sys.babelfish_authid_login_ext AS Ext1 ON Base1.rolname = Ext1.rolname + INNER JOIN sys.babelfish_authid_login_ext AS Ext2 ON Base2.rolname = Ext2.rolname + WHERE Ext1.type = 'R' AND Ext2.type != 'Z' + AND (Ext1.rolname = RTRIM(@srvrolename) OR lower(Ext1.rolname) = lower(RTRIM(@srvrolename))) + ORDER BY ServerRole, MemberName; + END + -- If the specified server role is not valid + ELSE + RAISERROR('%s is not a known fixed role.', 16, 1, @srvrolename); +END; +$$ +LANGUAGE 'pltsql'; + +create or replace view sys.all_objects as +select + name collate sys.database_default + , cast (object_id as integer) + , cast ( principal_id as integer) + , cast (schema_id as integer) + , cast (parent_object_id as integer) + , type collate sys.database_default + , cast (type_desc as sys.nvarchar(60)) + , cast (create_date as sys.datetime) + , cast (modify_date as sys.datetime) + , is_ms_shipped + , cast (is_published as sys.bit) + , cast (is_schema_published as sys.bit) +from +( +-- Currently for pg_class, pg_proc UNIONs, we separated user defined objects and system objects because the +-- optimiser will be able to make a better estimation of number of rows(in case the query contains a filter on +-- is_ms_shipped column) and in turn chooses a better query plan. + +-- details of system tables +select + t.relname::sys.sysname as name + , t.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , 0 as parent_object_id + , 'U'::char(2) as type + , 'USER_TABLE' as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , 1::sys.bit as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_class t inner join pg_namespace s on s.oid = t.relnamespace +left join sys.table_types_internal tt on t.oid = tt.typrelid +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = t.relname and nis.schemaid = s.oid and nis.type = 'U' +where t.relpersistence in ('p', 'u', 't') +and t.relkind = 'r' +and (s.nspname = 'sys' or (nis.name is not null and ext.nspname is not null)) +and tt.typrelid is null +and has_schema_privilege(s.oid, 'USAGE') +and has_table_privilege(t.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') + +union all +-- details of user defined tables +select + t.relname::sys.sysname as name + , t.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , 0 as parent_object_id + , 'U'::char(2) as type + , 'USER_TABLE' as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , 0::sys.bit as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_class t inner join pg_namespace s on s.oid = t.relnamespace +left join sys.table_types_internal tt on t.oid = tt.typrelid +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = t.relname and nis.schemaid = s.oid and nis.type = 'U' +where t.relpersistence in ('p', 'u', 't') +and t.relkind = 'r' +and s.nspname <> 'sys' and nis.name is null +and ext.nspname is not null +and tt.typrelid is null +and has_schema_privilege(s.oid, 'USAGE') +and has_table_privilege(t.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') + +union all +-- details of system views +select + t.relname::sys.sysname as name + , t.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , 0 as parent_object_id + , 'V'::char(2) as type + , 'VIEW'::varchar(60) as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , 1::sys.bit as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_class t inner join pg_namespace s on s.oid = t.relnamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = t.relname and nis.schemaid = s.oid and nis.type = 'V' +where t.relkind = 'v' +and (s.nspname = 'sys' or (nis.name is not null and ext.nspname is not null)) +and has_schema_privilege(s.oid, 'USAGE') +and has_table_privilege(t.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') +union all +-- Details of user defined views +select + t.relname::sys.sysname as name + , t.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , 0 as parent_object_id + , 'V'::char(2) as type + , 'VIEW'::varchar(60) as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , 0::sys.bit as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_class t inner join pg_namespace s on s.oid = t.relnamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = t.relname and nis.schemaid = s.oid and nis.type = 'V' +where t.relkind = 'v' +and s.nspname <> 'sys' and nis.name is null +and ext.nspname is not null +and has_schema_privilege(s.oid, 'USAGE') +and has_table_privilege(t.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') +union all +-- details of user defined and system foreign key constraints +select + c.conname::sys.sysname as name + , c.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , c.conrelid as parent_object_id + , 'F'::char(2) as type + , 'FOREIGN_KEY_CONSTRAINT' + , null::timestamp as create_date + , null::timestamp as modify_date + , CAST (case when (s.nspname = 'sys' or nis.name is not null) then 1 + else 0 end as sys.bit ) as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_constraint c +inner join pg_namespace s on s.oid = c.connamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = c.conname and nis.schemaid = s.oid and nis.type = 'F' +where has_schema_privilege(s.oid, 'USAGE') +and c.contype = 'f' +and (s.nspname = 'sys' or ext.nspname is not null) +union all +-- details of user defined and system primary key constraints +select + c.conname::sys.sysname as name + , c.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , c.conrelid as parent_object_id + , 'PK'::char(2) as type + , 'PRIMARY_KEY_CONSTRAINT' as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , CAST (case when (s.nspname = 'sys' or nis.name is not null) then 1 + else 0 end as sys.bit ) as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_constraint c +inner join pg_namespace s on s.oid = c.connamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = c.conname and nis.schemaid = s.oid and nis.type = 'PK' +where has_schema_privilege(s.oid, 'USAGE') +and c.contype = 'p' +and (s.nspname = 'sys' or ext.nspname is not null) +union all +-- details of system defined procedures +select + p.proname::sys.sysname as name + , p.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , cast (case when tr.tgrelid is not null + then tr.tgrelid + else 0 end as int) + as parent_object_id + , case p.prokind + when 'p' then 'P'::char(2) + when 'a' then 'AF'::char(2) + else + case + when t.typname = 'trigger' + then 'TR'::char(2) + when p.proretset then + case + when t.typtype = 'c' + then 'TF'::char(2) + else 'IF'::char(2) + end + else 'FN'::char(2) + end + end as type + , case p.prokind + when 'p' then 'SQL_STORED_PROCEDURE'::varchar(60) + when 'a' then 'AGGREGATE_FUNCTION'::varchar(60) + else + case + when t.typname = 'trigger' + then 'SQL_TRIGGER'::varchar(60) + when p.proretset then + case + when t.typtype = 'c' + then 'SQL_TABLE_VALUED_FUNCTION'::varchar(60) + else 'SQL_INLINE_TABLE_VALUED_FUNCTION'::varchar(60) + end + else 'SQL_SCALAR_FUNCTION'::varchar(60) + end + end as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , 1::sys.bit as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_proc p +inner join pg_namespace s on s.oid = p.pronamespace +inner join pg_catalog.pg_type t on t.oid = p.prorettype +left join pg_trigger tr on tr.tgfoid = p.oid +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = p.proname and nis.schemaid = s.oid +and nis.type = (case p.prokind + when 'p' then 'P'::char(2) + when 'a' then 'AF'::char(2) + else + case + when t.typname = 'trigger' + then 'TR'::char(2) + when p.proretset then + case + when t.typtype = 'c' + then 'TF'::char(2) + else 'IF'::char(2) + end + else 'FN'::char(2) + end + end) +where (s.nspname = 'sys' or (nis.name is not null and ext.nspname is not null)) +and has_schema_privilege(s.oid, 'USAGE') +and has_function_privilege(p.oid, 'EXECUTE') +and p.proname != 'pltsql_call_handler' + +union all +-- details of user defined procedures +select + p.proname::sys.sysname as name + , p.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , cast (case when tr.tgrelid is not null + then tr.tgrelid + else 0 end as int) + as parent_object_id + , case p.prokind + when 'p' then 'P'::char(2) + when 'a' then 'AF'::char(2) + else + case + when t.typname = 'trigger' + then 'TR'::char(2) + when p.proretset then + case + when t.typtype = 'c' + then 'TF'::char(2) + else 'IF'::char(2) + end + else 'FN'::char(2) + end + end as type + , case p.prokind + when 'p' then 'SQL_STORED_PROCEDURE'::varchar(60) + when 'a' then 'AGGREGATE_FUNCTION'::varchar(60) + else + case + when t.typname = 'trigger' + then 'SQL_TRIGGER'::varchar(60) + when p.proretset then + case + when t.typtype = 'c' + then 'SQL_TABLE_VALUED_FUNCTION'::varchar(60) + else 'SQL_INLINE_TABLE_VALUED_FUNCTION'::varchar(60) + end + else 'SQL_SCALAR_FUNCTION'::varchar(60) + end + end as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , 0::sys.bit as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_proc p +inner join pg_namespace s on s.oid = p.pronamespace +inner join pg_catalog.pg_type t on t.oid = p.prorettype +left join pg_trigger tr on tr.tgfoid = p.oid +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = p.proname and nis.schemaid = s.oid +and nis.type = (case p.prokind + when 'p' then 'P'::char(2) + when 'a' then 'AF'::char(2) + else + case + when t.typname = 'trigger' + then 'TR'::char(2) + when p.proretset then + case + when t.typtype = 'c' + then 'TF'::char(2) + else 'IF'::char(2) + end + else 'FN'::char(2) + end + end) +where s.nspname <> 'sys' and nis.name is null +and ext.nspname is not null +and has_schema_privilege(s.oid, 'USAGE') +and has_function_privilege(p.oid, 'EXECUTE') + +union all +-- details of all default constraints +select + ('DF_' || o.relname || '_' || d.oid)::sys.sysname as name + , d.oid as object_id + , null::int as principal_id + , o.relnamespace as schema_id + , d.adrelid as parent_object_id + , 'D'::char(2) as type + , 'DEFAULT_CONSTRAINT'::sys.nvarchar(60) AS type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , CAST (case when (s.nspname = 'sys' or nis.name is not null) then 1 + else 0 end as sys.bit ) as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_catalog.pg_attrdef d +inner join pg_attribute a on a.attrelid = d.adrelid and d.adnum = a.attnum +inner join pg_class o on d.adrelid = o.oid +inner join pg_namespace s on s.oid = o.relnamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = ('DF_' || o.relname || '_' || d.oid) and nis.schemaid = s.oid and nis.type = 'D' +where a.atthasdef = 't' and a.attgenerated = '' +and (s.nspname = 'sys' or ext.nspname is not null) +and has_schema_privilege(s.oid, 'USAGE') +and has_column_privilege(a.attrelid, a.attname, 'SELECT,INSERT,UPDATE,REFERENCES') +union all +-- details of all check constraints +select + c.conname::sys.sysname + , c.oid::integer as object_id + , NULL::integer as principal_id + , s.oid as schema_id + , c.conrelid::integer as parent_object_id + , 'C'::char(2) as type + , 'CHECK_CONSTRAINT'::sys.nvarchar(60) as type_desc + , null::sys.datetime as create_date + , null::sys.datetime as modify_date + , CAST (case when (s.nspname = 'sys' or nis.name is not null) then 1 + else 0 end as sys.bit ) as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_catalog.pg_constraint as c +inner join pg_namespace s on s.oid = c.connamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = c.conname and nis.schemaid = s.oid and nis.type = 'C' +where has_schema_privilege(s.oid, 'USAGE') +and c.contype = 'c' and c.conrelid != 0 +and (s.nspname = 'sys' or ext.nspname is not null) +union all +-- details of user defined and system defined sequence objects +select + p.relname::sys.sysname as name + , p.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , 0 as parent_object_id + , 'SO'::char(2) as type + , 'SEQUENCE_OBJECT'::varchar(60) as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , CAST (case when (s.nspname = 'sys' or nis.name is not null) then 1 + else 0 end as sys.bit ) as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_class p +inner join pg_namespace s on s.oid = p.relnamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = p.relname and nis.schemaid = s.oid and nis.type = 'SO' +where p.relkind = 'S' +and (s.nspname = 'sys' or ext.nspname is not null) +and has_schema_privilege(s.oid, 'USAGE') +union all +-- details of user defined table types +select + ('TT_' || tt.name || '_' || tt.type_table_object_id)::sys.sysname as name + , tt.type_table_object_id as object_id + , tt.principal_id as principal_id + , tt.schema_id as schema_id + , 0 as parent_object_id + , 'TT'::char(2) as type + , 'TABLE_TYPE'::varchar(60) as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , CAST (case when (tt.schema_id::regnamespace::text = 'sys' or nis.name is not null) then 1 + else 0 end as sys.bit ) as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from sys.table_types tt +left join sys.shipped_objects_not_in_sys nis on nis.name = ('TT_' || tt.name || '_' || tt.type_table_object_id)::name and nis.schemaid = tt.schema_id and nis.type = 'TT' +) ot; +GRANT SELECT ON sys.all_objects TO PUBLIC; + +-- Reset search_path to not affect any subsequent scripts +SELECT set_config('search_path', trim(leading 'sys, ' from current_setting('search_path')), false); diff --git a/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--4.2.0--4.3.0.sql b/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--4.2.0--4.3.0.sql index d8928f05b3b..76384358a14 100644 --- a/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--4.2.0--4.3.0.sql +++ b/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--4.2.0--4.3.0.sql @@ -38,7 +38,12191 @@ LANGUAGE plpgsql; * final behaviour. */ +-- Babelfish catalog tables are marked system tables and postgres does not normally allow modification on +-- system tables so need to temporarily set allow_system_table_mods to update the primary key of babelfish_function_ext. +SET allow_system_table_mods = ON; +ALTER TABLE sys.babelfish_function_ext DROP CONSTRAINT babelfish_function_ext_pkey; +ALTER TABLE sys.babelfish_function_ext ADD CONSTRAINT babelfish_function_ext_pkey PRIMARY KEY (funcname, nspname, funcsignature); +RESET allow_system_table_mods; +CREATE OR REPLACE FUNCTION sys.sp_tables_internal( + in_table_name sys.nvarchar(384) = NULL, + in_table_owner sys.nvarchar(384) = NULL, + in_table_qualifier sys.sysname = NULL, + in_table_type sys.varchar(100) = NULL, + in_fusepattern sys.bit = '1') + RETURNS TABLE ( + out_table_qualifier sys.sysname, + out_table_owner sys.sysname, + out_table_name sys.sysname, + out_table_type sys.varchar(32), + out_remarks sys.varchar(254) + ) + AS $$ + DECLARE opt_table sys.varchar(16) = ''; + DECLARE opt_view sys.varchar(16) = ''; + DECLARE cs_as_in_table_type varchar COLLATE "C" = in_table_type; + BEGIN + IF upper(cs_as_in_table_type) LIKE '%''TABLE''%' THEN + opt_table = 'TABLE'; + END IF; + IF upper(cs_as_in_table_type) LIKE '%''VIEW''%' THEN + opt_view = 'VIEW'; + END IF; + IF in_fusepattern = 1 THEN + RETURN query + SELECT + CAST(table_qualifier AS sys.sysname) AS TABLE_QUALIFIER, + CAST(table_owner AS sys.sysname) AS TABLE_OWNER, + CAST(table_name AS sys.sysname) AS TABLE_NAME, + CAST(table_type AS sys.varchar(32)) AS TABLE_TYPE, + CAST(remarks AS sys.varchar(254)) AS REMARKS + FROM sys.sp_tables_view + WHERE (in_table_name IS NULL OR table_name LIKE in_table_name collate sys.database_default) + AND (in_table_owner IS NULL OR table_owner LIKE in_table_owner collate sys.database_default) + AND (in_table_qualifier IS NULL OR table_qualifier LIKE in_table_qualifier collate sys.database_default) + AND (cs_as_in_table_type IS NULL OR table_type = opt_table OR table_type = opt_view) + ORDER BY table_qualifier, table_owner, table_name; + ELSE + RETURN query + SELECT + CAST(table_qualifier AS sys.sysname) AS TABLE_QUALIFIER, + CAST(table_owner AS sys.sysname) AS TABLE_OWNER, + CAST(table_name AS sys.sysname) AS TABLE_NAME, + CAST(table_type AS sys.varchar(32)) AS TABLE_TYPE, + CAST(remarks AS sys.varchar(254)) AS REMARKS + FROM sys.sp_tables_view + WHERE (in_table_name IS NULL OR table_name = in_table_name collate sys.database_default) + AND (in_table_owner IS NULL OR table_owner = in_table_owner collate sys.database_default) + AND (in_table_qualifier IS NULL OR table_qualifier = in_table_qualifier collate sys.database_default) + AND (cs_as_in_table_type IS NULL OR table_type = opt_table OR table_type = opt_view) + ORDER BY table_qualifier, table_owner, table_name; + END IF; + END; +$$ +LANGUAGE plpgsql STABLE; + +CREATE OR REPLACE PROCEDURE sys.sp_tables ( + "@table_name" sys.nvarchar(384) = NULL, + "@table_owner" sys.nvarchar(384) = NULL, + "@table_qualifier" sys.sysname = NULL, + "@table_type" sys.nvarchar(100) = NULL, + "@fusepattern" sys.bit = '1') +AS $$ +BEGIN + + -- Handle special case: Enumerate all databases when name and owner are blank but qualifier is '%' + IF (@table_qualifier = '%' AND @table_owner = '' AND @table_name = '') + BEGIN + SELECT + d.name AS TABLE_QUALIFIER, + CAST(NULL AS sys.sysname) AS TABLE_OWNER, + CAST(NULL AS sys.sysname) AS TABLE_NAME, + CAST(NULL AS sys.varchar(32)) AS TABLE_TYPE, + CAST(NULL AS sys.varchar(254)) AS REMARKS + FROM sys.databases d ORDER BY TABLE_QUALIFIER; + + RETURN; + END; + + IF (@table_qualifier != '' AND LOWER(@table_qualifier) != LOWER(sys.db_name())) + BEGIN + THROW 33557097, N'The database name component of the object qualifier must be the name of the current database.', 1; + END + + SELECT + CAST(out_table_qualifier AS sys.sysname) AS TABLE_QUALIFIER, + CAST(out_table_owner AS sys.sysname) AS TABLE_OWNER, + CAST(out_table_name AS sys.sysname) AS TABLE_NAME, + CAST(out_table_type AS sys.varchar(32)) AS TABLE_TYPE, + CAST(out_remarks AS sys.varchar(254)) AS REMARKS + FROM sys.sp_tables_internal(@table_name, @table_owner, @table_qualifier, CAST(@table_type AS varchar(100)), @fusepattern); +END; +$$ +LANGUAGE 'pltsql'; +GRANT EXECUTE ON PROCEDURE sys.sp_tables TO PUBLIC; + +-- BBF_PARTITION_FUNCTION +-- This catalog stores the metadata of partition funtions. +CREATE TABLE sys.babelfish_partition_function +( + dbid SMALLINT NOT NULL, -- to maintain separation b/w databases + function_id INT NOT NULL UNIQUE, -- globally unique ID of partition function + partition_function_name sys.NVARCHAR(128) NOT NULL COLLATE sys.database_default, + input_parameter_type sys.sysname, -- data type of the column which will be used for partitioning + partition_option sys.bit, -- whether boundary option is LEFT or RIGHT + range_values sys.sql_variant[] CHECK (array_length(range_values, 1) < 15000), -- boundary values + create_date SYS.DATETIME NOT NULL, + modify_date SYS.DATETIME NOT NULL, + PRIMARY KEY(dbid, partition_function_name) +); + +-- SEQUENCE to maintain the ID of partition function. +CREATE SEQUENCE sys.babelfish_partition_function_seq MAXVALUE 2147483647 CYCLE; + +-- BBF_PARTITION_SCHEME +-- This catalog stores the metadata of partition schemes. +CREATE TABLE sys.babelfish_partition_scheme +( + dbid SMALLINT NOT NULL, -- to maintain separation between databases + scheme_id INT NOT NULL UNIQUE, -- globally unique ID of partition scheme + partition_scheme_name sys.NVARCHAR(128) NOT NULL COLLATE sys.database_default, + partition_function_name sys.NVARCHAR(128) NOT NULL COLLATE sys.database_default, + next_used sys.bit, -- next used filegroup is specified or not during creation + PRIMARY KEY(dbid, partition_scheme_name) +); + +-- SEQUENCE to maintain the ID of partition scheme. +-- The combination of the partition scheme ID and filegroup ID are used as +-- DATA_SPACE_ID, where the value 1 is reseverd for [PRIMARY] filegroup. +CREATE SEQUENCE sys.babelfish_partition_scheme_seq START 2 MAXVALUE 2147483647 CYCLE; + +-- BBF_PARTITION_DEPEND +-- This catalog tracks the dependecy between partition scheme and partitioned tables created using that. +CREATE TABLE sys.babelfish_partition_depend +( + dbid SMALLINT NOT NULL, -- to maintain separation between databases + partition_scheme_name sys.NVARCHAR(128) NOT NULL COLLATE sys.database_default, + schema_name sys.NVARCHAR(128) NOT NULL COLLATE sys.database_default, + table_name sys.NVARCHAR(128) NOT NULL COLLATE sys.database_default, + PRIMARY KEY(dbid, schema_name, table_name) +); + +SELECT pg_catalog.pg_extension_config_dump('sys.babelfish_partition_function', ''); +SELECT pg_catalog.pg_extension_config_dump('sys.babelfish_partition_scheme', ''); +SELECT pg_catalog.pg_extension_config_dump('sys.babelfish_partition_depend', ''); +SELECT pg_catalog.pg_extension_config_dump('sys.babelfish_partition_function_seq', ''); +SELECT pg_catalog.pg_extension_config_dump('sys.babelfish_partition_scheme_seq', ''); + + +CREATE OR REPLACE PROCEDURE initialize_babelfish ( sa_name VARCHAR(128) ) +LANGUAGE plpgsql +AS $$ +DECLARE + reserved_roles varchar[] := ARRAY['sysadmin', 'master_dbo', 'master_guest', 'master_db_owner', 'tempdb_dbo', 'tempdb_guest', 'tempdb_db_owner', 'msdb_dbo', 'msdb_guest', 'msdb_db_owner']; + user_id oid := -1; + db_name name := NULL; + role_name varchar; + dba_name varchar; +BEGIN + -- check reserved roles + FOREACH role_name IN ARRAY reserved_roles LOOP + BEGIN + SELECT oid INTO user_id FROM pg_roles WHERE rolname = role_name; + IF user_id > 0 THEN + SELECT datname INTO db_name FROM pg_shdepend AS s INNER JOIN pg_database AS d ON s.dbid = d.oid WHERE s.refobjid = user_id; + IF db_name IS NOT NULL THEN + RAISE E'Could not initialize babelfish in current database: Reserved role % used in database %.\nIf babelfish was initialized in %, please remove babelfish and try again.', role_name, db_name, db_name; + ELSE + RAISE E'Could not initialize babelfish in current database: Reserved role % exists. \nPlease rename or drop existing role and try again ', role_name; + END IF; + END IF; + END; + END LOOP; + + SELECT pg_get_userbyid(datdba) INTO dba_name FROM pg_database WHERE datname = CURRENT_DATABASE(); + IF sa_name <> dba_name THEN + RAISE E'Could not initialize babelfish with given role name: % is not the DB owner of current database.', sa_name; + END IF; + + EXECUTE format('CREATE ROLE bbf_role_admin CREATEDB CREATEROLE INHERIT PASSWORD NULL'); + EXECUTE format('GRANT CREATE ON DATABASE %s TO bbf_role_admin WITH GRANT OPTION', CURRENT_DATABASE()); + EXECUTE format('GRANT %I to bbf_role_admin WITH ADMIN TRUE;', sa_name); + EXECUTE format('CREATE ROLE sysadmin CREATEDB CREATEROLE INHERIT ROLE %I', sa_name); + EXECUTE format('GRANT sysadmin TO bbf_role_admin WITH ADMIN TRUE'); + EXECUTE format('GRANT USAGE, SELECT ON SEQUENCE sys.babelfish_partition_function_seq TO sysadmin WITH GRANT OPTION'); + EXECUTE format('GRANT USAGE, SELECT ON SEQUENCE sys.babelfish_partition_scheme_seq TO sysadmin WITH GRANT OPTION'); + EXECUTE format('GRANT USAGE, SELECT ON SEQUENCE sys.babelfish_db_seq TO sysadmin WITH GRANT OPTION'); + EXECUTE format('GRANT CREATE, CONNECT, TEMPORARY ON DATABASE %s TO sysadmin WITH GRANT OPTION', CURRENT_DATABASE()); + EXECUTE format('ALTER DATABASE %s SET babelfishpg_tsql.enable_ownership_structure = true', CURRENT_DATABASE()); + EXECUTE 'SET babelfishpg_tsql.enable_ownership_structure = true'; + CALL sys.babel_initialize_logins(sa_name); + CALL sys.babel_initialize_logins('sysadmin'); + CALL sys.babel_initialize_logins('bbf_role_admin'); + CALL sys.babel_create_builtin_dbs(sa_name); + CALL sys.initialize_babel_extras(); + -- run analyze for all babelfish catalog + CALL sys.analyze_babelfish_catalogs(); +END +$$; + +CREATE OR REPLACE PROCEDURE remove_babelfish () +LANGUAGE plpgsql +AS $$ +BEGIN + CALL sys.babel_drop_all_dbs(); + CALL sys.babel_drop_all_logins(); + EXECUTE format('ALTER DATABASE %s SET babelfishpg_tsql.enable_ownership_structure = false', CURRENT_DATABASE()); + EXECUTE 'ALTER SEQUENCE sys.babelfish_db_seq RESTART'; + EXECUTE 'ALTER SEQUENCE sys.babelfish_partition_function_seq RESTART'; + EXECUTE 'ALTER SEQUENCE sys.babelfish_partition_scheme_seq RESTART'; + DROP OWNED BY sysadmin; + DROP ROLE sysadmin; + DROP OWNED BY bbf_role_admin; + DROP ROLE bbf_role_admin; +END +$$; + +CREATE OR REPLACE VIEW sys.partition_functions AS +SELECT + partition_function_name as name, + function_id, + CAST('R' as sys.bpchar(2)) as type, + CAST('RANGE' as sys.nvarchar(60)) as type_desc, + CAST(ARRAY_LENGTH(range_values, 1)+1 as int) fanout, + CAST(partition_option as sys.bit) as boundary_value_on_right, + CAST(0 as sys.bit) as is_system, + create_date, + modify_date +FROM + sys.babelfish_partition_function +WHERE + dbid = sys.db_id(); +GRANT SELECT ON sys.partition_functions TO PUBLIC; + +CREATE OR REPLACE VIEW sys.partition_range_values AS +SELECT + function_id, + CAST(1 as int) as parameter_id, + CAST(t.boundary_id as int), + t.value +FROM + sys.babelfish_partition_function, + unnest(range_values) WITH ORDINALITY as t(value, boundary_id) +where + dbid = sys.db_id(); +GRANT SELECT ON sys.partition_range_values TO PUBLIC; + +CREATE OR REPLACE VIEW sys.partition_parameters AS +SELECT + function_id, + cast(1 as int) as parameter_id, + st.system_type_id, + st.max_length, + st.precision, + st.scale, + st.collation_name, + st.user_type_id +FROM + sys.babelfish_partition_function pf +INNER JOIN + sys.types st on (pf.input_parameter_type = st.name and st.user_type_id = st.system_type_id) +WHERE + dbid = sys.db_id(); +GRANT SELECT ON sys.partition_parameters TO PUBLIC; + +CREATE OR REPLACE VIEW sys.partition_schemes AS +SELECT + partition_scheme_name as name, + scheme_id as data_space_id, + CAST('PS' as sys.bpchar(2)) as type, + CAST('PARTITION_SCHEME' as sys.nvarchar(60)) as type_desc, + CAST(0 as sys.bit) as is_default, + CAST(0 as sys.bit) as is_system, + pf.function_id +FROM + sys.babelfish_partition_scheme ps +INNER JOIN + sys.babelfish_partition_function pf ON (pf.partition_function_name = ps.partition_function_name and ps.dbid = pf.dbid) +WHERE + ps.dbid = sys.db_id(); +GRANT SELECT ON sys.partition_schemes TO PUBLIC; + +CREATE OR REPLACE FUNCTION sys.remove_accents_internal_using_cache(IN TEXT) RETURNS sys.NVARCHAR +AS 'babelfishpg_tsql', 'remove_accents_internal_using_cache' +LANGUAGE C +IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.get_icu_major_version() RETURNS INT4 +AS 'babelfishpg_tsql', 'get_icu_major_version' +LANGUAGE C +IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.get_icu_minor_version() RETURNS INT4 +AS 'babelfishpg_tsql', 'get_icu_minor_version' +LANGUAGE C +IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.is_collated_ai(IN input_string TEXT) RETURNS BOOL +AS 'babelfishpg_tsql', 'is_collated_ai_internal' +LANGUAGE C VOLATILE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.charindex(expressionToFind PG_CATALOG.TEXT, + expressionToSearch PG_CATALOG.TEXT, + start_location INTEGER DEFAULT 0) +RETURNS INTEGER AS +$BODY$ +SELECT +CASE +WHEN expressionToFind = '' THEN + 0 +WHEN start_location <= 0 THEN + strpos(expressionToSearch, expressionToFind) +ELSE + CASE + WHEN strpos(substr(expressionToSearch, start_location), expressionToFind) = 0 THEN + 0 + ELSE + strpos(substr(expressionToSearch, start_location), expressionToFind) + start_location - 1 + END +END; +$BODY$ +STRICT +LANGUAGE SQL IMMUTABLE; + +create or replace function sys.get_tds_id( + datatype sys.varchar(50) +) +returns INT +AS $$ +DECLARE + tds_id INT; +BEGIN + IF datatype IS NULL THEN + RETURN 0; + END IF; + CASE datatype + WHEN 'text' THEN tds_id = 35; + WHEN 'uniqueidentifier' THEN tds_id = 36; + WHEN 'tinyint' THEN tds_id = 38; + WHEN 'smallint' THEN tds_id = 38; + WHEN 'int' THEN tds_id = 38; + WHEN 'bigint' THEN tds_id = 38; + WHEN 'ntext' THEN tds_id = 99; + WHEN 'bit' THEN tds_id = 104; + WHEN 'float' THEN tds_id = 109; + WHEN 'real' THEN tds_id = 109; + WHEN 'varchar' THEN tds_id = 167; + WHEN 'nvarchar' THEN tds_id = 231; + WHEN 'nchar' THEN tds_id = 239; + WHEN 'money' THEN tds_id = 110; + WHEN 'smallmoney' THEN tds_id = 110; + WHEN 'char' THEN tds_id = 175; + WHEN 'date' THEN tds_id = 40; + WHEN 'datetime' THEN tds_id = 111; + WHEN 'smalldatetime' THEN tds_id = 111; + WHEN 'numeric' THEN tds_id = 108; + WHEN 'xml' THEN tds_id = 241; + WHEN 'decimal' THEN tds_id = 106; + WHEN 'varbinary' THEN tds_id = 165; + WHEN 'binary' THEN tds_id = 173; + WHEN 'image' THEN tds_id = 34; + WHEN 'time' THEN tds_id = 41; + WHEN 'datetime2' THEN tds_id = 42; + WHEN 'sql_variant' THEN tds_id = 98; + WHEN 'datetimeoffset' THEN tds_id = 43; + WHEN 'timestamp' THEN tds_id = 173; + WHEN 'vector' THEN tds_id = 167; -- Same as varchar + WHEN 'sparsevec' THEN tds_id = 167; -- Same as varchar + WHEN 'halfvec' THEN tds_id = 167; -- Same as varchar + WHEN 'geometry' THEN tds_id = 240; + WHEN 'geography' THEN tds_id = 240; + ELSE tds_id = 0; + END CASE; + RETURN tds_id; +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT; + +CREATE OR REPLACE FUNCTION information_schema_tsql._pgtsql_char_max_length(type text, typmod int4) RETURNS integer + LANGUAGE sql + IMMUTABLE + PARALLEL SAFE + RETURNS NULL ON NULL INPUT + AS +$$SELECT + CASE WHEN type IN ('char', 'nchar', 'varchar', 'nvarchar', 'binary', 'varbinary') + THEN CASE WHEN typmod = -1 + THEN -1 + ELSE typmod - 4 + END + WHEN type IN ('text', 'image') + THEN 2147483647 + WHEN type = 'ntext' + THEN 1073741823 + WHEN type = 'sysname' + THEN 128 + WHEN type IN ('xml', 'vector', 'halfvec', 'sparsevec', 'geometry', 'geography') + THEN -1 + WHEN type = 'sql_variant' + THEN 0 + ELSE null + END$$; + +CREATE OR REPLACE FUNCTION sys.tsql_type_max_length_helper(IN type TEXT, IN typelen INT, IN typemod INT, IN for_sys_types boolean DEFAULT false, IN used_typmod_array boolean DEFAULT false) +RETURNS SMALLINT +AS $$ +DECLARE + max_length SMALLINT; + precision INT; + v_type TEXT COLLATE sys.database_default := type; +BEGIN + -- unknown tsql type + IF v_type IS NULL THEN + RETURN CAST(typelen as SMALLINT); + END IF; + + -- if using typmod_array from pg_proc.probin + IF used_typmod_array THEN + IF v_type = 'sysname' THEN + RETURN 256; + ELSIF (v_type in ('char', 'bpchar', 'varchar', 'binary', 'varbinary', 'nchar', 'nvarchar')) + THEN + IF typemod < 0 THEN -- max value. + RETURN -1; + ELSIF v_type in ('nchar', 'nvarchar') THEN + RETURN (2 * typemod); + ELSE + RETURN typemod; + END IF; + END IF; + END IF; + + IF typelen != -1 THEN + CASE v_type + WHEN 'tinyint' THEN max_length = 1; + WHEN 'date' THEN max_length = 3; + WHEN 'smalldatetime' THEN max_length = 4; + WHEN 'smallmoney' THEN max_length = 4; + WHEN 'datetime2' THEN + IF typemod = -1 THEN max_length = 8; + ELSIF typemod <= 2 THEN max_length = 6; + ELSIF typemod <= 4 THEN max_length = 7; + ELSEIF typemod <= 7 THEN max_length = 8; + -- typemod = 7 is not possible for datetime2 in Babel + END IF; + WHEN 'datetimeoffset' THEN + IF typemod = -1 THEN max_length = 10; + ELSIF typemod <= 2 THEN max_length = 8; + ELSIF typemod <= 4 THEN max_length = 9; + ELSIF typemod <= 7 THEN max_length = 10; + -- typemod = 7 is not possible for datetimeoffset in Babel + END IF; + WHEN 'time' THEN + IF typemod = -1 THEN max_length = 5; + ELSIF typemod <= 2 THEN max_length = 3; + ELSIF typemod <= 4 THEN max_length = 4; + ELSIF typemod <= 7 THEN max_length = 5; + END IF; + WHEN 'timestamp' THEN max_length = 8; + WHEN 'vector' THEN max_length = -1; -- dummy as varchar max + WHEN 'halfvec' THEN max_length = -1; -- dummy as varchar max + WHEN 'sparsevec' THEN max_length = -1; -- dummy as varchar max + ELSE max_length = typelen; + END CASE; + RETURN max_length; + END IF; + + IF typemod = -1 THEN + CASE + WHEN v_type in ('image', 'text', 'ntext') THEN max_length = 16; + WHEN v_type = 'sql_variant' THEN max_length = 8016; + WHEN v_type in ('varbinary', 'varchar', 'nvarchar') THEN + IF for_sys_types THEN max_length = 8000; + ELSE max_length = -1; + END IF; + WHEN v_type in ('binary', 'char', 'bpchar', 'nchar') THEN max_length = 8000; + WHEN v_type in ('decimal', 'numeric') THEN max_length = 17; + WHEN v_type in ('geometry', 'geography') THEN max_length = -1; + ELSE max_length = typemod; + END CASE; + RETURN max_length; + END IF; + + CASE + WHEN v_type in ('char', 'bpchar', 'varchar', 'binary', 'varbinary') THEN max_length = typemod - 4; + WHEN v_type in ('nchar', 'nvarchar') THEN max_length = (typemod - 4) * 2; + WHEN v_type = 'sysname' THEN max_length = (typemod - 4) * 2; + WHEN v_type in ('numeric', 'decimal') THEN + precision = ((typemod - 4) >> 16) & 65535; + IF precision >= 1 and precision <= 9 THEN max_length = 5; + ELSIF precision <= 19 THEN max_length = 9; + ELSIF precision <= 28 THEN max_length = 13; + ELSIF precision <= 38 THEN max_length = 17; + ELSE max_length = typelen; + END IF; + ELSE + max_length = typemod; + END CASE; + RETURN max_length; +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT; + +CREATE OR REPLACE VIEW sys.database_principals AS +SELECT +CAST(Ext.orig_username AS SYS.SYSNAME) AS name, +CAST(Base.oid AS INT) AS principal_id, +CAST(Ext.type AS CHAR(1)) as type, +CAST( + CASE + WHEN Ext.type = 'S' THEN 'SQL_USER' + WHEN Ext.type = 'R' THEN 'DATABASE_ROLE' + WHEN Ext.type = 'U' THEN 'WINDOWS_USER' + ELSE NULL + END + AS SYS.NVARCHAR(60)) AS type_desc, +CAST(Ext.default_schema_name AS SYS.SYSNAME) AS default_schema_name, +CAST(Ext.create_date AS SYS.DATETIME) AS create_date, +CAST(Ext.modify_date AS SYS.DATETIME) AS modify_date, +CAST(Ext.owning_principal_id AS INT) AS owning_principal_id, +CAST(CAST(Base2.oid AS INT) AS SYS.VARBINARY(85)) AS SID, +CAST(Ext.is_fixed_role AS SYS.BIT) AS is_fixed_role, +CAST(Ext.authentication_type AS INT) AS authentication_type, +CAST(Ext.authentication_type_desc AS SYS.NVARCHAR(60)) AS authentication_type_desc, +CAST(Ext.default_language_name AS SYS.SYSNAME) AS default_language_name, +CAST(Ext.default_language_lcid AS INT) AS default_language_lcid, +CAST(Ext.allow_encrypted_value_modifications AS SYS.BIT) AS allow_encrypted_value_modifications +FROM pg_catalog.pg_roles AS Base INNER JOIN sys.babelfish_authid_user_ext AS Ext +ON Base.rolname = Ext.rolname +LEFT OUTER JOIN pg_catalog.pg_roles Base2 +ON Ext.login_name = Base2.rolname +WHERE Ext.database_name = DB_NAME() + AND (Ext.orig_username IN ('dbo', 'db_owner', 'guest') -- system users should always be visible + OR pg_has_role(Ext.rolname, 'MEMBER')) -- Current user should be able to see users it has permission of +UNION ALL +SELECT +CAST(name AS SYS.SYSNAME) AS name, +CAST(-1 AS INT) AS principal_id, +CAST(type AS CHAR(1)) as type, +CAST( + CASE + WHEN type = 'S' THEN 'SQL_USER' + WHEN type = 'R' THEN 'DATABASE_ROLE' + WHEN type = 'U' THEN 'WINDOWS_USER' + ELSE NULL + END + AS SYS.NVARCHAR(60)) AS type_desc, +CAST(NULL AS SYS.SYSNAME) AS default_schema_name, +CAST(NULL AS SYS.DATETIME) AS create_date, +CAST(NULL AS SYS.DATETIME) AS modify_date, +CAST(-1 AS INT) AS owning_principal_id, +CAST(CAST(0 AS INT) AS SYS.VARBINARY(85)) AS SID, +CAST(0 AS SYS.BIT) AS is_fixed_role, +CAST(-1 AS INT) AS authentication_type, +CAST(NULL AS SYS.NVARCHAR(60)) AS authentication_type_desc, +CAST(NULL AS SYS.SYSNAME) AS default_language_name, +CAST(-1 AS INT) AS default_language_lcid, +CAST(0 AS SYS.BIT) AS allow_encrypted_value_modifications +FROM (VALUES ('public', 'R'), ('sys', 'S'), ('INFORMATION_SCHEMA', 'S')) as dummy_principals(name, type); + +CREATE OR REPLACE VIEW sys.user_token AS +SELECT +CAST(Base.oid AS INT) AS principal_id, +CAST(CAST(Base2.oid AS INT) AS SYS.VARBINARY(85)) AS SID, +CAST(Ext.orig_username AS SYS.NVARCHAR(128)) AS NAME, +CAST(CASE +WHEN Ext.type = 'U' THEN 'WINDOWS LOGIN' +WHEN Ext.type = 'R' THEN 'ROLE' +ELSE 'SQL USER' END +AS SYS.NVARCHAR(128)) AS TYPE, +CAST('GRANT OR DENY' as SYS.NVARCHAR(128)) as USAGE +FROM pg_catalog.pg_roles AS Base INNER JOIN sys.babelfish_authid_user_ext AS Ext +ON Base.rolname = Ext.rolname +LEFT OUTER JOIN pg_catalog.pg_roles Base2 +ON Ext.login_name = Base2.rolname +WHERE Ext.database_name = sys.DB_NAME() +AND ((Ext.rolname = CURRENT_USER AND Ext.type in ('S','U')) OR +((SELECT orig_username FROM sys.babelfish_authid_user_ext WHERE rolname = CURRENT_USER) != 'dbo' AND Ext.type = 'R' AND pg_has_role(current_user, Ext.rolname, 'MEMBER'))) +UNION ALL +SELECT +CAST(-1 AS INT) AS principal_id, +CAST(CAST(-1 AS INT) AS SYS.VARBINARY(85)) AS SID, +CAST('public' AS SYS.NVARCHAR(128)) AS NAME, +CAST('ROLE' AS SYS.NVARCHAR(128)) AS TYPE, +CAST('GRANT OR DENY' as SYS.NVARCHAR(128)) as USAGE +WHERE (SELECT orig_username FROM sys.babelfish_authid_user_ext WHERE rolname = CURRENT_USER) != 'dbo'; + +GRANT SELECT ON sys.user_token TO PUBLIC; + +CREATE OR REPLACE VIEW sys.server_principals +AS SELECT +CAST(Ext.orig_loginname AS sys.SYSNAME) AS name, +CAST(Base.oid As INT) AS principal_id, +CAST(CAST(Base.oid as INT) as sys.varbinary(85)) AS sid, +CAST(Ext.type AS CHAR(1)) as type, +CAST( + CASE + WHEN Ext.type = 'S' THEN 'SQL_LOGIN' + WHEN Ext.type = 'R' THEN 'SERVER_ROLE' + WHEN Ext.type = 'U' THEN 'WINDOWS_LOGIN' + ELSE NULL + END + AS NVARCHAR(60)) AS type_desc, +CAST(Ext.is_disabled AS INT) AS is_disabled, +CAST(Ext.create_date AS SYS.DATETIME) AS create_date, +CAST(Ext.modify_date AS SYS.DATETIME) AS modify_date, +CAST(CASE WHEN Ext.type = 'R' THEN NULL ELSE Ext.default_database_name END AS SYS.SYSNAME) AS default_database_name, +CAST(Ext.default_language_name AS SYS.SYSNAME) AS default_language_name, +CAST(CASE WHEN Ext.type = 'R' THEN NULL ELSE Ext.credential_id END AS INT) AS credential_id, +CAST(CASE WHEN Ext.type = 'R' THEN 1 ELSE Ext.owning_principal_id END AS INT) AS owning_principal_id, +CAST(CASE WHEN Ext.type = 'R' THEN 1 ELSE Ext.is_fixed_role END AS sys.BIT) AS is_fixed_role +FROM pg_catalog.pg_roles AS Base INNER JOIN sys.babelfish_authid_login_ext AS Ext ON Base.rolname = Ext.rolname +WHERE (pg_has_role(suser_id(), 'sysadmin'::TEXT, 'MEMBER') + OR Ext.orig_loginname = suser_name() + OR Ext.orig_loginname = (SELECT pg_get_userbyid(datdba) FROM pg_database WHERE datname = CURRENT_DATABASE()) COLLATE sys.database_default + OR Ext.type = 'R') + AND Ext.type != 'Z' +UNION ALL +SELECT +CAST('public' AS SYS.SYSNAME) AS name, +CAST(-1 AS INT) AS principal_id, +CAST(CAST(0 as INT) as sys.varbinary(85)) AS sid, +CAST('R' AS CHAR(1)) as type, +CAST('SERVER_ROLE' AS NVARCHAR(60)) AS type_desc, +CAST(0 AS INT) AS is_disabled, +CAST(NULL AS SYS.DATETIME) AS create_date, +CAST(NULL AS SYS.DATETIME) AS modify_date, +CAST(NULL AS SYS.SYSNAME) AS default_database_name, +CAST(NULL AS SYS.SYSNAME) AS default_language_name, +CAST(NULL AS INT) AS credential_id, +CAST(1 AS INT) AS owning_principal_id, +CAST(0 AS sys.BIT) AS is_fixed_role; + +GRANT SELECT ON sys.server_principals TO PUBLIC; + +CREATE OR REPLACE FUNCTION sys.is_member(IN role sys.SYSNAME) +RETURNS INT AS +$$ +DECLARE + is_windows_grp boolean := (CHARINDEX('\', role) != 0); +BEGIN + -- Always return 1 for 'public' + IF (role = 'public') + THEN RETURN 1; + END IF; + IF EXISTS (SELECT orig_loginname FROM sys.babelfish_authid_login_ext WHERE orig_loginname = role AND type != 'S') -- do not consider sql logins + THEN + IF ((EXISTS (SELECT name FROM sys.login_token WHERE name = role AND type IN ('SERVER ROLE', 'SQL LOGIN'))) OR is_windows_grp) -- do not consider sql logins, server roles + THEN RETURN NULL; -- Also return NULL if session is not a windows auth session but argument is a windows group + ELSIF EXISTS (SELECT name FROM sys.login_token WHERE name = role AND type NOT IN ('SERVER ROLE', 'SQL LOGIN')) + THEN RETURN 1; -- Return 1 if current session user is a member of role or windows group + ELSE RETURN 0; -- Return 0 if current session user is not a member of role or windows group + END IF; + ELSIF EXISTS (SELECT orig_username FROM sys.babelfish_authid_user_ext WHERE orig_username = role) + THEN + IF EXISTS (SELECT name FROM sys.user_token WHERE name = role) + THEN RETURN 1; -- Return 1 if current session user is a member of role or windows group + ELSIF (is_windows_grp) + THEN RETURN NULL; -- Return NULL if session is not a windows auth session but argument is a windows group + ELSE RETURN 0; -- Return 0 if current session user is not a member of role or windows group + END IF; + ELSE RETURN NULL; -- Return NULL if role/group does not exist + END IF; +END; +$$ +LANGUAGE plpgsql STRICT STABLE; + +-- Update deprecated object_id function(s) since left function now restricts TEXT datatype +DO $$ +BEGIN + -- Update body of object_id_deprecated_in_2_4_0 to use PG_CATALOG.LEFT instead, if function exists + IF EXISTS(SELECT count(*) + FROM pg_proc p + JOIN pg_namespace nsp + ON p.pronamespace = nsp.oid + WHERE p.proname='object_id_deprecated_in_2_4_0' AND nsp.nspname='sys') THEN + + CREATE OR REPLACE FUNCTION sys.object_id_deprecated_in_2_4_0(IN object_name TEXT, IN object_type char(2) DEFAULT '') + RETURNS INTEGER AS + $BODY$ + DECLARE + id oid; + db_name text collate "C"; + bbf_schema_name text collate "C"; + schema_name text collate "C"; + schema_oid oid; + obj_name text collate "C"; + is_temp_object boolean; + obj_type char(2) collate "C"; + cs_as_object_name text collate "C" := object_name; + BEGIN + obj_type = object_type; + id = null; + schema_oid = NULL; + + SELECT s.db_name, s.schema_name, s.object_name INTO db_name, bbf_schema_name, obj_name + FROM babelfish_split_object_name(cs_as_object_name) s; + + -- Invalid object_name + IF obj_name IS NULL OR obj_name = '' collate sys.database_default THEN + RETURN NULL; + END IF; + + IF bbf_schema_name IS NULL OR bbf_schema_name = '' collate sys.database_default THEN + bbf_schema_name := sys.schema_name(); + END IF; + + schema_name := sys.bbf_get_current_physical_schema_name(bbf_schema_name); + + -- Check if looking for temp object. + is_temp_object = PG_CATALOG.left(obj_name, 1) = '#' collate sys.database_default; + + -- Can only search in current database. Allowing tempdb for temp objects. + IF db_name IS NOT NULL AND db_name collate sys.database_default <> db_name() AND db_name collate sys.database_default <> 'tempdb' THEN + RAISE EXCEPTION 'Can only do lookup in current database.'; + END IF; + + IF schema_name IS NULL OR schema_name = '' collate sys.database_default THEN + RETURN NULL; + END IF; + + -- Searching within a schema. Get schema oid. + schema_oid = (SELECT oid FROM pg_namespace WHERE nspname = schema_name); + IF schema_oid IS NULL THEN + RETURN NULL; + END IF; + + if obj_type <> '' then + case + -- Schema does not apply as much to temp objects. + when pg_catalog.upper(object_type) in ('S', 'U', 'V', 'IT', 'ET', 'SO') and is_temp_object then + id := (select reloid from sys.babelfish_get_enr_list() where pg_catalog.lower(relname) collate sys.database_default = obj_name limit 1); + + when pg_catalog.upper(object_type) in ('S', 'U', 'V', 'IT', 'ET', 'SO') and not is_temp_object then + id := (select oid from pg_class where pg_catalog.lower(relname) collate sys.database_default = obj_name + and relnamespace = schema_oid limit 1); + + when pg_catalog.upper(object_type) in ('C', 'D', 'F', 'PK', 'UQ') then + id := (select oid from pg_constraint where pg_catalog.lower(conname) collate sys.database_default = obj_name + and connamespace = schema_oid limit 1); + + when pg_catalog.upper(object_type) in ('AF', 'FN', 'FS', 'FT', 'IF', 'P', 'PC', 'TF', 'RF', 'X') then + id := (select oid from pg_proc where pg_catalog.lower(proname) collate sys.database_default = obj_name + and pronamespace = schema_oid limit 1); + + when pg_catalog.upper(object_type) in ('TR', 'TA') then + id := (select oid from pg_trigger where pg_catalog.lower(tgname) collate sys.database_default = obj_name limit 1); + + -- Throwing exception as a reminder to add support in the future. + when pg_catalog.upper(object_type) collate sys.database_default in ('R', 'EC', 'PG', 'SN', 'SQ', 'TT') then + RAISE EXCEPTION 'Object type currently unsupported.'; + + -- unsupported obj_type + else id := null; + end case; + else + if not is_temp_object then + id := ( + select oid from pg_class where pg_catalog.lower(relname) = obj_name + and relnamespace = schema_oid + union + select oid from pg_constraint where pg_catalog.lower(conname) = obj_name + and connamespace = schema_oid + union + select oid from pg_proc where pg_catalog.lower(proname) = obj_name + and pronamespace = schema_oid + union + select oid from pg_trigger where pg_catalog.lower(tgname) = obj_name + limit 1 + ); + else + -- temp object without "object_type" in-argument + id := (select reloid from sys.babelfish_get_enr_list() where pg_catalog.lower(relname) collate sys.database_default = obj_name limit 1); + end if; + end if; + + RETURN id::integer; + END; + $BODY$ + LANGUAGE plpgsql STABLE RETURNS NULL ON NULL INPUT; + END IF; + + -- Update body of object_id_deprecated_in_3_1_0 to use PG_CATALOG.LEFT instead, if function exists + IF EXISTS(SELECT count(*) + FROM pg_proc p + JOIN pg_namespace nsp + ON p.pronamespace = nsp.oid + WHERE p.proname='object_id_deprecated_in_3_1_0' AND nsp.nspname='sys') THEN + + CREATE OR REPLACE FUNCTION sys.object_id_deprecated_in_3_1_0(IN object_name TEXT, IN object_type char(2) DEFAULT '') + RETURNS INTEGER AS + $BODY$ + DECLARE + id oid; + db_name text collate "C"; + bbf_schema_name text collate "C"; + schema_name text collate "C"; + schema_oid oid; + obj_name text collate "C"; + is_temp_object boolean; + obj_type char(2) collate "C"; + cs_as_object_name text collate "C" := object_name; + BEGIN + obj_type = object_type; + id = null; + schema_oid = NULL; + + SELECT s.db_name, s.schema_name, s.object_name INTO db_name, bbf_schema_name, obj_name + FROM babelfish_split_object_name(cs_as_object_name) s; + + -- Invalid object_name + IF obj_name IS NULL OR obj_name = '' collate sys.database_default THEN + RETURN NULL; + END IF; + + IF bbf_schema_name IS NULL OR bbf_schema_name = '' collate sys.database_default THEN + bbf_schema_name := sys.schema_name(); + END IF; + + schema_name := sys.bbf_get_current_physical_schema_name(bbf_schema_name); + + -- Check if looking for temp object. + is_temp_object = PG_CATALOG.left(obj_name, 1) = '#' collate sys.database_default; + + -- Can only search in current database. Allowing tempdb for temp objects. + IF db_name IS NOT NULL AND db_name collate sys.database_default <> db_name() AND db_name collate sys.database_default <> 'tempdb' THEN + RAISE EXCEPTION 'Can only do lookup in current database.'; + END IF; + + IF schema_name IS NULL OR schema_name = '' collate sys.database_default THEN + RETURN NULL; + END IF; + + -- Searching within a schema. Get schema oid. + schema_oid = (SELECT oid FROM pg_namespace WHERE nspname = schema_name); + IF schema_oid IS NULL THEN + RETURN NULL; + END IF; + + if obj_type <> '' then + case + -- Schema does not apply as much to temp objects. + when pg_catalog.upper(object_type) in ('S', 'U', 'V', 'IT', 'ET', 'SO') and is_temp_object then + id := (select reloid from sys.babelfish_get_enr_list() where pg_catalog.lower(relname) collate sys.database_default = obj_name limit 1); + + when pg_catalog.upper(object_type) in ('S', 'U', 'V', 'IT', 'ET', 'SO') and not is_temp_object then + id := (select oid from pg_class where pg_catalog.lower(relname) collate sys.database_default = obj_name + and relnamespace = schema_oid limit 1); + + when pg_catalog.upper(object_type) in ('C', 'D', 'F', 'PK', 'UQ') then + id := (select oid from pg_constraint where pg_catalog.lower(conname) collate sys.database_default = obj_name + and connamespace = schema_oid limit 1); + + when pg_catalog.upper(object_type) in ('AF', 'FN', 'FS', 'FT', 'IF', 'P', 'PC', 'TF', 'RF', 'X') then + id := (select oid from pg_proc where pg_catalog.lower(proname) collate sys.database_default = obj_name + and pronamespace = schema_oid limit 1); + + when pg_catalog.upper(object_type) in ('TR', 'TA') then + id := (select oid from pg_trigger where pg_catalog.lower(tgname) collate sys.database_default = obj_name limit 1); + + -- Throwing exception as a reminder to add support in the future. + when pg_catalog.upper(object_type) collate sys.database_default in ('R', 'EC', 'PG', 'SN', 'SQ', 'TT') then + RAISE EXCEPTION 'Object type currently unsupported.'; + + -- unsupported obj_type + else id := null; + end case; + else + if not is_temp_object then + id := ( + select oid from pg_class where pg_catalog.lower(relname) = obj_name + and relnamespace = schema_oid + union + select oid from pg_constraint where pg_catalog.lower(conname) = obj_name + and connamespace = schema_oid + union + select oid from pg_proc where pg_catalog.lower(proname) = obj_name + and pronamespace = schema_oid + union + select oid from pg_trigger where pg_catalog.lower(tgname) = obj_name + limit 1 + ); + else + -- temp object without "object_type" in-argument + id := (select reloid from sys.babelfish_get_enr_list() where pg_catalog.lower(relname) collate sys.database_default = obj_name limit 1); + end if; + end if; + + RETURN id::integer; + END; + $BODY$ + LANGUAGE plpgsql STABLE RETURNS NULL ON NULL INPUT; + END IF; +END; +$$; + +-- wrapper functions for TRIM +CREATE OR REPLACE FUNCTION sys.TRIM(string sys.BPCHAR) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.btrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.TRIM(string sys.VARCHAR) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.btrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.TRIM(string sys.NCHAR) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.btrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.TRIM(string sys.NVARCHAR) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.btrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.TRIM(string ANYELEMENT) +RETURNS sys.VARCHAR +AS +$BODY$ +DECLARE + string_arg_datatype text; + string_basetype oid; +BEGIN + string_arg_datatype := sys.translate_pg_type_to_tsql(pg_typeof(string)::oid); + IF string_arg_datatype IS NULL THEN + -- for User Defined Datatype, use immediate base type to check for argument datatype validation + string_basetype := sys.bbf_get_immediate_base_type_of_UDT(pg_typeof(string)::oid); + string_arg_datatype := sys.translate_pg_type_to_tsql(string_basetype); + END IF; + + -- restricting arguments with invalid datatypes for trim function + IF string_arg_datatype NOT IN ('char', 'varchar', 'nchar', 'nvarchar', 'text', 'ntext') THEN + RAISE EXCEPTION 'Argument data type % is invalid for argument 1 of Trim function.', string_arg_datatype; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.btrim(string::sys.varchar); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +-- Additional handling is added for TRIM function with 2 arguments, +-- hence only following two definitions are required. +CREATE OR REPLACE FUNCTION sys.TRIM(characters sys.VARCHAR, string sys.NVARCHAR) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.btrim(string, characters); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.TRIM(characters sys.VARCHAR, string sys.VARCHAR) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.btrim(string, characters); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- wrapper functions for LTRIM +CREATE OR REPLACE FUNCTION sys.LTRIM(string ANYELEMENT) +RETURNS sys.VARCHAR +AS +$BODY$ +DECLARE + string_arg_datatype text; + string_basetype oid; +BEGIN + string_arg_datatype := sys.translate_pg_type_to_tsql(pg_typeof(string)::oid); + IF string_arg_datatype IS NULL THEN + -- for User Defined Datatype, use immediate base type to check for argument datatype validation + string_basetype := sys.bbf_get_immediate_base_type_of_UDT(pg_typeof(string)::oid); + string_arg_datatype := sys.translate_pg_type_to_tsql(string_basetype); + END IF; + + -- restricting arguments with invalid datatypes for ltrim function + IF string_arg_datatype IN ('image', 'sql_variant', 'xml', 'geometry', 'geography') THEN + RAISE EXCEPTION 'Argument data type % is invalid for argument 1 of ltrim function.', string_arg_datatype; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.ltrim(string::sys.varchar); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.LTRIM(string sys.BPCHAR) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.ltrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.LTRIM(string sys.VARCHAR) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.ltrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.LTRIM(string sys.NCHAR) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.ltrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.LTRIM(string sys.NVARCHAR) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.ltrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Adding following definition will make sure that ltrim with text input +-- will use following definition instead of PG ltrim +CREATE OR REPLACE FUNCTION sys.LTRIM(string TEXT) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.ltrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Adding following definition will make sure that ltrim with ntext input +-- will use following definition instead of PG ltrim +CREATE OR REPLACE FUNCTION sys.LTRIM(string NTEXT) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.ltrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- wrapper functions for RTRIM +CREATE OR REPLACE FUNCTION sys.RTRIM(string ANYELEMENT) +RETURNS sys.VARCHAR +AS +$BODY$ +DECLARE + string_arg_datatype text; + string_basetype oid; +BEGIN + string_arg_datatype := sys.translate_pg_type_to_tsql(pg_typeof(string)::oid); + IF string_arg_datatype IS NULL THEN + -- for User Defined Datatype, use immediate base type to check for argument datatype validation + string_basetype := sys.bbf_get_immediate_base_type_of_UDT(pg_typeof(string)::oid); + string_arg_datatype := sys.translate_pg_type_to_tsql(string_basetype); + END IF; + + -- restricting arguments with invalid datatypes for rtrim function + IF string_arg_datatype IN ('image', 'sql_variant', 'xml', 'geometry', 'geography') THEN + RAISE EXCEPTION 'Argument data type % is invalid for argument 1 of rtrim function.', string_arg_datatype; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.rtrim(string::sys.varchar); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.RTRIM(string sys.BPCHAR) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.rtrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.RTRIM(string sys.VARCHAR) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.rtrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.RTRIM(string sys.NCHAR) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.rtrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.RTRIM(string sys.NVARCHAR) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.rtrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Adding following definition will make sure that rtrim with text input +-- will use following definition instead of PG rtrim +CREATE OR REPLACE FUNCTION sys.RTRIM(string TEXT) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.rtrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Adding following definition will make sure that rtrim with ntext input +-- will use following definition instead of PG rtrim +CREATE OR REPLACE FUNCTION sys.RTRIM(string NTEXT) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.rtrim(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + + +-- wrapper functions for LEFT +CREATE OR REPLACE FUNCTION sys.LEFT(string ANYELEMENT, i INTEGER) +RETURNS sys.VARCHAR +AS +$BODY$ +DECLARE + string_arg_datatype text; + string_basetype oid; +BEGIN + string_arg_datatype := sys.translate_pg_type_to_tsql(pg_typeof(string)::oid); + IF string_arg_datatype IS NULL THEN + -- for User Defined Datatype, use immediate base type to check for argument datatype validation + string_basetype := sys.bbf_get_immediate_base_type_of_UDT(pg_typeof(string)::oid); + string_arg_datatype := sys.translate_pg_type_to_tsql(string_basetype); + END IF; + + -- restricting arguments with invalid datatypes for left function + IF string_arg_datatype IN ('image', 'sql_variant', 'xml', 'geometry', 'geography') THEN + RAISE EXCEPTION 'Argument data type % is invalid for argument 1 of left function.', string_arg_datatype; + END IF; + + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the left function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.left(string::sys.varchar, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.LEFT(string sys.BPCHAR, i INTEGER) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the left function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.left(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.LEFT(string sys.VARCHAR, i INTEGER) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the left function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.left(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.LEFT(string sys.NCHAR, i INTEGER) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the left function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.left(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.LEFT(string sys.NVARCHAR, i INTEGER) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the left function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.left(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +-- Adding following definition will make sure that left with text input +-- will use following definition instead of PG left +CREATE OR REPLACE FUNCTION sys.LEFT(string TEXT, i INTEGER) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the left function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.left(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +-- Adding following definition will make sure that left with ntext input +-- will use following definition instead of PG left +CREATE OR REPLACE FUNCTION sys.LEFT(string NTEXT, i INTEGER) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the left function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.left(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + + +-- wrapper functions for RIGHT +CREATE OR REPLACE FUNCTION sys.RIGHT(string ANYELEMENT, i INTEGER) +RETURNS sys.VARCHAR +AS +$BODY$ +DECLARE + string_arg_datatype text; + string_basetype oid; +BEGIN + string_arg_datatype := sys.translate_pg_type_to_tsql(pg_typeof(string)::oid); + IF string_arg_datatype IS NULL THEN + -- for User Defined Datatype, use immediate base type to check for argument datatype validation + string_basetype := sys.bbf_get_immediate_base_type_of_UDT(pg_typeof(string)::oid); + string_arg_datatype := sys.translate_pg_type_to_tsql(string_basetype); + END IF; + + -- restricting arguments with invalid datatypes for right function + IF string_arg_datatype IN ('image', 'sql_variant', 'xml', 'geometry', 'geography') THEN + RAISE EXCEPTION 'Argument data type % is invalid for argument 1 of right function.', string_arg_datatype; + END IF; + + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the right function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + RETURN PG_CATALOG.right(string::sys.varchar, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.RIGHT(string sys.BPCHAR, i INTEGER) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the right function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.right(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.RIGHT(string sys.VARCHAR, i INTEGER) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the right function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.right(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.RIGHT(string sys.NCHAR, i INTEGER) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the right function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.right(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.RIGHT(string sys.NVARCHAR, i INTEGER) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the right function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.right(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +-- Adding following definition will make sure that right with text input +-- will use following definition instead of PG right +CREATE OR REPLACE FUNCTION sys.RIGHT(string TEXT, i INTEGER) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the right function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.right(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +-- Adding following definition will make sure that right with ntext input +-- will use following definition instead of PG right +CREATE OR REPLACE FUNCTION sys.RIGHT(string NTEXT, i INTEGER) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + IF i IS NULL THEN + RETURN NULL; + END IF; + + IF i < 0 THEN + RAISE EXCEPTION 'Invalid length parameter passed to the right function.'; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.right(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE PROCEDURE sys.sp_who( + IN "@loginame" sys.sysname DEFAULT NULL, + IN "@option" sys.VARCHAR(30) DEFAULT NULL) +LANGUAGE 'pltsql' +AS $$ +BEGIN + SET NOCOUNT ON + DECLARE @msg sys.VARCHAR(200) + DECLARE @show_pg BIT = 0 + DECLARE @hide_col sys.VARCHAR(50) + + IF @option IS NOT NULL + BEGIN + IF LOWER(TRIM(@option)) <> 'postgres' + BEGIN + RAISERROR('Parameter @option can only be ''postgres''', 16, 1) + RETURN + END + END + + -- Take a copy of sysprocesses so that we reference it only once + SELECT DISTINCT * INTO #sp_who_sysprocesses FROM sys.sysprocesses + + -- Get the executing statement for each spid and extract the main stmt type + -- This is for informational purposes only + SELECT pid, CAST(query AS sys.VARCHAR(MAX)) INTO #sp_who_tmp FROM pg_stat_activity pgsa + + UPDATE #sp_who_tmp SET query = ' ' + TRIM(CAST(UPPER(query) AS sys.VARCHAR(MAX))) + UPDATE #sp_who_tmp SET query = sys.REPLACE(query, chr(9), ' ') + UPDATE #sp_who_tmp SET query = sys.REPLACE(query, chr(10), ' ') + UPDATE #sp_who_tmp SET query = sys.REPLACE(query, chr(13), ' ') + WHILE (SELECT count(*) FROM #sp_who_tmp WHERE sys.CHARINDEX(' ',query)>0) > 0 + BEGIN + UPDATE #sp_who_tmp SET query = sys.REPLACE(query, ' ', ' ') + END + + -- Determine type of stmt to report by sp_who: very basic only + -- NB: not handling presence of comments in the query string + UPDATE #sp_who_tmp + SET query = + CASE + WHEN PATINDEX('%[^a-zA-Z0-9_]UPDATE[^a-zA-Z0-9_]%', query) > 0 THEN 'UPDATE' + WHEN PATINDEX('%[^a-zA-Z0-9_]DELETE[^a-zA-Z0-9_]%', query) > 0 THEN 'DELETE' + WHEN PATINDEX('%[^a-zA-Z0-9_]INSERT[^a-zA-Z0-9_]%', query) > 0 THEN 'INSERT' + WHEN PATINDEX('%[^a-zA-Z0-9_]SELECT[^a-zA-Z0-9_]%', query) > 0 THEN 'SELECT' + WHEN PATINDEX('%[^a-zA-Z0-9_]WAITFOR[^a-zA-Z0-9_]%', query) > 0 THEN 'WAITFOR' + WHEN PATINDEX('%[^a-zA-Z0-9_]CREATE ]%', query) > 0 THEN sys.SUBSTRING(query,1,sys.CHARINDEX('CREATE ', query)) + WHEN PATINDEX('%[^a-zA-Z0-9_]ALTER ]%', query) > 0 THEN sys.SUBSTRING(query,1,sys.CHARINDEX('ALTER ', query)) + WHEN PATINDEX('%[^a-zA-Z0-9_]DROP ]%', query) > 0 THEN sys.SUBSTRING(query,1,sys.CHARINDEX('DROP ', query)) + ELSE sys.SUBSTRING(query, 1, sys.CHARINDEX(' ', query)) + END + + UPDATE #sp_who_tmp + SET query = sys.SUBSTRING(query,1, 8-1 + sys.CHARINDEX(' ', sys.SUBSTRING(query,8,99))) + WHERE query LIKE 'CREATE %' OR query LIKE 'ALTER %' OR query LIKE 'DROP %' + + -- The executing spid is always shown as doing a SELECT + UPDATE #sp_who_tmp SET query = 'SELECT' WHERE pid = @@spid + UPDATE #sp_who_tmp SET query = TRIM(query) + + -- Get all current connections + SELECT + spid, + MAX(blocked) AS blocked, + 0 AS ecid, + CAST('' AS sys.VARCHAR(100)) AS status, + CAST('' AS sys.VARCHAR(100)) AS loginname, + CAST('' AS sys.VARCHAR(100)) AS hostname, + 0 AS dbid, + CAST('' AS sys.VARCHAR(100)) AS cmd, + 0 AS request_id, + CAST('TDS' AS sys.VARCHAR(20)) AS connection, + hostprocess + INTO #sp_who_proc + FROM #sp_who_sysprocesses + GROUP BY spid, status, hostprocess + + -- Add attributes to each connection + UPDATE #sp_who_proc + SET ecid = sp.ecid, + status = sp.status, + loginname = sp.loginname, + hostname = sp.hostname, + dbid = sp.dbid, + request_id = sp.request_id + FROM #sp_who_sysprocesses sp + WHERE #sp_who_proc.spid = sp.spid + + -- Identify PG connections: the hostprocess PID comes from the TDS login packet + -- and therefore PG connections do not have a value here + UPDATE #sp_who_proc + SET connection = 'PostgreSQL' + WHERE hostprocess IS NULL + + -- Keep or delete PG connections + IF (LOWER(@loginame) = 'postgres' OR LOWER(@option) = 'postgres') + begin + -- Show PG connections; these have dbid = 0 + -- This is a Babelfish-specific enhancement, since PG connections may also be active in the Babelfish DB + -- and it may be useful to see these displayed + SET @show_pg = 1 + + -- blank out the loginame parameter for the tests below + IF LOWER(@loginame) = 'postgres' SET @loginame = NULL + END + + -- By default, do not show the column indicating the connection type since SQL Server does not have this column + SET @hide_col = 'connection' + + IF (@show_pg = 1) + BEGIN + SET @hide_col = '' + END + ELSE + BEGIN + -- Delete PG connections + DELETE #sp_who_proc + WHERE dbid = 0 + END + + -- Apply filter if specified + IF (@loginame IS NOT NULL) + BEGIN + IF (TRIM(@loginame) = '') + BEGIN + -- Raise error + SET @msg = ''''+@loginame+''' is not a valid login or you do not have permission.' + RAISERROR(@msg, 16, 1) + RETURN + END + + IF (sys.ISNUMERIC(@loginame) = 1) + BEGIN + -- Remove all connections except the specified one + DELETE #sp_who_proc + WHERE spid <> CAST(@loginame AS INT) + END + ELSE + BEGIN + IF (LOWER(@loginame) = 'active') + BEGIN + -- Remove all 'idle' connections + DELETE #sp_who_proc + WHERE status = 'idle' + END + ELSE + BEGIN + -- Verify the specified login name exists + IF (sys.SUSER_ID(@loginame) IS NULL) + BEGIN + SET @msg = ''''+@loginame+''' is not a valid login or you do not have permission.' + RAISERROR(@msg, 16, 1) + RETURN + END + ELSE + BEGIN + -- Keep only connections for the specified login + DELETE #sp_who_proc + WHERE sys.SUSER_ID(loginname) <> sys.SUSER_ID(@loginame) + END + END + END + END + + -- Create final result set; use DISTINCT since there are usually duplicate rows from the PG catalogs + SELECT distinct + p.spid AS spid, + p.ecid AS ecid, + CAST(LEFT(p.status,20) AS sys.VARCHAR(20)) AS status, + CAST(LEFT(p.loginname,40) AS sys.VARCHAR(40)) AS loginame, + CAST(LEFT(p.hostname,60) AS sys.VARCHAR(60)) AS hostname, + p.blocked AS blk, + CAST(LEFT(db_name(p.dbid),40) AS sys.VARCHAR(40)) AS dbname, + CAST(LEFT(#sp_who_tmp.query,30)as sys.VARCHAR(30)) AS cmd, + p.request_id AS request_id, + connection + INTO #sp_who_tmp2 + FROM #sp_who_proc p, #sp_who_tmp + WHERE p.spid = #sp_who_tmp.pid + ORDER BY spid + + -- Patch up remaining cases + UPDATE #sp_who_tmp2 + SET cmd = 'AWAITING COMMAND' + WHERE TRIM(ISNULL(cmd,'')) = '' AND status = 'idle' + + UPDATE #sp_who_tmp2 + SET cmd = 'UNKNOWN' + WHERE TRIM(cmd) = '' + + -- Format the result set as narrow as possible for readability + SET @hide_col += ',hostprocess' + EXECUTE sys.sp_babelfish_autoformat @tab='#sp_who_tmp2', @orderby='ORDER BY spid', @hiddencols=@hide_col, @printrc=0 + RETURN +END +$$; +GRANT EXECUTE ON PROCEDURE sys.sp_who(IN sys.sysname, IN sys.VARCHAR(30)) TO PUBLIC; + +CREATE OR REPLACE PROCEDURE sys.sp_stored_procedures( + "@sp_name" sys.nvarchar(390) = '', + "@sp_owner" sys.nvarchar(384) = '', + "@sp_qualifier" sys.sysname = '', + "@fusepattern" sys.bit = '1' +) +AS $$ +BEGIN + IF (@sp_qualifier != '') AND LOWER(sys.db_name()) != LOWER(@sp_qualifier) + BEGIN + THROW 33557097, N'The database name component of the object qualifier must be the name of the current database.', 1; + END + + -- If @sp_name or @sp_owner = '%', it gets converted to NULL or '' regardless of @fusepattern + IF @sp_name = '%' + BEGIN + SELECT @sp_name = '' + END + + IF @sp_owner = '%' + BEGIN + SELECT @sp_owner = '' + END + + -- Changes fusepattern to 0 if no wildcards are used. NOTE: Need to add [] wildcard pattern when it is implemented. Wait for BABEL-2452 + IF @fusepattern = 1 + BEGIN + IF (CHARINDEX('%', @sp_name) != 0 AND CHARINDEX('_', @sp_name) != 0 AND CHARINDEX('%', @sp_owner) != 0 AND CHARINDEX('_', @sp_owner) != 0 ) + BEGIN + SELECT @fusepattern = 0; + END + END + + -- Condition for when sp_name argument is not given or is null, or is just a wildcard (same order) + IF COALESCE(@sp_name, '') = '' + BEGIN + IF @fusepattern=1 + BEGIN + SELECT + PROCEDURE_QUALIFIER, + PROCEDURE_OWNER, + PROCEDURE_NAME, + NUM_INPUT_PARAMS, + NUM_OUTPUT_PARAMS, + NUM_RESULT_SETS, + REMARKS, + PROCEDURE_TYPE FROM sys.sp_stored_procedures_view + WHERE ((SELECT COALESCE(@sp_owner,'')) = '' OR LOWER(procedure_owner) LIKE LOWER(@sp_owner)) + ORDER BY procedure_qualifier, procedure_owner, procedure_name; + END + ELSE + BEGIN + SELECT + PROCEDURE_QUALIFIER, + PROCEDURE_OWNER, + PROCEDURE_NAME, + NUM_INPUT_PARAMS, + NUM_OUTPUT_PARAMS, + NUM_RESULT_SETS, + REMARKS, + PROCEDURE_TYPE FROM sys.sp_stored_procedures_view + WHERE ((SELECT COALESCE(@sp_owner,'')) = '' OR LOWER(procedure_owner) LIKE LOWER(@sp_owner)) + ORDER BY procedure_qualifier, procedure_owner, procedure_name; + END + END + -- When @sp_name is not null + ELSE + BEGIN + -- When sp_owner is null and fusepattern = 0 + IF (@fusepattern = 0 AND COALESCE(@sp_owner,'') = '') + BEGIN + IF EXISTS ( -- Search in the sys schema + SELECT * FROM sys.sp_stored_procedures_view + WHERE (LOWER(LEFT(procedure_name, LEN(procedure_name)-2)) = LOWER(@sp_name)) + AND (LOWER(procedure_owner) = 'sys')) + BEGIN + SELECT PROCEDURE_QUALIFIER, + PROCEDURE_OWNER, + PROCEDURE_NAME, + NUM_INPUT_PARAMS, + NUM_OUTPUT_PARAMS, + NUM_RESULT_SETS, + REMARKS, + PROCEDURE_TYPE FROM sys.sp_stored_procedures_view + WHERE (LOWER(LEFT(procedure_name, LEN(procedure_name)-2)) = LOWER(@sp_name)) + AND (LOWER(procedure_owner) = 'sys') + ORDER BY procedure_qualifier, procedure_owner, procedure_name; + END + ELSE IF EXISTS ( + SELECT * FROM sys.sp_stored_procedures_view + WHERE (LOWER(LEFT(procedure_name, LEN(procedure_name)-2)) = LOWER(@sp_name)) + AND (LOWER(procedure_owner) = LOWER(SCHEMA_NAME())) + ) + BEGIN + SELECT PROCEDURE_QUALIFIER, + PROCEDURE_OWNER, + PROCEDURE_NAME, + NUM_INPUT_PARAMS, + NUM_OUTPUT_PARAMS, + NUM_RESULT_SETS, + REMARKS, + PROCEDURE_TYPE FROM sys.sp_stored_procedures_view + WHERE (LOWER(LEFT(procedure_name, LEN(procedure_name)-2)) = LOWER(@sp_name)) + AND (LOWER(procedure_owner) = LOWER(SCHEMA_NAME())) + ORDER BY procedure_qualifier, procedure_owner, procedure_name; + END + ELSE -- Search in the dbo schema (if nothing exists it should just return nothing). + BEGIN + SELECT PROCEDURE_QUALIFIER, + PROCEDURE_OWNER, + PROCEDURE_NAME, + NUM_INPUT_PARAMS, + NUM_OUTPUT_PARAMS, + NUM_RESULT_SETS, + REMARKS, + PROCEDURE_TYPE FROM sys.sp_stored_procedures_view + WHERE (LOWER(LEFT(procedure_name, LEN(procedure_name)-2)) = LOWER(@sp_name)) + AND (LOWER(procedure_owner) = 'dbo') + ORDER BY procedure_qualifier, procedure_owner, procedure_name; + END + + END + ELSE IF (@fusepattern = 0 AND COALESCE(@sp_owner,'') != '') + BEGIN + SELECT + PROCEDURE_QUALIFIER, + PROCEDURE_OWNER, + PROCEDURE_NAME, + NUM_INPUT_PARAMS, + NUM_OUTPUT_PARAMS, + NUM_RESULT_SETS, + REMARKS, + PROCEDURE_TYPE FROM sys.sp_stored_procedures_view + WHERE (LOWER(LEFT(procedure_name, LEN(procedure_name)-2)) = LOWER(@sp_name)) + AND (LOWER(procedure_owner) = LOWER(@sp_owner)) + ORDER BY procedure_qualifier, procedure_owner, procedure_name; + END + ELSE -- fusepattern = 1 + BEGIN + SELECT + PROCEDURE_QUALIFIER, + PROCEDURE_OWNER, + PROCEDURE_NAME, + NUM_INPUT_PARAMS, + NUM_OUTPUT_PARAMS, + NUM_RESULT_SETS, + REMARKS, + PROCEDURE_TYPE FROM sys.sp_stored_procedures_view + WHERE ((SELECT COALESCE(@sp_name,'')) = '' OR LOWER(LEFT(procedure_name, LEN(procedure_name)-2)) LIKE LOWER(@sp_name)) + AND ((SELECT COALESCE(@sp_owner,'')) = '' OR LOWER(procedure_owner) LIKE LOWER(@sp_owner)) + ORDER BY procedure_qualifier, procedure_owner, procedure_name; + END + END +END; +$$ +LANGUAGE 'pltsql'; +GRANT EXECUTE on PROCEDURE sys.sp_stored_procedures TO PUBLIC; + +CREATE OR REPLACE FUNCTION sys.babelfish_conv_date_to_string(IN p_datatype TEXT, + IN p_dateval DATE, + IN p_style NUMERIC DEFAULT 20) +RETURNS TEXT +AS +$BODY$ +DECLARE + v_day VARCHAR COLLATE "C"; + v_dateval DATE; + v_style SMALLINT; + v_month SMALLINT; + v_resmask VARCHAR COLLATE "C"; + v_datatype VARCHAR COLLATE "C"; + v_language VARCHAR COLLATE "C"; + v_monthname VARCHAR COLLATE "C"; + v_resstring VARCHAR COLLATE "C"; + v_lengthexpr VARCHAR COLLATE "C"; + v_maxlength SMALLINT; + v_res_length SMALLINT; + v_err_message VARCHAR COLLATE "C"; + v_res_datatype VARCHAR COLLATE "C"; + v_lang_metadata_json JSONB; + VARCHAR_MAX CONSTANT SMALLINT := 8000; + NVARCHAR_MAX CONSTANT SMALLINT := 4000; + CONVERSION_LANG CONSTANT VARCHAR COLLATE "C" := ''; + DATATYPE_REGEXP CONSTANT VARCHAR COLLATE "C" := '^\s*(CHAR|NCHAR|VARCHAR|NVARCHAR|CHARACTER VARYING)\s*$'; + DATATYPE_MASK_REGEXP CONSTANT VARCHAR COLLATE "C" := '^\s*(?:CHAR|NCHAR|VARCHAR|NVARCHAR|CHARACTER VARYING)\s*\(\s*(\d+|MAX)\s*\)\s*$'; +BEGIN + v_datatype := pg_catalog.upper(trim(p_datatype)); + v_style := floor(p_style)::SMALLINT; + + IF (scale(p_style) > 0) THEN + RAISE most_specific_type_mismatch; + ELSIF (NOT ((v_style BETWEEN 0 AND 13) OR + (v_style BETWEEN 20 AND 25) OR + (v_style BETWEEN 100 AND 113) OR + v_style IN (120, 121, 126, 127, 130, 131))) + THEN + RAISE invalid_parameter_value; + ELSIF (v_style IN (8, 24, 108)) THEN + RAISE invalid_datetime_format; + END IF; + + IF (v_datatype ~* DATATYPE_MASK_REGEXP) THEN + v_res_datatype := PG_CATALOG.rtrim(split_part(v_datatype, '(', 1)); + + v_maxlength := CASE + WHEN (v_res_datatype IN ('CHAR', 'VARCHAR')) THEN VARCHAR_MAX + ELSE NVARCHAR_MAX + END; + + v_lengthexpr := substring(v_datatype, DATATYPE_MASK_REGEXP); + + IF (v_lengthexpr <> 'MAX' AND char_length(v_lengthexpr) > 4) THEN + RAISE interval_field_overflow; + END IF; + + v_res_length := CASE v_lengthexpr + WHEN 'MAX' THEN v_maxlength + ELSE v_lengthexpr::SMALLINT + END; + ELSIF (v_datatype ~* DATATYPE_REGEXP) THEN + v_res_datatype := v_datatype; + ELSE + RAISE datatype_mismatch; + END IF; + + v_dateval := CASE + WHEN (v_style NOT IN (130, 131)) THEN p_dateval + ELSE sys.babelfish_conv_greg_to_hijri(p_dateval) + 1 + END; + + v_day := PG_CATALOG.ltrim(to_char(v_dateval, 'DD'), '0'); + v_month := to_char(v_dateval, 'MM')::SMALLINT; + + v_language := CASE + WHEN (v_style IN (130, 131)) THEN 'HIJRI' + ELSE CONVERSION_LANG + END; + RAISE NOTICE 'v_language=[%]', v_language; + BEGIN + v_lang_metadata_json := sys.babelfish_get_lang_metadata_json(v_language); + EXCEPTION + WHEN OTHERS THEN + RAISE invalid_character_value_for_cast; + END; + + v_monthname := (v_lang_metadata_json -> 'months_shortnames') ->> v_month - 1; + + v_resmask := CASE + WHEN (v_style IN (1, 22)) THEN 'MM/DD/YY' + WHEN (v_style = 101) THEN 'MM/DD/YYYY' + WHEN (v_style = 2) THEN 'YY.MM.DD' + WHEN (v_style = 102) THEN 'YYYY.MM.DD' + WHEN (v_style = 3) THEN 'DD/MM/YY' + WHEN (v_style = 103) THEN 'DD/MM/YYYY' + WHEN (v_style = 4) THEN 'DD.MM.YY' + WHEN (v_style = 104) THEN 'DD.MM.YYYY' + WHEN (v_style = 5) THEN 'DD-MM-YY' + WHEN (v_style = 105) THEN 'DD-MM-YYYY' + WHEN (v_style = 6) THEN 'DD $mnme$ YY' + WHEN (v_style IN (13, 106, 113)) THEN 'DD $mnme$ YYYY' + WHEN (v_style = 7) THEN '$mnme$ DD, YY' + WHEN (v_style = 107) THEN '$mnme$ DD, YYYY' + WHEN (v_style = 10) THEN 'MM-DD-YY' + WHEN (v_style = 110) THEN 'MM-DD-YYYY' + WHEN (v_style = 11) THEN 'YY/MM/DD' + WHEN (v_style = 111) THEN 'YYYY/MM/DD' + WHEN (v_style = 12) THEN 'YYMMDD' + WHEN (v_style = 112) THEN 'YYYYMMDD' + WHEN (v_style IN (20, 21, 23, 25, 120, 121, 126, 127)) THEN 'YYYY-MM-DD' + WHEN (v_style = 130) THEN 'DD $mnme$ YYYY' + WHEN (v_style = 131) THEN pg_catalog.format('%s/MM/YYYY', lpad(v_day, 2, ' ')) + WHEN (v_style IN (0, 9, 100, 109)) THEN pg_catalog.format('$mnme$ %s YYYY', lpad(v_day, 2, ' ')) + END; + + v_resstring := to_char(v_dateval, v_resmask); + v_resstring := pg_catalog.replace(v_resstring, '$mnme$', v_monthname); + v_resstring := substring(v_resstring, 1, coalesce(v_res_length, char_length(v_resstring))); + v_res_length := coalesce(v_res_length, + CASE v_res_datatype + WHEN 'CHAR' THEN 30 + ELSE 60 + END); + RETURN CASE + WHEN (v_res_datatype NOT IN ('CHAR', 'NCHAR')) THEN v_resstring + ELSE rpad(v_resstring, v_res_length, ' ') + END; +EXCEPTION + WHEN most_specific_type_mismatch THEN + RAISE USING MESSAGE := 'Argument data type NUMERIC is invalid for argument 3 of convert function.', + DETAIL := 'Use of incorrect "style" parameter value during conversion process.', + HINT := 'Change "style" parameter to the proper value and try again.'; + + WHEN invalid_parameter_value THEN + RAISE USING MESSAGE := pg_catalog.format('%s is not a valid style number when converting from DATE to a character string.', v_style), + DETAIL := 'Use of incorrect "style" parameter value during conversion process.', + HINT := 'Change "style" parameter to the proper value and try again.'; + + WHEN invalid_datetime_format THEN + RAISE USING MESSAGE := pg_catalog.format('Error converting data type DATE to %s.', trim(p_datatype)), + DETAIL := 'Incorrect using of pair of input parameters values during conversion process.', + HINT := 'Check the input parameters values, correct them if needed, and try again.'; + + WHEN interval_field_overflow THEN + RAISE USING MESSAGE := pg_catalog.format('The size (%s) given to the convert specification ''%s'' exceeds the maximum allowed for any data type (%s).', + v_lengthexpr, + pg_catalog.lower(v_res_datatype), + v_maxlength), + DETAIL := 'Use of incorrect size value of data type parameter during conversion process.', + HINT := 'Change size component of data type parameter to the allowable value and try again.'; + + WHEN datatype_mismatch THEN + RAISE USING MESSAGE := 'Data type should be one of these values: ''CHAR(n|MAX)'', ''NCHAR(n|MAX)'', ''VARCHAR(n|MAX)'', ''NVARCHAR(n|MAX)''.', + DETAIL := 'Use of incorrect "datatype" parameter value during conversion process.', + HINT := 'Change "datatype" parameter to the proper value and try again.'; + + WHEN invalid_character_value_for_cast THEN + RAISE USING MESSAGE := pg_catalog.format('Invalid CONVERSION_LANG constant value - ''%s''. Allowed values are: ''English'', ''Deutsch'', etc.', + CONVERSION_LANG), + DETAIL := 'Compiled incorrect CONVERSION_LANG constant value in function''s body.', + HINT := 'Correct CONVERSION_LANG constant value in function''s body, recompile it and try again.'; + + WHEN invalid_text_representation THEN + GET STACKED DIAGNOSTICS v_err_message = MESSAGE_TEXT; + v_err_message := substring(pg_catalog.lower(v_err_message), 'integer\:\s\"(.*)\"'); + + RAISE USING MESSAGE := pg_catalog.format('Error while trying to convert "%s" value to SMALLINT (or INTEGER) data type.', + v_err_message), + DETAIL := 'Supplied value contains illegal characters.', + HINT := 'Correct supplied value, remove all illegal characters.'; +END; +$BODY$ +LANGUAGE plpgsql +STABLE +RETURNS NULL ON NULL INPUT; + +CREATE OR REPLACE FUNCTION sys.babelfish_conv_datetime_to_string(IN p_datatype TEXT, + IN p_src_datatype TEXT, + IN p_datetimeval TIMESTAMP(6) WITHOUT TIME ZONE, + IN p_style NUMERIC DEFAULT -1) +RETURNS TEXT +AS +$BODY$ +DECLARE + v_day VARCHAR COLLATE "C"; + v_hour VARCHAR COLLATE "C"; + v_month SMALLINT; + v_style SMALLINT; + v_scale SMALLINT; + v_resmask VARCHAR COLLATE "C"; + v_language VARCHAR COLLATE "C"; + v_datatype VARCHAR COLLATE "C"; + v_fseconds VARCHAR COLLATE "C"; + v_fractsep VARCHAR COLLATE "C"; + v_monthname VARCHAR COLLATE "C"; + v_resstring VARCHAR COLLATE "C"; + v_lengthexpr VARCHAR COLLATE "C"; + v_maxlength SMALLINT; + v_res_length SMALLINT; + v_err_message VARCHAR COLLATE "C"; + v_src_datatype VARCHAR COLLATE "C"; + v_res_datatype VARCHAR COLLATE "C"; + v_lang_metadata_json JSONB; + VARCHAR_MAX CONSTANT SMALLINT := 8000; + NVARCHAR_MAX CONSTANT SMALLINT := 4000; + CONVERSION_LANG CONSTANT VARCHAR COLLATE "C" := ''; + DATATYPE_REGEXP CONSTANT VARCHAR COLLATE "C" := '^\s*(CHAR|NCHAR|VARCHAR|NVARCHAR|CHARACTER VARYING)\s*$'; + SRCDATATYPE_MASK_REGEXP VARCHAR COLLATE "C" := '^(?:DATETIME|SMALLDATETIME|DATETIME2)\s*(?:\s*\(\s*(\d+)\s*\)\s*)?$'; + DATATYPE_MASK_REGEXP CONSTANT VARCHAR COLLATE "C" := '^\s*(?:CHAR|NCHAR|VARCHAR|NVARCHAR|CHARACTER VARYING)\s*\(\s*(\d+|MAX)\s*\)\s*$'; + v_datetimeval TIMESTAMP(6) WITHOUT TIME ZONE; +BEGIN + v_datatype := pg_catalog.upper(trim(p_datatype)); + v_src_datatype := pg_catalog.upper(trim(p_src_datatype)); + v_style := floor(p_style)::SMALLINT; + + IF (v_src_datatype ~* SRCDATATYPE_MASK_REGEXP) + THEN + v_scale := substring(v_src_datatype, SRCDATATYPE_MASK_REGEXP)::SMALLINT; + + v_src_datatype := PG_CATALOG.rtrim(split_part(v_src_datatype, '(', 1)); + + IF (v_src_datatype <> 'DATETIME2' AND v_scale IS NOT NULL) THEN + RAISE invalid_indicator_parameter_value; + ELSIF (v_scale NOT BETWEEN 0 AND 7) THEN + RAISE invalid_regular_expression; + END IF; + + v_scale := coalesce(v_scale, 7); + ELSE + RAISE most_specific_type_mismatch; + END IF; + + IF (scale(p_style) > 0) THEN + RAISE escape_character_conflict; + ELSIF (NOT ((v_style BETWEEN 0 AND 14) OR + (v_style BETWEEN 20 AND 25) OR + (v_style BETWEEN 100 AND 114) OR + v_style IN (-1, 120, 121, 126, 127, 130, 131))) + THEN + RAISE invalid_parameter_value; + END IF; + + IF (v_datatype ~* DATATYPE_MASK_REGEXP) THEN + v_res_datatype := PG_CATALOG.rtrim(split_part(v_datatype, '(', 1)); + + v_maxlength := CASE + WHEN (v_res_datatype IN ('CHAR', 'VARCHAR')) THEN VARCHAR_MAX + ELSE NVARCHAR_MAX + END; + + v_lengthexpr := substring(v_datatype, DATATYPE_MASK_REGEXP); + + IF (v_lengthexpr <> 'MAX' AND char_length(v_lengthexpr) > 4) + THEN + RAISE interval_field_overflow; + END IF; + + v_res_length := CASE v_lengthexpr + WHEN 'MAX' THEN v_maxlength + ELSE v_lengthexpr::SMALLINT + END; + ELSIF (v_datatype ~* DATATYPE_REGEXP) THEN + v_res_datatype := v_datatype; + ELSE + RAISE datatype_mismatch; + END IF; + + v_datetimeval := CASE + WHEN (v_style NOT IN (130, 131)) THEN p_datetimeval + ELSE sys.babelfish_conv_greg_to_hijri(p_datetimeval) + INTERVAL '1 day' + END; + + v_day := PG_CATALOG.ltrim(to_char(v_datetimeval, 'DD'), '0'); + v_hour := PG_CATALOG.ltrim(to_char(v_datetimeval, 'HH12'), '0'); + v_month := to_char(v_datetimeval, 'MM')::SMALLINT; + + v_language := CASE + WHEN (v_style IN (130, 131)) THEN 'HIJRI' + ELSE CONVERSION_LANG + END; + BEGIN + v_lang_metadata_json := sys.babelfish_get_lang_metadata_json(v_language); + EXCEPTION + WHEN OTHERS THEN + RAISE invalid_character_value_for_cast; + END; + + v_monthname := (v_lang_metadata_json -> 'months_shortnames') ->> v_month - 1; + + IF (v_src_datatype IN ('DATETIME', 'SMALLDATETIME')) THEN + v_fseconds := sys.babelfish_round_fractseconds(to_char(v_datetimeval, 'MS')); + + IF (v_fseconds::INTEGER = 1000) THEN + v_fseconds := '000'; + v_datetimeval := v_datetimeval + INTERVAL '1 second'; + ELSE + v_fseconds := lpad(v_fseconds, 3, '0'); + END IF; + ELSE + v_fseconds := sys.babelfish_get_microsecs_from_fractsecs(to_char(v_datetimeval, 'US'), v_scale); + + IF (v_scale = 7) THEN + v_fseconds := concat(v_fseconds, '0'); + END IF; + END IF; + + v_fractsep := CASE v_src_datatype + WHEN 'DATETIME2' THEN '.' + ELSE ':' + END; + + IF ((v_style = -1 AND v_src_datatype <> 'DATETIME2') OR + v_style IN (0, 9, 100, 109)) + THEN + v_resmask := pg_catalog.format('$mnme$ %s YYYY %s:MI%s', + lpad(v_day, 2, ' '), + lpad(v_hour, 2, ' '), + CASE + WHEN (v_style IN (-1, 0, 100)) THEN 'AM' + ELSE pg_catalog.format(':SS:%sAM', v_fseconds) + END); + ELSIF (v_style = 1) THEN + v_resmask := 'MM/DD/YY'; + ELSIF (v_style = 101) THEN + v_resmask := 'MM/DD/YYYY'; + ELSIF (v_style = 2) THEN + v_resmask := 'YY.MM.DD'; + ELSIF (v_style = 102) THEN + v_resmask := 'YYYY.MM.DD'; + ELSIF (v_style = 3) THEN + v_resmask := 'DD/MM/YY'; + ELSIF (v_style = 103) THEN + v_resmask := 'DD/MM/YYYY'; + ELSIF (v_style = 4) THEN + v_resmask := 'DD.MM.YY'; + ELSIF (v_style = 104) THEN + v_resmask := 'DD.MM.YYYY'; + ELSIF (v_style = 5) THEN + v_resmask := 'DD-MM-YY'; + ELSIF (v_style = 105) THEN + v_resmask := 'DD-MM-YYYY'; + ELSIF (v_style = 6) THEN + v_resmask := 'DD $mnme$ YY'; + ELSIF (v_style = 106) THEN + v_resmask := 'DD $mnme$ YYYY'; + ELSIF (v_style = 7) THEN + v_resmask := '$mnme$ DD, YY'; + ELSIF (v_style = 107) THEN + v_resmask := '$mnme$ DD, YYYY'; + ELSIF (v_style IN (8, 24, 108)) THEN + v_resmask := 'HH24:MI:SS'; + ELSIF (v_style = 10) THEN + v_resmask := 'MM-DD-YY'; + ELSIF (v_style = 110) THEN + v_resmask := 'MM-DD-YYYY'; + ELSIF (v_style = 11) THEN + v_resmask := 'YY/MM/DD'; + ELSIF (v_style = 111) THEN + v_resmask := 'YYYY/MM/DD'; + ELSIF (v_style = 12) THEN + v_resmask := 'YYMMDD'; + ELSIF (v_style = 112) THEN + v_resmask := 'YYYYMMDD'; + ELSIF (v_style IN (13, 113)) THEN + v_resmask := pg_catalog.format('DD $mnme$ YYYY HH24:MI:SS%s%s', v_fractsep, v_fseconds); + ELSIF (v_style IN (14, 114)) THEN + v_resmask := pg_catalog.format('HH24:MI:SS%s%s', v_fractsep, v_fseconds); + ELSIF (v_style IN (20, 120)) THEN + v_resmask := 'YYYY-MM-DD HH24:MI:SS'; + ELSIF ((v_style = -1 AND v_src_datatype = 'DATETIME2') OR + v_style IN (21, 25, 121)) + THEN + v_resmask := pg_catalog.format('YYYY-MM-DD HH24:MI:SS.%s', v_fseconds); + ELSIF (v_style = 22) THEN + v_resmask := pg_catalog.format('MM/DD/YY %s:MI:SS AM', lpad(v_hour, 2, ' ')); + ELSIF (v_style = 23) THEN + v_resmask := 'YYYY-MM-DD'; + ELSIF (v_style IN (126, 127)) THEN + v_resmask := CASE v_src_datatype + WHEN 'SMALLDATETIME' THEN 'YYYY-MM-DDT$rem$HH24:MI:SS' + ELSE pg_catalog.format('YYYY-MM-DDT$rem$HH24:MI:SS.%s', v_fseconds) + END; + ELSIF (v_style IN (130, 131)) THEN + v_resmask := concat(CASE p_style + WHEN 131 THEN pg_catalog.format('%s/MM/YYYY ', lpad(v_day, 2, ' ')) + ELSE pg_catalog.format('%s $mnme$ YYYY ', lpad(v_day, 2, ' ')) + END, + pg_catalog.format('%s:MI:SS%s%sAM', lpad(v_hour, 2, ' '), v_fractsep, v_fseconds)); + END IF; + + v_resstring := to_char(v_datetimeval, v_resmask); + v_resstring := pg_catalog.replace(v_resstring, '$mnme$', v_monthname); + v_resstring := pg_catalog.replace(v_resstring, '$rem$', ''); + + v_resstring := substring(v_resstring, 1, coalesce(v_res_length, char_length(v_resstring))); + v_res_length := coalesce(v_res_length, + CASE v_res_datatype + WHEN 'CHAR' THEN 30 + ELSE 60 + END); + RETURN CASE + WHEN (v_res_datatype NOT IN ('CHAR', 'NCHAR')) THEN v_resstring + ELSE rpad(v_resstring, v_res_length, ' ') + END; +EXCEPTION + WHEN most_specific_type_mismatch THEN + RAISE USING MESSAGE := 'Source data type should be one of these values: ''DATETIME'', ''SMALLDATETIME'', ''DATETIME2'' or ''DATETIME2(n)''.', + DETAIL := 'Use of incorrect "src_datatype" parameter value during conversion process.', + HINT := 'Change "srcdatatype" parameter to the proper value and try again.'; + + WHEN invalid_regular_expression THEN + RAISE USING MESSAGE := pg_catalog.format('The source data type scale (%s) given to the convert specification exceeds the maximum allowable value (7).', + v_scale), + DETAIL := 'Use of incorrect scale value of source data type parameter during conversion process.', + HINT := 'Change scale component of source data type parameter to the allowable value and try again.'; + + WHEN invalid_indicator_parameter_value THEN + RAISE USING MESSAGE := pg_catalog.format('Invalid attributes specified for data type %s.', v_src_datatype), + DETAIL := 'Use of incorrect scale value, which is not corresponding to specified data type.', + HINT := 'Change data type scale component or select different data type and try again.'; + + WHEN escape_character_conflict THEN + RAISE USING MESSAGE := 'Argument data type NUMERIC is invalid for argument 4 of convert function.', + DETAIL := 'Use of incorrect "style" parameter value during conversion process.', + HINT := 'Change "style" parameter to the proper value and try again.'; + + WHEN invalid_parameter_value THEN + RAISE USING MESSAGE := pg_catalog.format('%s is not a valid style number when converting from %s to a character string.', + v_style, v_src_datatype), + DETAIL := 'Use of incorrect "style" parameter value during conversion process.', + HINT := 'Change "style" parameter to the proper value and try again.'; + + WHEN interval_field_overflow THEN + RAISE USING MESSAGE := pg_catalog.format('The size (%s) given to the convert specification ''%s'' exceeds the maximum allowed for any data type (%s).', + v_lengthexpr, pg_catalog.lower(v_res_datatype), v_maxlength), + DETAIL := 'Use of incorrect size value of data type parameter during conversion process.', + HINT := 'Change size component of data type parameter to the allowable value and try again.'; + + WHEN datatype_mismatch THEN + RAISE USING MESSAGE := 'Data type should be one of these values: ''CHAR(n|MAX)'', ''NCHAR(n|MAX)'', ''VARCHAR(n|MAX)'', ''NVARCHAR(n|MAX)''.', + DETAIL := 'Use of incorrect "datatype" parameter value during conversion process.', + HINT := 'Change "datatype" parameter to the proper value and try again.'; + + WHEN invalid_character_value_for_cast THEN + RAISE USING MESSAGE := pg_catalog.format('Invalid CONVERSION_LANG constant value - ''%s''. Allowed values are: ''English'', ''Deutsch'', etc.', + CONVERSION_LANG), + DETAIL := 'Compiled incorrect CONVERSION_LANG constant value in function''s body.', + HINT := 'Correct CONVERSION_LANG constant value in function''s body, recompile it and try again.'; + + WHEN invalid_text_representation THEN + GET STACKED DIAGNOSTICS v_err_message = MESSAGE_TEXT; + v_err_message := substring(pg_catalog.lower(v_err_message), 'integer\:\s\"(.*)\"'); + + RAISE USING MESSAGE := pg_catalog.format('Error while trying to convert "%s" value to SMALLINT data type.', + v_err_message), + DETAIL := 'Supplied value contains illegal characters.', + HINT := 'Correct supplied value, remove all illegal characters.'; +END; +$BODY$ +LANGUAGE plpgsql +STABLE +RETURNS NULL ON NULL INPUT; + +CREATE OR REPLACE FUNCTION sys.babelfish_conv_time_to_string(IN p_datatype TEXT, + IN p_src_datatype TEXT, + IN p_timeval TIME(6) WITHOUT TIME ZONE, + IN p_style NUMERIC DEFAULT 25) +RETURNS TEXT +AS +$BODY$ +DECLARE + v_hours VARCHAR COLLATE "C"; + v_style SMALLINT; + v_scale SMALLINT; + v_resmask VARCHAR COLLATE "C"; + v_fseconds VARCHAR COLLATE "C"; + v_datatype VARCHAR COLLATE "C"; + v_resstring VARCHAR COLLATE "C"; + v_lengthexpr VARCHAR COLLATE "C"; + v_res_length SMALLINT; + v_res_datatype VARCHAR COLLATE "C"; + v_src_datatype VARCHAR COLLATE "C"; + v_res_maxlength SMALLINT; + VARCHAR_MAX CONSTANT SMALLINT := 8000; + NVARCHAR_MAX CONSTANT SMALLINT := 4000; + -- We use the regex below to make sure input p_datatype is one of them + DATATYPE_REGEXP CONSTANT VARCHAR COLLATE "C" := '^\s*(CHAR|NCHAR|VARCHAR|NVARCHAR|CHARACTER VARYING)\s*$'; + -- We use the regex below to get the length of the datatype, if specified + -- For example, to get the '10' out of 'varchar(10)' + DATATYPE_MASK_REGEXP CONSTANT VARCHAR COLLATE "C" := '^\s*(?:CHAR|NCHAR|VARCHAR|NVARCHAR|CHARACTER VARYING)\s*\(\s*(\d+|MAX)\s*\)\s*$'; + SRCDATATYPE_MASK_REGEXP VARCHAR COLLATE "C" := '^\s*(?:TIME)\s*(?:\s*\(\s*(\d+)\s*\)\s*)?\s*$'; +BEGIN + v_datatype := pg_catalog.upper(trim(p_datatype)); + v_src_datatype := pg_catalog.upper(trim(p_src_datatype)); + v_style := floor(p_style)::SMALLINT; + + IF (v_src_datatype ~* SRCDATATYPE_MASK_REGEXP) + THEN + v_scale := coalesce(substring(v_src_datatype, SRCDATATYPE_MASK_REGEXP)::SMALLINT, 7); + + IF (v_scale NOT BETWEEN 0 AND 7) THEN + RAISE invalid_regular_expression; + END IF; + ELSE + RAISE most_specific_type_mismatch; + END IF; + + IF (v_datatype ~* DATATYPE_MASK_REGEXP) + THEN + v_res_datatype := PG_CATALOG.rtrim(split_part(v_datatype, '(', 1)); + + v_res_maxlength := CASE + WHEN (v_res_datatype IN ('CHAR', 'VARCHAR')) THEN VARCHAR_MAX + ELSE NVARCHAR_MAX + END; + + v_lengthexpr := substring(v_datatype, DATATYPE_MASK_REGEXP); + + IF (v_lengthexpr <> 'MAX' AND char_length(v_lengthexpr) > 4) THEN + RAISE interval_field_overflow; + END IF; + + v_res_length := CASE v_lengthexpr + WHEN 'MAX' THEN v_res_maxlength + ELSE v_lengthexpr::SMALLINT + END; + ELSIF (v_datatype ~* DATATYPE_REGEXP) THEN + v_res_datatype := v_datatype; + ELSE + RAISE datatype_mismatch; + END IF; + + IF (scale(p_style) > 0) THEN + RAISE escape_character_conflict; + ELSIF (NOT ((v_style BETWEEN 0 AND 14) OR + (v_style BETWEEN 20 AND 25) OR + (v_style BETWEEN 100 AND 114) OR + v_style IN (120, 121, 126, 127, 130, 131))) + THEN + RAISE invalid_parameter_value; + ELSIF ((v_style BETWEEN 1 AND 7) OR + (v_style BETWEEN 10 AND 12) OR + (v_style BETWEEN 101 AND 107) OR + (v_style BETWEEN 110 AND 112) OR + v_style = 23) + THEN + RAISE invalid_datetime_format; + END IF; + + v_hours := PG_CATALOG.ltrim(to_char(p_timeval, 'HH12'), '0'); + v_fseconds := sys.babelfish_get_microsecs_from_fractsecs(to_char(p_timeval, 'US'), v_scale); + + IF (v_scale = 7) THEN + v_fseconds := concat(v_fseconds, '0'); + END IF; + + IF (v_style IN (0, 100)) + THEN + v_resmask := concat(v_hours, ':MIAM'); + ELSIF (v_style IN (8, 20, 24, 108, 120)) + THEN + v_resmask := 'HH24:MI:SS'; + ELSIF (v_style IN (9, 109)) + THEN + v_resmask := CASE + WHEN (char_length(v_fseconds) = 0) THEN concat(v_hours, ':MI:SSAM') + ELSE pg_catalog.format('%s:MI:SS.%sAM', v_hours, v_fseconds) + END; + ELSIF (v_style IN (13, 14, 21, 25, 113, 114, 121, 126, 127)) + THEN + v_resmask := CASE + WHEN (char_length(v_fseconds) = 0) THEN 'HH24:MI:SS' + ELSE concat('HH24:MI:SS.', v_fseconds) + END; + ELSIF (v_style = 22) + THEN + v_resmask := pg_catalog.format('%s:MI:SS AM', lpad(v_hours, 2, ' ')); + ELSIF (v_style IN (130, 131)) + THEN + v_resmask := CASE + WHEN (char_length(v_fseconds) = 0) THEN concat(lpad(v_hours, 2, ' '), ':MI:SSAM') + ELSE pg_catalog.format('%s:MI:SS.%sAM', lpad(v_hours, 2, ' '), v_fseconds) + END; + END IF; + + v_resstring := to_char(p_timeval, v_resmask); + + v_resstring := substring(v_resstring, 1, coalesce(v_res_length, char_length(v_resstring))); + v_res_length := coalesce(v_res_length, + CASE v_res_datatype + WHEN 'CHAR' THEN 30 + ELSE 60 + END); + RETURN CASE + WHEN (v_res_datatype NOT IN ('CHAR', 'NCHAR')) THEN v_resstring + ELSE rpad(v_resstring, v_res_length, ' ') + END; +EXCEPTION + WHEN most_specific_type_mismatch THEN + RAISE USING MESSAGE := 'Source data type should be ''TIME'' or ''TIME(n)''.', + DETAIL := 'Use of incorrect "src_datatype" parameter value during conversion process.', + HINT := 'Change "src_datatype" parameter to the proper value and try again.'; + + WHEN invalid_regular_expression THEN + RAISE USING MESSAGE := pg_catalog.format('The source data type scale (%s) given to the convert specification exceeds the maximum allowable value (7).', + v_scale), + DETAIL := 'Use of incorrect scale value of source data type parameter during conversion process.', + HINT := 'Change scale component of source data type parameter to the allowable value and try again.'; + + WHEN interval_field_overflow THEN + RAISE USING MESSAGE := pg_catalog.format('The size (%s) given to the convert specification ''%s'' exceeds the maximum allowed for any data type (%s).', + v_lengthexpr, pg_catalog.lower(v_res_datatype), v_res_maxlength), + DETAIL := 'Use of incorrect size value of target data type parameter during conversion process.', + HINT := 'Change size component of data type parameter to the allowable value and try again.'; + + WHEN escape_character_conflict THEN + RAISE USING MESSAGE := 'Argument data type NUMERIC is invalid for argument 4 of convert function.', + DETAIL := 'Use of incorrect "style" parameter value during conversion process.', + HINT := 'Change "style" parameter to the proper value and try again.'; + + WHEN invalid_parameter_value THEN + RAISE USING MESSAGE := pg_catalog.format('%s is not a valid style number when converting from TIME to a character string.', v_style), + DETAIL := 'Use of incorrect "style" parameter value during conversion process.', + HINT := 'Change "style" parameter to the proper value and try again.'; + + WHEN datatype_mismatch THEN + RAISE USING MESSAGE := 'Data type should be one of these values: ''CHAR(n|MAX)'', ''NCHAR(n|MAX)'', ''VARCHAR(n|MAX)'', ''NVARCHAR(n|MAX)''.', + DETAIL := 'Use of incorrect "datatype" parameter value during conversion process.', + HINT := 'Change "datatype" parameter to the proper value and try again.'; + + WHEN invalid_datetime_format THEN + RAISE USING MESSAGE := pg_catalog.format('Error converting data type TIME to %s.', + PG_CATALOG.rtrim(split_part(trim(p_datatype), '(', 1))), + DETAIL := 'Incorrect using of pair of input parameters values during conversion process.', + HINT := 'Check the input parameters values, correct them if needed, and try again.'; +END; +$BODY$ +LANGUAGE plpgsql +STABLE +RETURNS NULL ON NULL INPUT; + +CREATE OR REPLACE FUNCTION babelfish_remove_delimiter_pair(IN name TEXT) +RETURNS TEXT AS +$BODY$ +BEGIN + IF name IN('[' COLLATE "C", ']' COLLATE "C", '"' COLLATE "C") THEN + RETURN NULL; + + ELSIF length(name) >= 2 AND PG_CATALOG.left(name, 1) = '[' COLLATE "C" AND PG_CATALOG.right(name, 1) = ']' COLLATE "C" THEN + IF length(name) = 2 THEN + RETURN ''; + ELSE + RETURN substring(name from 2 for length(name)-2); + END IF; + ELSIF length(name) >= 2 AND PG_CATALOG.left(name, 1) = '[' COLLATE "C" AND PG_CATALOG.right(name, 1) != ']' COLLATE "C" THEN + RETURN NULL; + ELSIF length(name) >= 2 AND PG_CATALOG.left(name, 1) != '[' COLLATE "C" AND PG_CATALOG.right(name, 1) = ']' COLLATE "C" THEN + RETURN NULL; + + ELSIF length(name) >= 2 AND PG_CATALOG.left(name, 1) = '"' COLLATE "C" AND PG_CATALOG.right(name, 1) = '"' COLLATE "C" THEN + IF length(name) = 2 THEN + RETURN ''; + ELSE + RETURN substring(name from 2 for length(name)-2); + END IF; + ELSIF length(name) >= 2 AND PG_CATALOG.left(name, 1) = '"' COLLATE "C" AND PG_CATALOG.right(name, 1) != '"' COLLATE "C" THEN + RETURN NULL; + ELSIF length(name) >= 2 AND PG_CATALOG.left(name, 1) != '"' COLLATE "C" AND PG_CATALOG.right(name, 1) = '"' COLLATE "C" THEN + RETURN NULL; + + END IF; + RETURN name; +END; +$BODY$ +LANGUAGE plpgsql +STABLE; + +CREATE OR REPLACE FUNCTION sys.babelfish_sp_add_job ( + par_job_name varchar, + par_enabled smallint = 1, + par_description varchar = NULL::character varying, + par_start_step_id integer = 1, + par_category_name varchar = NULL::character varying, + par_category_id integer = NULL::integer, + par_owner_login_name varchar = NULL::character varying, + par_notify_level_eventlog integer = 2, + par_notify_level_email integer = 0, + par_notify_level_netsend integer = 0, + par_notify_level_page integer = 0, + par_notify_email_operator_name varchar = NULL::character varying, + par_notify_netsend_operator_name varchar = NULL::character varying, + par_notify_page_operator_name varchar = NULL::character varying, + par_delete_level integer = 0, + inout par_job_id integer = NULL::integer, + par_originating_server varchar = NULL::character varying, + out returncode integer +) +RETURNS record AS +$body$ +DECLARE + var_retval INT DEFAULT 0; + var_notify_email_operator_id INT DEFAULT 0; + var_notify_email_operator_name VARCHAR(128); + var_notify_netsend_operator_id INT DEFAULT 0; + var_notify_page_operator_id INT DEFAULT 0; + var_owner_sid CHAR(85) ; + var_originating_server_id INT DEFAULT 0; +BEGIN + /* Remove any leading/trailing spaces from parameters (except @owner_login_name) */ + SELECT UPPER(PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_originating_server))) INTO par_originating_server; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_job_name)) INTO par_job_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_description)) INTO par_description; + SELECT '[Uncategorized (Local)]' INTO par_category_name; + SELECT 0 INTO par_category_id; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_notify_email_operator_name)) INTO par_notify_email_operator_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_notify_netsend_operator_name)) INTO par_notify_netsend_operator_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_notify_page_operator_name)) INTO par_notify_page_operator_name; + SELECT NULL INTO var_originating_server_id; /* Turn [nullable] empty string parameters into NULLs */ + SELECT NULL INTO par_job_id; + + IF (par_originating_server = '') + THEN + SELECT NULL INTO par_originating_server; + END IF; + + IF (par_description = '') + THEN + SELECT NULL INTO par_description; + END IF; + + IF (par_category_name = '') + THEN + SELECT NULL INTO par_category_name; + END IF; + + IF (par_notify_email_operator_name = '') + THEN + SELECT NULL INTO par_notify_email_operator_name; + END IF; + + IF (par_notify_netsend_operator_name = '') + THEN + SELECT NULL INTO par_notify_netsend_operator_name; + END IF; + + IF (par_notify_page_operator_name = '') + THEN + SELECT NULL INTO par_notify_page_operator_name; + END IF; + + /* Check parameters */ + SELECT t.par_owner_sid + , t.par_notify_level_email + , t.par_notify_level_netsend + , t.par_notify_level_page + , t.par_category_id + , t.par_notify_email_operator_id + , t.par_notify_netsend_operator_id + , t.par_notify_page_operator_id + , t.par_originating_server + , t.returncode + FROM sys.babelfish_sp_verify_job( + par_job_id /* NULL::integer */ + , par_job_name + , par_enabled + , par_start_step_id + , par_category_name + , var_owner_sid /* par_owner_sid */ + , par_notify_level_eventlog + , par_notify_level_email + , par_notify_level_netsend + , par_notify_level_page + , par_notify_email_operator_name + , par_notify_netsend_operator_name + , par_notify_page_operator_name + , par_delete_level + , par_category_id + , var_notify_email_operator_id /* par_notify_email_operator_id */ + , var_notify_netsend_operator_id /* par_notify_netsend_operator_id */ + , var_notify_page_operator_id /* par_notify_page_operator_id */ + , par_originating_server + ) t + INTO var_owner_sid + , par_notify_level_email + , par_notify_level_netsend + , par_notify_level_page + , par_category_id + , var_notify_email_operator_id + , var_notify_netsend_operator_id + , var_notify_page_operator_id + , par_originating_server + , var_retval; + + IF (var_retval <> 0) /* Failure */ + THEN + returncode := 1; + RETURN; + END IF; + + var_notify_email_operator_name := par_notify_email_operator_name; + + /* Default the description (if not supplied) */ + IF (par_description IS NULL) + THEN + SELECT 'No description available.' INTO par_description; + END IF; + + var_originating_server_id := 0; + var_owner_sid := ''; + + INSERT + INTO sys.sysjobs ( + originating_server_id + , name + , enabled + , description + , start_step_id + , category_id + , owner_sid + , notify_level_eventlog + , notify_level_email + , notify_level_netsend + , notify_level_page + , notify_email_operator_id + , notify_email_operator_name + , notify_netsend_operator_id + , notify_page_operator_id + , delete_level + , version_number + ) + VALUES ( + var_originating_server_id + , par_job_name + , par_enabled + , par_description + , par_start_step_id + , par_category_id + , var_owner_sid + , par_notify_level_eventlog + , par_notify_level_email + , par_notify_level_netsend + , par_notify_level_page + , var_notify_email_operator_id + , var_notify_email_operator_name + , var_notify_netsend_operator_id + , var_notify_page_operator_id + , par_delete_level + , 1); + + /* scope_identity() */ + SELECT LASTVAL() INTO par_job_id; + + /* Version number 1 */ + /* SELECT @retval = @@error */ + /* 0 means success */ + returncode := var_retval; + RETURN; + +END; +$body$ +LANGUAGE 'plpgsql'; + +CREATE OR REPLACE FUNCTION sys.babelfish_sp_add_schedule ( + par_schedule_name varchar, + par_enabled smallint = 1, + par_freq_type integer = 0, + par_freq_interval integer = 0, + par_freq_subday_type integer = 0, + par_freq_subday_interval integer = 0, + par_freq_relative_interval integer = 0, + par_freq_recurrence_factor integer = 0, + par_active_start_date integer = NULL::integer, + par_active_end_date integer = 99991231, + par_active_start_time integer = 0, + par_active_end_time integer = 235959, + par_owner_login_name varchar = NULL::character varying, + inout par_schedule_uid char = NULL::bpchar, + inout par_schedule_id integer = NULL::integer, + par_originating_server varchar = NULL::character varying, + out returncode integer +) +AS +$body$ +DECLARE + var_retval INT; + var_owner_sid CHAR(85); + var_orig_server_id INT; +BEGIN + /* Remove any leading/trailing spaces from parameters */ + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_schedule_name)) + , PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_owner_login_name)) + , UPPER(PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_originating_server))) + , 0 + INTO par_schedule_name + , par_owner_login_name + , par_originating_server + , par_schedule_id; + + /* Check schedule (frequency and owner) parameters */ + SELECT t.par_freq_interval + , t.par_freq_subday_type + , t.par_freq_subday_interval + , t.par_freq_relative_interval + , t.par_freq_recurrence_factor + , t.par_active_start_date + , t.par_active_start_time + , t.par_active_end_date + , t.par_active_end_time + , t.returncode + FROM sys.babelfish_sp_verify_schedule( + NULL::integer /* @schedule_id -- schedule_id does not exist for the new schedule */ + , par_schedule_name /* @name */ + , par_enabled /* @enabled */ + , par_freq_type /* @freq_type */ + , par_freq_interval /* @freq_interval */ + , par_freq_subday_type /* @freq_subday_type */ + , par_freq_subday_interval /* @freq_subday_interval */ + , par_freq_relative_interval /* @freq_relative_interval */ + , par_freq_recurrence_factor /* @freq_recurrence_factor */ + , par_active_start_date /* @active_start_date */ + , par_active_start_time /* @active_start_time */ + , par_active_end_date /* @active_end_date */ + , par_active_end_time /* @active_end_time */ + , var_owner_sid + ) t + INTO par_freq_interval + , par_freq_subday_type + , par_freq_subday_interval + , par_freq_relative_interval + , par_freq_recurrence_factor + , par_active_start_date + , par_active_start_time + , par_active_end_date + , par_active_end_time + , var_retval /* @owner_sid */; + + IF (var_retval <> 0) THEN /* Failure */ + returncode := 1; + RETURN; + END IF; + + IF (par_schedule_uid IS NULL) + THEN /* Assign the GUID */ + /* uuid without extensions uuid-ossp (cheat) */ + SELECT uuid_in(md5(random()::text || clock_timestamp()::text)::cstring) INTO par_schedule_uid; + END IF; + + var_orig_server_id := 0; + var_owner_sid := uuid_in(md5(random()::text || clock_timestamp()::text)::cstring); + + + INSERT + INTO sys.sysschedules ( + schedule_uid + , originating_server_id + , name + , owner_sid + , enabled + , freq_type + , freq_interval + , freq_subday_type + , freq_subday_interval + , freq_relative_interval + , freq_recurrence_factor + , active_start_date + , active_end_date + , active_start_time + , active_end_time + ) + VALUES ( + par_schedule_uid + , var_orig_server_id + , par_schedule_name + , var_owner_sid + , par_enabled + , par_freq_type + , par_freq_interval + , par_freq_subday_type + , par_freq_subday_interval + , par_freq_relative_interval + , par_freq_recurrence_factor + , par_active_start_date + , par_active_end_date + , par_active_start_time + , par_active_end_time + ); + + /* ZZZ */ + SELECT 0 /* @@ERROR, */, LASTVAL() + INTO var_retval, par_schedule_id; + + /* 0 means success */ + returncode := var_retval; + RETURN; +END; +$body$ +LANGUAGE 'plpgsql'; + +CREATE OR REPLACE FUNCTION sys.babelfish_sp_delete_jobschedule ( + par_job_id integer = NULL::integer, + par_job_name varchar = NULL::character varying, + par_name varchar = NULL::character varying, + par_keep_schedule integer = 0, + par_automatic_post smallint = 1, + out returncode integer +) +RETURNS integer AS +$body$ +DECLARE + var_retval INT; + var_sched_count INT; + var_schedule_id INT; + var_job_owner_sid CHAR(85); +BEGIN + /* Remove any leading/trailing spaces from parameters */ + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_name)) INTO par_name; + + /* Check that we can uniquely identify the job */ + SELECT t.par_job_name + , t.par_job_id + , t.par_owner_sid + , t.returncode + FROM sys.babelfish_sp_verify_job_identifiers( + '@job_name' + , '@job_id' + , par_job_name + , par_job_id + , 'TEST' + , var_job_owner_sid + ) t + INTO par_job_name + , par_job_id + , var_job_owner_sid + , var_retval; + + IF (var_retval <> 0) THEN /* Failure */ + returncode := 1; + RETURN; + END IF; + + IF (LOWER(UPPER(par_name)) = LOWER('ALL')) + THEN + SELECT - 1 INTO var_schedule_id; + + /* We use this in the call to sp_sqlagent_notify */ + /* Delete the schedule(s) if it isn't being used by other jobs */ + CREATE TEMPORARY TABLE "#temp_schedules_to_delete" (schedule_id INT NOT NULL) + /* If user requests that the schedules be removed (the legacy behavoir) */ + /* make sure it isnt being used by other jobs */; + + IF (par_keep_schedule = 0) + THEN + /* Get the list of schedules to delete */ + INSERT INTO "#temp_schedules_to_delete" + SELECT DISTINCT schedule_id + FROM sys.sysschedules + WHERE (schedule_id IN (SELECT schedule_id + FROM sys.sysjobschedules + WHERE (job_id = par_job_id))); + /* make sure no other jobs use these schedules */ + IF (EXISTS (SELECT * + FROM sys.sysjobschedules + WHERE (job_id <> par_job_id) + AND (schedule_id IN (SELECT schedule_id + FROM "#temp_schedules_to_delete")))) + THEN /* Failure */ + RAISE 'One or more schedules were not deleted because they are being used by at least one other job. Use "sp_detach_schedule" to remove schedules from a job.' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + END IF; + + /* OK to delete the jobschedule */ + DELETE FROM sys.sysjobschedules + WHERE (job_id = par_job_id); + + /* OK to delete the schedule - temp_schedules_to_delete is empty if @keep_schedule <> 0 */ + DELETE FROM sys.sysschedules + WHERE schedule_id IN (SELECT schedule_id FROM "#temp_schedules_to_delete"); + ELSE ---- IF (LOWER(UPPER(par_name)) = LOWER('ALL')) + + -- Need to use sp_detach_schedule to remove this ambiguous schedule name + IF(var_sched_count > 1) /* Failure */ + THEN + RAISE 'More than one schedule named "%" is attached to job "%". Use "sp_detach_schedule" to remove schedules from a job.', par_name, par_job_name USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + --If user requests that the schedule be removed (the legacy behavoir) + --make sure it isnt being used by another job + IF (par_keep_schedule = 0) + THEN + IF(EXISTS(SELECT * + FROM sys.sysjobschedules + WHERE (schedule_id = var_schedule_id) + AND (job_id <> par_job_id))) + THEN /* Failure */ + RAISE 'Schedule "%" was not deleted because it is being used by at least one other job. Use "sp_detach_schedule" to remove schedules from a job.', par_name USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + END IF; + + /* Delete the job schedule link first */ + DELETE FROM sys.sysjobschedules + WHERE (job_id = par_job_id) + AND (schedule_id = var_schedule_id); + + /* Delete schedule if required */ + IF (par_keep_schedule = 0) + THEN + /* Now delete the schedule if required */ + DELETE FROM sys.sysschedules + WHERE (schedule_id = var_schedule_id); + END IF; + + SELECT t.returncode + FROM sys.babelfish_sp_aws_del_jobschedule(par_job_id, var_schedule_id) t + INTO var_retval; + + + END IF; + + /* Update the job's version/last-modified information */ + UPDATE sys.sysjobs + SET version_number = version_number + 1 + -- , date_modified = GETDATE() / + WHERE job_id = par_job_id; + + DROP TABLE IF EXISTS "#temp_schedules_to_delete"; + + + /* 0 means success */ + returncode := var_retval; + RETURN; +END; +$body$ +LANGUAGE 'plpgsql'; + +CREATE OR REPLACE FUNCTION sys.babelfish_sp_update_job ( + par_job_id integer = NULL::integer, + par_job_name varchar = NULL::character varying, + par_new_name varchar = NULL::character varying, + par_enabled smallint = NULL::smallint, + par_description varchar = NULL::character varying, + par_start_step_id integer = NULL::integer, + par_category_name varchar = NULL::character varying, + par_owner_login_name varchar = NULL::character varying, + par_notify_level_eventlog integer = NULL::integer, + par_notify_level_email integer = NULL::integer, + par_notify_level_netsend integer = NULL::integer, + par_notify_level_page integer = NULL::integer, + par_notify_email_operator_name varchar = NULL::character varying, + par_notify_netsend_operator_name varchar = NULL::character varying, + par_notify_page_operator_name varchar = NULL::character varying, + par_delete_level integer = NULL::integer, + par_automatic_post smallint = 1, + out returncode integer +) +RETURNS integer AS +$body$ +DECLARE + var_retval INT; + var_category_id INT; + var_notify_email_operator_id INT; + var_notify_netsend_operator_id INT; + var_notify_page_operator_id INT; + var_owner_sid CHAR(85); + var_alert_id INT; + var_cached_attribute_modified INT; + var_is_sysadmin INT; + var_current_owner VARCHAR(128); + var_enable_only_used INT; + var_x_new_name VARCHAR(128); + var_x_enabled SMALLINT; + var_x_description VARCHAR(512); + var_x_start_step_id INT; + var_x_category_name VARCHAR(128); + var_x_category_id INT; + var_x_owner_sid CHAR(85); + var_x_notify_level_eventlog INT; + var_x_notify_level_email INT; + var_x_notify_level_netsend INT; + var_x_notify_level_page INT; + var_x_notify_email_operator_name VARCHAR(128); + var_x_notify_netsnd_operator_name VARCHAR(128); + var_x_notify_page_operator_name VARCHAR(128); + var_x_delete_level INT; + var_x_originating_server_id INT; + var_x_master_server SMALLINT; +BEGIN + /* Not updatable */ + /* Remove any leading/trailing spaces from parameters (except @owner_login_name) */ + SELECT + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_job_name)) + INTO par_job_name; + SELECT + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_new_name)) + INTO par_new_name; + SELECT + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_description)) + INTO par_description; + SELECT + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_category_name)) + INTO par_category_name; + SELECT + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_notify_email_operator_name)) + INTO par_notify_email_operator_name; + SELECT + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_notify_netsend_operator_name)) + INTO par_notify_netsend_operator_name; + SELECT + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_notify_page_operator_name)) + INTO par_notify_page_operator_name + /* Are we modifying an attribute which tsql agent caches? */; + + IF ((par_new_name IS NOT NULL) OR (par_enabled IS NOT NULL) OR (par_start_step_id IS NOT NULL) OR (par_owner_login_name IS NOT NULL) OR (par_notify_level_eventlog IS NOT NULL) OR (par_notify_level_email IS NOT NULL) OR (par_notify_level_netsend IS NOT NULL) OR (par_notify_level_page IS NOT NULL) OR (par_notify_email_operator_name IS NOT NULL) OR (par_notify_netsend_operator_name IS NOT NULL) OR (par_notify_page_operator_name IS NOT NULL) OR (par_delete_level IS NOT NULL)) THEN + SELECT + 1 + INTO var_cached_attribute_modified; + ELSE + SELECT + 0 + INTO var_cached_attribute_modified; + END IF + /* Is @enable the only parameter used beside jobname and jobid? */; + + IF ((par_enabled IS NOT NULL) AND (par_new_name IS NULL) AND (par_description IS NULL) AND (par_start_step_id IS NULL) AND (par_category_name IS NULL) AND (par_owner_login_name IS NULL) AND (par_notify_level_eventlog IS NULL) AND (par_notify_level_email IS NULL) AND (par_notify_level_netsend IS NULL) AND (par_notify_level_page IS NULL) AND (par_notify_email_operator_name IS NULL) AND (par_notify_netsend_operator_name IS NULL) AND (par_notify_page_operator_name IS NULL) AND (par_delete_level IS NULL)) THEN + SELECT + 1 + INTO var_enable_only_used; + ELSE + SELECT + 0 + INTO var_enable_only_used; + END IF; + + IF (par_new_name = '') THEN + SELECT + NULL + INTO par_new_name; + END IF + /* Fill out the values for all non-supplied parameters from the existing values */; + + IF (par_new_name IS NULL) THEN + SELECT + var_x_new_name + INTO par_new_name; + END IF; + + IF (par_enabled IS NULL) THEN + SELECT + var_x_enabled + INTO par_enabled; + END IF; + + IF (par_description IS NULL) THEN + SELECT + var_x_description + INTO par_description; + END IF; + + IF (par_start_step_id IS NULL) THEN + SELECT + var_x_start_step_id + INTO par_start_step_id; + END IF; + + IF (par_category_name IS NULL) THEN + SELECT + var_x_category_name + INTO par_category_name; + END IF; + + IF (var_owner_sid IS NULL) THEN + SELECT + var_x_owner_sid + INTO var_owner_sid; + END IF; + + IF (par_notify_level_eventlog IS NULL) THEN + SELECT + var_x_notify_level_eventlog + INTO par_notify_level_eventlog; + END IF; + + IF (par_notify_level_email IS NULL) THEN + SELECT + var_x_notify_level_email + INTO par_notify_level_email; + END IF; + + IF (par_notify_level_netsend IS NULL) THEN + SELECT + var_x_notify_level_netsend + INTO par_notify_level_netsend; + END IF; + + IF (par_notify_level_page IS NULL) THEN + SELECT + var_x_notify_level_page + INTO par_notify_level_page; + END IF; + + IF (par_notify_email_operator_name IS NULL) THEN + SELECT + var_x_notify_email_operator_name + INTO par_notify_email_operator_name; + END IF; + + IF (par_notify_netsend_operator_name IS NULL) THEN + SELECT + var_x_notify_netsnd_operator_name + INTO par_notify_netsend_operator_name; + END IF; + + IF (par_notify_page_operator_name IS NULL) THEN + SELECT + var_x_notify_page_operator_name + INTO par_notify_page_operator_name; + END IF; + + IF (par_delete_level IS NULL) THEN + SELECT + var_x_delete_level + INTO par_delete_level; + END IF + /* Turn [nullable] empty string parameters into NULLs */; + + IF (LOWER(par_description) = LOWER('')) THEN + SELECT + NULL + INTO par_description; + END IF; + + IF (par_category_name = '') THEN + SELECT + NULL + INTO par_category_name; + END IF; + + IF (par_notify_email_operator_name = '') THEN + SELECT + NULL + INTO par_notify_email_operator_name; + END IF; + + IF (par_notify_netsend_operator_name = '') THEN + SELECT + NULL + INTO par_notify_netsend_operator_name; + END IF; + + IF (par_notify_page_operator_name = '') THEN + SELECT + NULL + INTO par_notify_page_operator_name; + END IF + /* Check new values */; + SELECT + t.par_owner_sid, t.par_notify_level_email, t.par_notify_level_netsend, t.par_notify_level_page, + t.par_category_id, t.par_notify_email_operator_id, t.par_notify_netsend_operator_id, t.par_notify_page_operator_id, t.par_originating_server, t.ReturnCode + FROM sys.babelfish_sp_verify_job(par_job_id, par_new_name, par_enabled, par_start_step_id, par_category_name, var_owner_sid, par_notify_level_eventlog, par_notify_level_email, par_notify_level_netsend, par_notify_level_page, par_notify_email_operator_name, par_notify_netsend_operator_name, par_notify_page_operator_name, par_delete_level, var_category_id, var_notify_email_operator_id, var_notify_netsend_operator_id, var_notify_page_operator_id, NULL) t + INTO var_owner_sid, par_notify_level_email, par_notify_level_netsend, par_notify_level_page, var_category_id, var_notify_email_operator_id, var_notify_netsend_operator_id, var_notify_page_operator_id, var_retval; + + IF (var_retval <> 0) THEN + ReturnCode := (1); + RETURN; + END IF + /* Failure */ + /* BEGIN TRANSACTION */ + /* If the job is being re-assigned, modify sysjobsteps.database_user_name as necessary */; + + IF (par_owner_login_name IS NOT NULL) THEN + IF (EXISTS (SELECT + 1 + FROM sys.sysjobsteps + WHERE (job_id = par_job_id) AND (LOWER(subsystem) = LOWER('TSQL')))) THEN + /* The job is being re-assigned to an non-SA */ + UPDATE sys.sysjobsteps + SET database_user_name = NULL + WHERE (job_id = par_job_id) AND (LOWER(subsystem) = LOWER('TSQL')); + END IF; + END IF; + UPDATE sys.sysjobs + SET name = par_new_name, enabled = par_enabled, description = par_description, start_step_id = par_start_step_id, category_id = var_category_id + /* Returned from sp_verify_job */, owner_sid = var_owner_sid, notify_level_eventlog = par_notify_level_eventlog, notify_level_email = par_notify_level_email, notify_level_netsend = par_notify_level_netsend, notify_level_page = par_notify_level_page, notify_email_operator_id = var_notify_email_operator_id + /* Returned from sp_verify_job */, notify_netsend_operator_id = var_notify_netsend_operator_id + /* Returned from sp_verify_job */, notify_page_operator_id = var_notify_page_operator_id + /* Returned from sp_verify_job */, delete_level = par_delete_level, version_number = version_number + 1 + /* , -- Update the job's version */ + /* date_modified = GETDATE() -- Update the job's last-modified information */ + WHERE (job_id = par_job_id); + SELECT + 0 + INTO var_retval + /* @@error */ + /* COMMIT TRANSACTION */; + ReturnCode := (var_retval); + RETURN + /* 0 means success */; +END; +$body$ +LANGUAGE 'plpgsql'; + +CREATE OR REPLACE FUNCTION sys.babelfish_sp_update_jobschedule ( + par_job_id integer = NULL::integer, + par_job_name varchar = NULL::character varying, + par_name varchar = NULL::character varying, + par_new_name varchar = NULL::character varying, + par_enabled smallint = NULL::smallint, + par_freq_type integer = NULL::integer, + par_freq_interval integer = NULL::integer, + par_freq_subday_type integer = NULL::integer, + par_freq_subday_interval integer = NULL::integer, + par_freq_relative_interval integer = NULL::integer, + par_freq_recurrence_factor integer = NULL::integer, + par_active_start_date integer = NULL::integer, + par_active_end_date integer = NULL::integer, + par_active_start_time integer = NULL::integer, + par_active_end_time integer = NULL::integer, + par_automatic_post smallint = 1, + out returncode integer +) +RETURNS integer AS +$body$ +DECLARE + var_retval INT; + var_sched_count INT; + var_schedule_id INT; + var_job_owner_sid CHAR(85); + var_enable_only_used INT; + var_x_name VARCHAR(128); + var_x_enabled SMALLINT; + var_x_freq_type INT; + var_x_freq_interval INT; + var_x_freq_subday_type INT; + var_x_freq_subday_interval INT; + var_x_freq_relative_interval INT; + var_x_freq_recurrence_factor INT; + var_x_active_start_date INT; + var_x_active_end_date INT; + var_x_active_start_time INT; + var_x_active_end_time INT; + var_owner_sid CHAR(85); +BEGIN + /* Remove any leading/trailing spaces from parameters */ + SELECT + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_name)) + INTO par_name; + SELECT + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_new_name)) + INTO par_new_name + /* Turn [nullable] empty string parameters into NULLs */; + + IF (par_new_name = '') THEN + SELECT + NULL + INTO par_new_name; + END IF + /* Check that we can uniquely identify the job */; + SELECT + t.par_job_name, t.par_job_id, t.par_owner_sid, t.ReturnCode + FROM sys.babelfish_sp_verify_job_identifiers('@job_name', '@job_id', par_job_name, par_job_id, 'TEST', var_job_owner_sid) t + INTO par_job_name, par_job_id, var_job_owner_sid, var_retval; + + IF (var_retval <> 0) THEN + ReturnCode := (1); + RETURN; + END IF + /* Failure */ + /* Is @enable the only parameter used beside jobname and jobid? */; + + IF ((par_enabled IS NOT NULL) AND (par_name IS NULL) AND (par_new_name IS NULL) AND (par_freq_type IS NULL) AND (par_freq_interval IS NULL) AND (par_freq_subday_type IS NULL) AND (par_freq_subday_interval IS NULL) AND (par_freq_relative_interval IS NULL) AND (par_freq_recurrence_factor IS NULL) AND (par_active_start_date IS NULL) AND (par_active_end_date IS NULL) AND (par_active_start_time IS NULL) AND (par_active_end_time IS NULL)) THEN + SELECT + 1 + INTO var_enable_only_used; + ELSE + SELECT + 0 + INTO var_enable_only_used; + END IF; + + IF (par_new_name IS NULL) THEN + SELECT + var_x_name + INTO par_new_name; + END IF; + + IF (par_enabled IS NULL) THEN + SELECT + var_x_enabled + INTO par_enabled; + END IF; + + IF (par_freq_type IS NULL) THEN + SELECT + var_x_freq_type + INTO par_freq_type; + END IF; + + IF (par_freq_interval IS NULL) THEN + SELECT + var_x_freq_interval + INTO par_freq_interval; + END IF; + + IF (par_freq_subday_type IS NULL) THEN + SELECT + var_x_freq_subday_type + INTO par_freq_subday_type; + END IF; + + IF (par_freq_subday_interval IS NULL) THEN + SELECT + var_x_freq_subday_interval + INTO par_freq_subday_interval; + END IF; + + IF (par_freq_relative_interval IS NULL) THEN + SELECT + var_x_freq_relative_interval + INTO par_freq_relative_interval; + END IF; + + IF (par_freq_recurrence_factor IS NULL) THEN + SELECT + var_x_freq_recurrence_factor + INTO par_freq_recurrence_factor; + END IF; + + IF (par_active_start_date IS NULL) THEN + SELECT + var_x_active_start_date + INTO par_active_start_date; + END IF; + + IF (par_active_end_date IS NULL) THEN + SELECT + var_x_active_end_date + INTO par_active_end_date; + END IF; + + IF (par_active_start_time IS NULL) THEN + SELECT + var_x_active_start_time + INTO par_active_start_time; + END IF; + + IF (par_active_end_time IS NULL) THEN + SELECT + var_x_active_end_time + INTO par_active_end_time; + END IF + /* Check schedule (frequency and owner) parameters */; + SELECT + t.par_freq_interval, t.par_freq_subday_type, t.par_freq_subday_interval, t.par_freq_relative_interval, t.par_freq_recurrence_factor, t.par_active_start_date, t.par_active_start_time, + t.par_active_end_date, t.par_active_end_time, t.ReturnCode + FROM sys.babelfish_sp_verify_schedule(var_schedule_id + /* @schedule_id */, par_new_name + /* @name */, par_enabled + /* @enabled */, par_freq_type + /* @freq_type */, par_freq_interval + /* @freq_interval */, par_freq_subday_type + /* @freq_subday_type */, par_freq_subday_interval + /* @freq_subday_interval */, par_freq_relative_interval + /* @freq_relative_interval */, par_freq_recurrence_factor + /* @freq_recurrence_factor */, par_active_start_date + /* @active_start_date */, par_active_start_time + /* @active_start_time */, par_active_end_date + /* @active_end_date */, par_active_end_time + /* @active_end_time */, var_owner_sid) t + INTO par_freq_interval, par_freq_subday_type, par_freq_subday_interval, par_freq_relative_interval, par_freq_recurrence_factor, par_active_start_date, par_active_start_time, par_active_end_date, par_active_end_time, var_retval /* @owner_sid */; + + IF (var_retval <> 0) THEN + ReturnCode := (1); + RETURN; + END IF + /* Failure */ + /* Update the JobSchedule */; + UPDATE sys.sysschedules + SET name = par_new_name, enabled = par_enabled, freq_type = par_freq_type, freq_interval = par_freq_interval, freq_subday_type = par_freq_subday_type, freq_subday_interval = par_freq_subday_interval, freq_relative_interval = par_freq_relative_interval, freq_recurrence_factor = par_freq_recurrence_factor, active_start_date = par_active_start_date, active_end_date = par_active_end_date, active_start_time = par_active_start_time, active_end_time = par_active_end_time + /* date_modified = GETDATE(), */, version_number = version_number + 1 + WHERE (schedule_id = var_schedule_id); + SELECT + 0 + INTO var_retval + /* @@error */ + /* Update the job's version/last-modified information */; + UPDATE sys.sysjobs + SET version_number = version_number + 1 + /* date_modified = GETDATE() */ + WHERE (job_id = par_job_id); + ReturnCode := (var_retval); + RETURN + /* 0 means success */; +END; +$body$ +LANGUAGE 'plpgsql'; + +CREATE OR REPLACE FUNCTION sys.babelfish_sp_update_jobstep ( + par_job_id integer = NULL::integer, + par_job_name varchar = NULL::character varying, + par_step_id integer = NULL::integer, + par_step_name varchar = NULL::character varying, + par_subsystem varchar = NULL::character varying, + par_command text = NULL::text, + par_additional_parameters text = NULL::text, + par_cmdexec_success_code integer = NULL::integer, + par_on_success_action smallint = NULL::smallint, + par_on_success_step_id integer = NULL::integer, + par_on_fail_action smallint = NULL::smallint, + par_on_fail_step_id integer = NULL::integer, + par_server varchar = NULL::character varying, + par_database_name varchar = NULL::character varying, + par_database_user_name varchar = NULL::character varying, + par_retry_attempts integer = NULL::integer, + par_retry_interval integer = NULL::integer, + par_os_run_priority integer = NULL::integer, + par_output_file_name varchar = NULL::character varying, + par_flags integer = NULL::integer, + par_proxy_id integer = NULL::integer, + par_proxy_name varchar = NULL::character varying, + out returncode integer +) +RETURNS integer AS +$body$ +DECLARE + var_retval INT; + var_os_run_priority_code INT; + var_step_id_as_char VARCHAR(10); + var_new_step_name VARCHAR(128); + var_x_step_name VARCHAR(128); + var_x_subsystem VARCHAR(40); + var_x_command TEXT; + var_x_flags INT; + var_x_cmdexec_success_code INT; + var_x_on_success_action SMALLINT; + var_x_on_success_step_id INT; + var_x_on_fail_action SMALLINT; + var_x_on_fail_step_id INT; + var_x_server VARCHAR(128); + var_x_database_name VARCHAR(128); + var_x_database_user_name VARCHAR(128); + var_x_retry_attempts INT; + var_x_retry_interval INT; + var_x_os_run_priority INT; + var_x_output_file_name VARCHAR(200); + var_x_proxy_id INT; + var_x_last_run_outcome SMALLINT; + var_x_last_run_duration INT; + var_x_last_run_retries INT; + var_x_last_run_date INT; + var_x_last_run_time INT; + var_new_proxy_id INT; + var_subsystem_id INT; + var_auto_proxy_name VARCHAR(128); + var_job_owner_sid CHAR(85); + var_step_uid CHAR(85); +BEGIN + SELECT NULL INTO var_new_proxy_id; + /* Remove any leading/trailing spaces from parameters */ + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_step_name)) INTO par_step_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_subsystem)) INTO par_subsystem; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_command)) INTO par_command; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_server)) INTO par_server; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_database_name)) INTO par_database_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_database_user_name)) INTO par_database_user_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_output_file_name)) INTO par_output_file_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_proxy_name)) INTO par_proxy_name; + /* Make sure Dts is translated into new subsystem's name SSIS */ + /* IF (@subsystem IS NOT NULL AND UPPER(@subsystem collate SQL_Latin1_General_CP1_CS_AS) = N'DTS') */ + /* BEGIN */ + /* SET @subsystem = N'SSIS' */ + /* END */ + SELECT + t.par_job_name, t.par_job_id, t.par_owner_sid, t.ReturnCode + FROM sys.babelfish_sp_verify_job_identifiers('@job_name' + /* @name_of_name_parameter */, '@job_id' + /* @name_of_id_parameter */, par_job_name + /* @job_name */, par_job_id + /* @job_id */, 'TEST' + /* @sqlagent_starting_test */, var_job_owner_sid) + INTO par_job_name, par_job_id, var_job_owner_sid, var_retval + /* @owner_sid */; + + IF (var_retval <> 0) THEN + ReturnCode := (1); + RETURN; + END IF; + /* Failure */ + /* Check that the step exists */ + + IF (NOT EXISTS (SELECT + * + FROM sys.sysjobsteps + WHERE (job_id = par_job_id) AND (step_id = par_step_id))) THEN + SELECT + CAST (par_step_id AS VARCHAR(10)) + INTO var_step_id_as_char; + RAISE 'Error %, severity %, state % was raised. Message: %. Argument: %. Argument: %', '50000', 0, 0, 'The specified %s ("%s") does not exist.', '@step_id', var_step_id_as_char USING ERRCODE := '50000'; + ReturnCode := (1); + RETURN; + /* Failure */ + END IF; + /* Set the x_ (existing) variables */ + SELECT + step_name, subsystem, command, flags, cmdexec_success_code, on_success_action, on_success_step_id, on_fail_action, on_fail_step_id, server, database_name, database_user_name, retry_attempts, retry_interval, os_run_priority, output_file_name, proxy_id, last_run_outcome, last_run_duration, last_run_retries, last_run_date, last_run_time + INTO var_x_step_name, var_x_subsystem, var_x_command, var_x_flags, var_x_cmdexec_success_code, var_x_on_success_action, var_x_on_success_step_id, var_x_on_fail_action, var_x_on_fail_step_id, var_x_server, var_x_database_name, var_x_database_user_name, var_x_retry_attempts, var_x_retry_interval, var_x_os_run_priority, var_x_output_file_name, var_x_proxy_id, var_x_last_run_outcome, var_x_last_run_duration, var_x_last_run_retries, var_x_last_run_date, var_x_last_run_time + FROM sys.sysjobsteps + WHERE (job_id = par_job_id) AND (step_id = par_step_id); + + IF ((par_step_name IS NOT NULL) AND (par_step_name <> var_x_step_name)) THEN + SELECT + par_step_name + INTO var_new_step_name; + END IF; + /* Fill out the values for all non-supplied parameters from the existing values */ + + IF (par_step_name IS NULL) THEN + SELECT var_x_step_name INTO par_step_name; + END IF; + + IF (par_subsystem IS NULL) THEN + SELECT var_x_subsystem INTO par_subsystem; + END IF; + + IF (par_command IS NULL) THEN + SELECT var_x_command INTO par_command; + END IF; + + IF (par_flags IS NULL) THEN + SELECT var_x_flags INTO par_flags; + END IF; + + IF (par_cmdexec_success_code IS NULL) THEN + SELECT var_x_cmdexec_success_code INTO par_cmdexec_success_code; + END IF; + + IF (par_on_success_action IS NULL) THEN + SELECT var_x_on_success_action INTO par_on_success_action; + END IF; + + IF (par_on_success_step_id IS NULL) THEN + SELECT var_x_on_success_step_id INTO par_on_success_step_id; + END IF; + + IF (par_on_fail_action IS NULL) THEN + SELECT var_x_on_fail_action INTO par_on_fail_action; + END IF; + + IF (par_on_fail_step_id IS NULL) THEN + SELECT var_x_on_fail_step_id INTO par_on_fail_step_id; + END IF; + + IF (par_server IS NULL) THEN + SELECT var_x_server INTO par_server; + END IF; + + IF (par_database_name IS NULL) THEN + SELECT var_x_database_name INTO par_database_name; + END IF; + + IF (par_database_user_name IS NULL) THEN + SELECT var_x_database_user_name INTO par_database_user_name; + END IF; + + IF (par_retry_attempts IS NULL) THEN + SELECT var_x_retry_attempts INTO par_retry_attempts; + END IF; + + IF (par_retry_interval IS NULL) THEN + SELECT var_x_retry_interval INTO par_retry_interval; + END IF; + + IF (par_os_run_priority IS NULL) THEN + SELECT var_x_os_run_priority INTO par_os_run_priority; + END IF; + + IF (par_output_file_name IS NULL) THEN + SELECT var_x_output_file_name INTO par_output_file_name; + END IF; + + IF (par_proxy_id IS NULL) THEN + SELECT var_x_proxy_id INTO var_new_proxy_id; + END IF; + /* if an empty proxy_name is supplied the proxy is removed */ + + IF par_proxy_name = '' THEN + SELECT NULL INTO var_new_proxy_id; + END IF; + /* Turn [nullable] empty string parameters into NULLs */ + + IF (LOWER(par_command) = LOWER('')) THEN + SELECT NULL INTO par_command; + END IF; + + IF (par_server = '') THEN + SELECT NULL INTO par_server; + END IF; + + IF (par_database_name = '') THEN + SELECT NULL INTO par_database_name; + END IF; + + IF (par_database_user_name = '') THEN + SELECT NULL INTO par_database_user_name; + END IF; + + IF (LOWER(par_output_file_name) = LOWER('')) THEN + SELECT NULL INTO par_output_file_name; + END IF + /* Check new values */; + SELECT + t.par_database_name, t.par_database_user_name, t.ReturnCode + FROM sys.babelfish_sp_verify_jobstep(par_job_id, par_step_id, var_new_step_name, par_subsystem, par_command, par_server, par_on_success_action, par_on_success_step_id, par_on_fail_action, par_on_fail_step_id, par_os_run_priority, par_database_name, par_database_user_name, par_flags, par_output_file_name, var_new_proxy_id) t + INTO par_database_name, par_database_user_name, var_retval; + + IF (var_retval <> 0) THEN + ReturnCode := (1); + RETURN; + END IF + /* Failure */ + /* Update the job's version/last-modified information */; + UPDATE sys.sysjobs + SET version_number = version_number + 1 + /* date_modified = GETDATE() */ + WHERE (job_id = par_job_id) + /* Update the step */; + UPDATE sys.sysjobsteps + SET step_name = par_step_name, subsystem = par_subsystem, command = par_command, flags = par_flags, additional_parameters = par_additional_parameters, cmdexec_success_code = par_cmdexec_success_code, on_success_action = par_on_success_action, on_success_step_id = par_on_success_step_id, on_fail_action = par_on_fail_action, on_fail_step_id = par_on_fail_step_id, server = par_server, database_name = par_database_name, database_user_name = par_database_user_name, retry_attempts = par_retry_attempts, retry_interval = par_retry_interval, os_run_priority = par_os_run_priority, output_file_name = par_output_file_name, last_run_outcome = var_x_last_run_outcome, last_run_duration = var_x_last_run_duration, last_run_retries = var_x_last_run_retries, last_run_date = var_x_last_run_date, last_run_time = var_x_last_run_time, proxy_id = var_new_proxy_id + WHERE (job_id = par_job_id) AND (step_id = par_step_id); + + SELECT step_uid + FROM sys.sysjobsteps + WHERE job_id = par_job_id AND step_id = par_step_id + INTO var_step_uid; + + -- PERFORM sys.sp_jobstep_create_proc (var_step_uid); + + ReturnCode := (0); + RETURN + /* Success */; +END; +$body$ +LANGUAGE 'plpgsql'; + +CREATE OR REPLACE FUNCTION sys.babelfish_sp_update_schedule ( + par_schedule_id integer = NULL::integer, + par_name varchar = NULL::character varying, + par_new_name varchar = NULL::character varying, + par_enabled smallint = NULL::smallint, + par_freq_type integer = NULL::integer, + par_freq_interval integer = NULL::integer, + par_freq_subday_type integer = NULL::integer, + par_freq_subday_interval integer = NULL::integer, + par_freq_relative_interval integer = NULL::integer, + par_freq_recurrence_factor integer = NULL::integer, + par_active_start_date integer = NULL::integer, + par_active_end_date integer = NULL::integer, + par_active_start_time integer = NULL::integer, + par_active_end_time integer = NULL::integer, + par_owner_login_name varchar = NULL::character varying, + par_automatic_post smallint = 1, + out returncode integer +) +RETURNS integer AS +$body$ +DECLARE + var_retval INT; + var_owner_sid CHAR(85); + var_cur_owner_sid CHAR(85); + var_x_name VARCHAR(128); + var_enable_only_used INT; + var_x_enabled SMALLINT; + var_x_freq_type INT; + var_x_freq_interval INT; + var_x_freq_subday_type INT; + var_x_freq_subday_interval INT; + var_x_freq_relative_interval INT; + var_x_freq_recurrence_factor INT; + var_x_active_start_date INT; + var_x_active_end_date INT; + var_x_active_start_time INT; + var_x_active_end_time INT; + var_schedule_uid CHAR(38); +BEGIN + /* Remove any leading/trailing spaces from parameters */ + SELECT + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_name)) + INTO par_name; + SELECT + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_new_name)) + INTO par_new_name; + SELECT + PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_owner_login_name)) + INTO par_owner_login_name + /* Turn [nullable] empty string parameters into NULLs */; + + IF (par_new_name = '') THEN + SELECT + NULL + INTO par_new_name; + END IF + /* Check that we can uniquely identify the schedule. This only returns a schedule that is visible to this user */; + SELECT + t.par_schedule_name, t.par_schedule_id, t.par_owner_sid, t.par_orig_server_id, t.ReturnCode + FROM sys.babelfish_sp_verify_schedule_identifiers('@name' + /* @name_of_name_parameter */, '@schedule_id' + /* @name_of_id_parameter */, par_name + /* @schedule_name */, par_schedule_id + /* @schedule_id */, var_cur_owner_sid + /* @owner_sid */, NULL + /* @orig_server_id */, NULL) t + INTO par_name, par_schedule_id, var_cur_owner_sid, var_retval + /* @job_id_filter */; + + IF (var_retval <> 0) THEN + ReturnCode := (1); + RETURN; + END IF + /* Failure */ + /* Is @enable the only parameter used beside jobname and jobid? */; + + IF ((par_enabled IS NOT NULL) AND (par_new_name IS NULL) AND (par_freq_type IS NULL) AND (par_freq_interval IS NULL) AND (par_freq_subday_type IS NULL) AND (par_freq_subday_interval IS NULL) AND (par_freq_relative_interval IS NULL) AND (par_freq_recurrence_factor IS NULL) AND (par_active_start_date IS NULL) AND (par_active_end_date IS NULL) AND (par_active_start_time IS NULL) AND (par_active_end_time IS NULL) AND (par_owner_login_name IS NULL)) THEN + SELECT + 1 + INTO var_enable_only_used; + ELSE + SELECT + 0 + INTO var_enable_only_used; + END IF + /* If the param @owner_login_name is null or doesn't get resolved by SUSER_SID() set it to the current owner of the schedule */; + + IF (var_owner_sid IS NULL) THEN + SELECT + var_cur_owner_sid + INTO var_owner_sid; + END IF + /* Set the x_ (existing) variables */; + SELECT + name, enabled, freq_type, freq_interval, freq_subday_type, freq_subday_interval, freq_relative_interval, freq_recurrence_factor, active_start_date, active_end_date, active_start_time, active_end_time + INTO var_x_name, var_x_enabled, var_x_freq_type, var_x_freq_interval, var_x_freq_subday_type, var_x_freq_subday_interval, var_x_freq_relative_interval, var_x_freq_recurrence_factor, var_x_active_start_date, var_x_active_end_date, var_x_active_start_time, var_x_active_end_time + FROM sys.sysschedules + WHERE (schedule_id = par_schedule_id) + /* Fill out the values for all non-supplied parameters from the existing values */; + + IF (par_new_name IS NULL) THEN + SELECT + var_x_name + INTO par_new_name; + END IF; + + IF (par_enabled IS NULL) THEN + SELECT + var_x_enabled + INTO par_enabled; + END IF; + + IF (par_freq_type IS NULL) THEN + SELECT + var_x_freq_type + INTO par_freq_type; + END IF; + + IF (par_freq_interval IS NULL) THEN + SELECT + var_x_freq_interval + INTO par_freq_interval; + END IF; + + IF (par_freq_subday_type IS NULL) THEN + SELECT + var_x_freq_subday_type + INTO par_freq_subday_type; + END IF; + + IF (par_freq_subday_interval IS NULL) THEN + SELECT + var_x_freq_subday_interval + INTO par_freq_subday_interval; + END IF; + + IF (par_freq_relative_interval IS NULL) THEN + SELECT + var_x_freq_relative_interval + INTO par_freq_relative_interval; + END IF; + + IF (par_freq_recurrence_factor IS NULL) THEN + SELECT + var_x_freq_recurrence_factor + INTO par_freq_recurrence_factor; + END IF; + + IF (par_active_start_date IS NULL) THEN + SELECT + var_x_active_start_date + INTO par_active_start_date; + END IF; + + IF (par_active_end_date IS NULL) THEN + SELECT + var_x_active_end_date + INTO par_active_end_date; + END IF; + + IF (par_active_start_time IS NULL) THEN + SELECT + var_x_active_start_time + INTO par_active_start_time; + END IF; + + IF (par_active_end_time IS NULL) THEN + SELECT + var_x_active_end_time + INTO par_active_end_time; + END IF + /* Check schedule (frequency and owner) parameters */; + SELECT + t.par_freq_interval, t.par_freq_subday_type, t.par_freq_subday_interval, t.par_freq_relative_interval, t.par_freq_recurrence_factor, t.par_active_start_date, + t.par_active_start_time, t.par_active_end_date, t.par_active_end_time, t.ReturnCode + FROM sys.babelfish_sp_verify_schedule(par_schedule_id + /* @schedule_id */, par_new_name + /* @name */, par_enabled + /* @enabled */, par_freq_type + /* @freq_type */, par_freq_interval + /* @freq_interval */, par_freq_subday_type + /* @freq_subday_type */, par_freq_subday_interval + /* @freq_subday_interval */, par_freq_relative_interval + /* @freq_relative_interval */, par_freq_recurrence_factor + /* @freq_recurrence_factor */, par_active_start_date + /* @active_start_date */, par_active_start_time + /* @active_start_time */, par_active_end_date + /* @active_end_date */, par_active_end_time + /* @active_end_time */, var_owner_sid) t + INTO par_freq_interval, par_freq_subday_type, par_freq_subday_interval, par_freq_relative_interval, par_freq_recurrence_factor, par_active_start_date, par_active_start_time, par_active_end_date, par_active_end_time, var_retval /* @owner_sid */; + + IF (var_retval <> 0) THEN + ReturnCode := (1); + RETURN; + END IF + /* Failure */ + /* Update the sysschedules table */; + UPDATE sys.sysschedules + SET name = par_new_name, owner_sid = var_owner_sid, enabled = par_enabled, freq_type = par_freq_type, freq_interval = par_freq_interval, freq_subday_type = par_freq_subday_type, freq_subday_interval = par_freq_subday_interval, freq_relative_interval = par_freq_relative_interval, freq_recurrence_factor = par_freq_recurrence_factor, active_start_date = par_active_start_date, active_end_date = par_active_end_date, active_start_time = par_active_start_time, active_end_time = par_active_end_time + /* date_modified = GETDATE(), */, version_number = version_number + 1 + WHERE (schedule_id = par_schedule_id); + SELECT + 0 + INTO var_retval; + + ReturnCode := (var_retval); + RETURN + /* 0 means success */; +END; +$body$ +LANGUAGE 'plpgsql'; + +CREATE OR REPLACE FUNCTION sys.babelfish_sp_verify_job ( + par_job_id integer, + par_name varchar, + par_enabled smallint, + par_start_step_id integer, + par_category_name varchar, + inout par_owner_sid char, + par_notify_level_eventlog integer, + inout par_notify_level_email integer, + inout par_notify_level_netsend integer, + inout par_notify_level_page integer, + par_notify_email_operator_name varchar, + par_notify_netsend_operator_name varchar, + par_notify_page_operator_name varchar, + par_delete_level integer, + inout par_category_id integer, + inout par_notify_email_operator_id integer, + inout par_notify_netsend_operator_id integer, + inout par_notify_page_operator_id integer, + inout par_originating_server varchar, + out returncode integer +) +RETURNS record AS +$body$ +DECLARE + var_job_type INT; + var_retval INT; + var_current_date INT; + var_res_valid_range VARCHAR(200); + var_max_step_id INT; + var_valid_range VARCHAR(50); +BEGIN + /* Remove any leading/trailing spaces from parameters */ + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_name)) INTO par_name; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_category_name)) INTO par_category_name; + SELECT UPPER(PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_originating_server))) INTO par_originating_server; + + IF ( + EXISTS ( + SELECT * + FROM sys.sysjobs AS job + WHERE (name = par_name) + /* AND (job_id <> ISNULL(@job_id, 0x911)))) -- When adding a new job @job_id is NULL */ + ) + ) + THEN /* Failure */ + RAISE 'The specified % ("%") already exists.', 'par_name', par_name USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + /* Check enabled state */ + IF (par_enabled <> 0) AND (par_enabled <> 1) THEN /* Failure */ + RAISE 'The specified "%" is invalid (valid values are: %).', 'par_enabled', '0, 1' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + /* Check start step */ + + IF (par_job_id IS NULL) THEN /* New job */ + IF (par_start_step_id <> 1) THEN /* Failure */ + RAISE 'The specified "%" is invalid (valid values are: %).', 'par_start_step_id', '1' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + ELSE /* Existing job */ + /* Get current maximum step id */ + SELECT COALESCE(MAX(step_id), 0) + INTO var_max_step_id + FROM sys.sysjobsteps + WHERE (job_id = par_job_id); + + IF (par_start_step_id < 1) OR (par_start_step_id > var_max_step_id + 1) THEN /* Failure */ + SELECT '1..' || CAST (var_max_step_id + 1 AS VARCHAR(1)) + INTO var_valid_range; + RAISE 'The specified "%" is invalid (valid values are: %).', 'par_start_step_id', var_valid_range USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + END IF; + + /* Get the category_id, handling any special-cases as appropriate */ + SELECT NULL INTO par_category_id; + + IF (par_category_name = '[DEFAULT]') /* User wants to revert to the default job category */ + THEN + SELECT + CASE COALESCE(var_job_type, 1) + WHEN 1 THEN 0 /* [Uncategorized (Local)] */ + WHEN 2 THEN 2 /* [Uncategorized (Multi-Server)] */ + END + INTO par_category_id; + ELSE + SELECT 0 INTO par_category_id; + END IF; + + returncode := (0); /* Success */ + RETURN; +END; +$body$ +LANGUAGE 'plpgsql' +STABLE; + +CREATE OR REPLACE FUNCTION sys.babelfish_sp_verify_job_date ( + par_date integer, + par_date_name varchar = 'date'::character varying, + out returncode integer +) +RETURNS integer AS +$body$ +BEGIN + /* Remove any leading/trailing spaces from parameters */ + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_date_name)) INTO par_date_name; + + /* Success */ + returncode := 0; + RETURN; +END; +$body$ +LANGUAGE 'plpgsql' +STABLE; + +CREATE OR REPLACE FUNCTION sys.babelfish_sp_verify_job_identifiers ( + par_name_of_name_parameter varchar, + par_name_of_id_parameter varchar, + inout par_job_name varchar, + inout par_job_id integer, + par_sqlagent_starting_test varchar = 'TEST'::character varying, + inout par_owner_sid char = NULL::bpchar, + out returncode integer +) +RETURNS record AS +$body$ +DECLARE + var_retval INT; + var_job_id_as_char VARCHAR(36); +BEGIN + /* Remove any leading/trailing spaces from parameters */ + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_name_of_name_parameter)) INTO par_name_of_name_parameter; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_name_of_id_parameter)) INTO par_name_of_id_parameter; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_job_name)) INTO par_job_name; + + IF (par_job_name = '') + THEN + SELECT NULL INTO par_job_name; + END IF; + + IF ((par_job_name IS NULL) AND (par_job_id IS NULL)) OR ((par_job_name IS NOT NULL) AND (par_job_id IS NOT NULL)) + THEN /* Failure */ + RAISE 'Supply either % or % to identify the job.', par_name_of_id_parameter, par_name_of_name_parameter USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + /* Check job id */ + IF (par_job_id IS NOT NULL) + THEN + SELECT name + , owner_sid + INTO par_job_name + , par_owner_sid + FROM sys.sysjobs + WHERE (job_id = par_job_id); + + /* the view would take care of all the permissions issues. */ + IF (par_job_name IS NULL) + THEN /* Failure */ + SELECT CAST (par_job_id AS VARCHAR(36)) + INTO var_job_id_as_char; + + RAISE 'The specified % ("%") does not exist.', 'job_id', var_job_id_as_char USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + ELSE + /* Check job name */ + IF (par_job_name IS NOT NULL) + THEN + /* Check if the job name is ambiguous */ + IF (SELECT COUNT(*) FROM sys.sysjobs WHERE name = par_job_name) > 1 + THEN /* Failure */ + RAISE 'There are two or more jobs named "%". Specify % instead of % to uniquely identify the job.', par_job_name, par_name_of_id_parameter, par_name_of_name_parameter USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + /* The name is not ambiguous, so get the corresponding job_id (if the job exists) */ + SELECT job_id + , owner_sid + INTO par_job_id + , par_owner_sid + FROM sys.sysjobs + WHERE (name = par_job_name); + + /* the view would take care of all the permissions issues. */ + IF (par_job_id IS NULL) + THEN /* Failure */ + RAISE 'The specified % ("%") does not exist.', 'job_name', par_job_name USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + END IF; + END IF; + + /* Success */ + returncode := 0; + RETURN; +END; +$body$ +LANGUAGE 'plpgsql' +STABLE; + +CREATE OR REPLACE FUNCTION sys.babelfish_sp_verify_job_time ( + par_time integer, + par_time_name varchar = 'time'::character varying, + out returncode integer +) +RETURNS integer AS +$body$ +DECLARE + var_hour INT; + var_minute INT; + var_second INT; +BEGIN + /* Remove any leading/trailing spaces from parameters */ + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_time_name)) INTO par_time_name; + + IF ((par_time < 0) OR (par_time > 235959)) + THEN + RAISE 'The specified "%" is invalid (valid values are: %).', par_time_name, '000000..235959' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + SELECT (par_time / 10000) INTO var_hour; + SELECT (par_time % 10000) / 100 INTO var_minute; + SELECT (par_time % 100) INTO var_second; + + /* Check hour range */ + IF (var_hour > 23) THEN + RAISE 'The "%" supplied has an invalid %.', par_time_name, 'hour' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + /* Check minute range */ + IF (var_minute > 59) THEN + RAISE 'The "%" supplied has an invalid %.', par_time_name, 'minute' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + /* Check second range */ + IF (var_second > 59) THEN + RAISE 'The "%" supplied has an invalid %.', par_time_name, 'second' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + returncode := 0; + RETURN; +END; +$body$ +LANGUAGE 'plpgsql' +STABLE; + +CREATE OR REPLACE FUNCTION sys.babelfish_sp_verify_jobstep ( + par_job_id integer, + par_step_id integer, + par_step_name varchar, + par_subsystem varchar, + par_command text, + par_server varchar, + par_on_success_action smallint, + par_on_success_step_id integer, + par_on_fail_action smallint, + par_on_fail_step_id integer, + par_os_run_priority integer, + par_flags integer, + par_output_file_name varchar, + par_proxy_id integer, + out returncode integer +) +AS +$body$ +DECLARE + var_max_step_id INT; + var_retval INT; + var_valid_values VARCHAR(50); + var_database_name_temp VARCHAR(258); + var_database_user_name_temp VARCHAR(256); + var_temp_command TEXT; + var_iPos INT; + var_create_count INT; + var_destroy_count INT; + var_is_olap_subsystem SMALLINT; + var_owner_sid CHAR(85); + var_owner_name VARCHAR(128); +BEGIN + /* Remove any leading/trailing spaces from parameters */ + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_subsystem)) INTO par_subsystem; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_server)) INTO par_server; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_output_file_name)) INTO par_output_file_name; + + /* Get current maximum step id */ + SELECT COALESCE(MAX(step_id), 0) + INTO var_max_step_id + FROM sys.sysjobsteps + WHERE (job_id = par_job_id); + + /* Check step id */ + IF (par_step_id < 1) OR (par_step_id > var_max_step_id + 1) /* Failure */ + THEN + SELECT '1..' || CAST (var_max_step_id + 1 AS VARCHAR(1)) INTO var_valid_values; + RAISE 'The specified "%" is invalid (valid values are: %).', '@step_id', var_valid_values USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + /* Check step name */ + IF ( + EXISTS ( + SELECT * + FROM sys.sysjobsteps + WHERE (job_id = par_job_id) AND (step_name = par_step_name) + ) + ) + THEN /* Failure */ + RAISE 'The specified % ("%") already exists.', 'step_name', par_step_name USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + /* Check on-success action/step */ + IF (par_on_success_action <> 1) /* Quit Qith Success */ + AND (par_on_success_action <> 2) /* Quit Qith Failure */ + AND (par_on_success_action <> 3) /* Goto Next Step */ + AND (par_on_success_action <> 4) /* Goto Step */ + THEN /* Failure */ + RAISE 'The specified "%" is invalid (valid values are: %).', 'on_success_action', '1, 2, 3, 4' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + IF (par_on_success_action = 4) AND ((par_on_success_step_id < 1) OR (par_on_success_step_id = par_step_id)) + THEN /* Failure */ + RAISE 'The specified "%" is invalid (valid values are greater than 0 but excluding %ld).', 'on_success_step', par_step_id USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + /* Check on-fail action/step */ + IF (par_on_fail_action <> 1) /* Quit With Success */ + AND (par_on_fail_action <> 2) /* Quit With Failure */ + AND (par_on_fail_action <> 3) /* Goto Next Step */ + AND (par_on_fail_action <> 4) /* Goto Step */ + THEN /* Failure */ + RAISE 'The specified "%" is invalid (valid values are: %).', 'on_failure_action', '1, 2, 3, 4' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + IF (par_on_fail_action = 4) AND ((par_on_fail_step_id < 1) OR (par_on_fail_step_id = par_step_id)) + THEN /* Failure */ + RAISE 'The specified "%" is invalid (valid values are greater than 0 but excluding %).', 'on_failure_step', par_step_id USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + /* Warn the user about forward references */ + IF ((par_on_success_action = 4) AND (par_on_success_step_id > var_max_step_id)) + THEN + RAISE 'Warning: Non-existent step referenced by %.', 'on_success_step_id' USING ERRCODE := '50000'; + END IF; + + IF ((par_on_fail_action = 4) AND (par_on_fail_step_id > var_max_step_id)) + THEN + RAISE 'Warning: Non-existent step referenced by %.', '@on_fail_step_id' USING ERRCODE := '50000'; + END IF; + + /* Check run priority: must be a valid value to pass to SetThreadPriority: */ + /* [-15 = IDLE, -1 = BELOW_NORMAL, 0 = NORMAL, 1 = ABOVE_NORMAL, 15 = TIME_CRITICAL] */ + IF (par_os_run_priority NOT IN (- 15, - 1, 0, 1, 15)) + THEN /* Failure */ + RAISE 'The specified "%" is invalid (valid values are: %).', '@os_run_priority', '-15, -1, 0, 1, 15' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + /* Check flags */ + IF ((par_flags < 0) OR (par_flags > 114)) THEN /* Failure */ + RAISE 'The specified "%" is invalid (valid values are: %).', '@flags', '0..114' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + IF (LOWER(UPPER(par_subsystem)) <> LOWER('TSQL')) THEN /* Failure */ + RAISE 'The specified "%" is invalid (valid values are: %).', '@subsystem', 'TSQL' USING ERRCODE := '50000'; + returncode := (1); + RETURN; + END IF; + + /* Success */ + returncode := 0; + RETURN; +END; +$body$ +LANGUAGE 'plpgsql' +STABLE; + +CREATE OR REPLACE FUNCTION sys.babelfish_sp_verify_schedule ( + par_schedule_id integer, + par_name varchar, + par_enabled smallint, + par_freq_type integer, + inout par_freq_interval integer, + inout par_freq_subday_type integer, + inout par_freq_subday_interval integer, + inout par_freq_relative_interval integer, + inout par_freq_recurrence_factor integer, + inout par_active_start_date integer, + inout par_active_start_time integer, + inout par_active_end_date integer, + inout par_active_end_time integer, + par_owner_sid char, + out returncode integer +) +RETURNS record AS +$body$ +DECLARE + var_return_code INT; + var_isAdmin INT; +BEGIN + /* Remove any leading/trailing spaces from parameters */ + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_name)) INTO par_name; + + /* Make sure that NULL input/output parameters - if NULL - are initialized to 0 */ + SELECT COALESCE(par_freq_interval, 0) INTO par_freq_interval; + SELECT COALESCE(par_freq_subday_type, 0) INTO par_freq_subday_type; + SELECT COALESCE(par_freq_subday_interval, 0) INTO par_freq_subday_interval; + SELECT COALESCE(par_freq_relative_interval, 0) INTO par_freq_relative_interval; + SELECT COALESCE(par_freq_recurrence_factor, 0) INTO par_freq_recurrence_factor; + SELECT COALESCE(par_active_start_date, 0) INTO par_active_start_date; + SELECT COALESCE(par_active_start_time, 0) INTO par_active_start_time; + SELECT COALESCE(par_active_end_date, 0) INTO par_active_end_date; + SELECT COALESCE(par_active_end_time, 0) INTO par_active_end_time; + + /* Verify name (we disallow schedules called 'ALL' since this has special meaning in sp_delete_jobschedules) */ + SELECT 0 INTO var_isAdmin; + + IF ( + EXISTS ( + SELECT * + FROM sys.sysschedules + WHERE (name = par_name) + ) + ) + THEN /* Failure */ + RAISE 'The specified % ("%") already exists.', 'par_name', par_name USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + IF (UPPER(par_name) = 'ALL') + THEN /* Failure */ + RAISE 'The specified "%" is invalid.', 'name' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + /* Verify enabled state */ + IF (par_enabled <> 0) AND (par_enabled <> 1) + THEN /* Failure */ + RAISE 'The specified "%" is invalid (valid values are: %).', '@enabled', '0, 1' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + /* Verify frequency type */ + IF (par_freq_type = 2) /* OnDemand is no longer supported */ + THEN /* Failure */ + RAISE 'Frequency Type 0x2 (OnDemand) is no longer supported.' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + IF (par_freq_type NOT IN (1, 4, 8, 16, 32, 64, 128)) + THEN /* Failure */ + RAISE 'The specified "%" is invalid (valid values are: %).', 'freq_type', '1, 4, 8, 16, 32, 64, 128' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + /* Verify frequency sub-day type */ + IF (par_freq_subday_type <> 0) AND (par_freq_subday_type NOT IN (1, 2, 4, 8)) + THEN /* Failure */ + RAISE 'The specified "%" is invalid (valid values are: %).', 'freq_subday_type', '1, 2, 4, 8' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + /* Default active start/end date/times (if not supplied, or supplied as NULLs or 0) */ + IF (par_active_start_date = 0) + THEN + SELECT date_part('year', NOW()::TIMESTAMP) * 10000 + date_part('month', NOW()::TIMESTAMP) * 100 + date_part('day', NOW()::TIMESTAMP) + INTO par_active_start_date; + END IF; + + /* This is an ISO format: "yyyymmdd" */ + IF (par_active_end_date = 0) + THEN + /* December 31st 9999 */ + SELECT 99991231 INTO par_active_end_date; + END IF; + + IF (par_active_start_time = 0) + THEN + /* 12:00:00 am */ + SELECT 000000 INTO par_active_start_time; + END IF; + + IF (par_active_end_time = 0) + THEN + /* 11:59:59 pm */ + SELECT 235959 INTO par_active_end_time; + END IF; + + /* Verify active start/end dates */ + IF (par_active_end_date = 0) + THEN + SELECT 99991231 INTO par_active_end_date; + END IF; + + SELECT t.returncode + FROM sys.babelfish_sp_verify_job_date(par_active_end_date, 'active_end_date') t + INTO var_return_code; + + IF (var_return_code <> 0) + THEN /* Failure */ + returncode := 1; + RETURN; + END IF; + + SELECT t.returncode + FROM sys.babelfish_sp_verify_job_date(par_active_start_date, '@active_start_date') t + INTO var_return_code; + + IF (var_return_code <> 0) + THEN /* Failure */ + returncode := 1; + RETURN; + END IF; + + IF (par_active_end_date < par_active_start_date) + THEN /* Failure */ + RAISE '% cannot be before %.', 'active_end_date', 'active_start_date' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + SELECT t.returncode + FROM sys.babelfish_sp_verify_job_time(par_active_end_time, '@active_end_time') t + INTO var_return_code; + + IF (var_return_code <> 0) + THEN /* Failure */ + returncode := 1; + RETURN; + END IF; + + SELECT t.returncode + FROM sys.babelfish_sp_verify_job_time(par_active_start_time, '@active_start_time') t + INTO var_return_code; + + IF (var_return_code <> 0) + THEN /* Failure */ + returncode := 1; + RETURN; + END IF; + + IF (par_active_start_time = par_active_end_time AND (par_freq_subday_type IN (2, 4, 8))) + THEN /* Failure */ + RAISE 'The specified "%" is invalid (valid values are: %).', 'active_end_time', 'before or after active_start_time' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + IF ((par_freq_type = 1) /* FREQTYPE_ONETIME */ + OR (par_freq_type = 64) /* FREQTYPE_AUTOSTART */ + OR (par_freq_type = 128)) /* FREQTYPE_ONIDLE */ + THEN /* Set standard defaults for non-required parameters */ + SELECT 0 INTO par_freq_interval; + SELECT 0 INTO par_freq_subday_type; + SELECT 0 INTO par_freq_subday_interval; + SELECT 0 INTO par_freq_relative_interval; + SELECT 0 INTO par_freq_recurrence_factor; + /* Success */ + returncode := 0; + RETURN; + END IF; + + IF (par_freq_subday_type = 0) /* FREQSUBTYPE_ONCE */ + THEN + SELECT 1 INTO par_freq_subday_type; + END IF; + + IF ((par_freq_subday_type <> 1) /* FREQSUBTYPE_ONCE */ + AND (par_freq_subday_type <> 2) /* FREQSUBTYPE_SECOND */ + AND (par_freq_subday_type <> 4) /* FREQSUBTYPE_MINUTE */ + AND (par_freq_subday_type <> 8)) /* FREQSUBTYPE_HOUR */ + THEN /* Failure */ + RAISE 'The schedule for this job is invalid (reason: The specified @freq_subday_type is invalid (valid values are: 0x1, 0x2, 0x4, 0x8).).' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + IF ((par_freq_subday_type <> 1) AND (par_freq_subday_interval < 1)) /* FREQSUBTYPE_ONCE and less than 1 interval */ + OR ((par_freq_subday_type = 2) AND (par_freq_subday_interval < 10)) /* FREQSUBTYPE_SECOND and less than 10 seconds (see MIN_SCHEDULE_GRANULARITY in SqlAgent source code) */ + THEN /* Failure */ + RAISE 'The schedule for this job is invalid (reason: The specified @freq_subday_interval is invalid).' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + IF (par_freq_type = 4) /* FREQTYPE_DAILY */ + THEN + SELECT 0 INTO par_freq_recurrence_factor; + + IF (par_freq_interval < 1) THEN /* Failure */ + RAISE 'The schedule for this job is invalid (reason: @freq_interval must be at least 1 for a daily job.).' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + END IF; + + IF (par_freq_type = 8) /* FREQTYPE_WEEKLY */ + THEN + IF (par_freq_interval < 1) OR (par_freq_interval > 127) /* (2^7)-1 [freq_interval is a bitmap (Sun=1..Sat=64)] */ + THEN /* Failure */ + RAISE 'The schedule for this job is invalid (reason: @freq_interval must be a valid day of the week bitmask [Sunday = 1 .. Saturday = 64] for a weekly job.).' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + END IF; + + IF (par_freq_type = 16) /* FREQTYPE_MONTHLY */ + THEN + IF (par_freq_interval < 1) OR (par_freq_interval > 31) + THEN /* Failure */ + RAISE 'The schedule for this job is invalid (reason: @freq_interval must be between 1 and 31 for a monthly job.).' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + END IF; + + IF (par_freq_type = 32) /* FREQTYPE_MONTHLYRELATIVE */ + THEN + IF (par_freq_relative_interval <> 1) /* RELINT_1ST */ + AND (par_freq_relative_interval <> 2) /* RELINT_2ND */ + AND (par_freq_relative_interval <> 4) /* RELINT_3RD */ + AND (par_freq_relative_interval <> 8) /* RELINT_4TH */ + AND (par_freq_relative_interval <> 16) /* RELINT_LAST */ + THEN /* Failure */ + RAISE 'The schedule for this job is invalid (reason: @freq_relative_interval must be one of 1st (0x1), 2nd (0x2), 3rd [0x4], 4th (0x8) or Last (0x10).).' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + END IF; + + IF (par_freq_type = 32) /* FREQTYPE_MONTHLYRELATIVE */ + THEN + IF (par_freq_interval <> 1) /* RELATIVE_SUN */ + AND (par_freq_interval <> 2) /* RELATIVE_MON */ + AND (par_freq_interval <> 3) /* RELATIVE_TUE */ + AND (par_freq_interval <> 4) /* RELATIVE_WED */ + AND (par_freq_interval <> 5) /* RELATIVE_THU */ + AND (par_freq_interval <> 6) /* RELATIVE_FRI */ + AND (par_freq_interval <> 7) /* RELATIVE_SAT */ + AND (par_freq_interval <> 8) /* RELATIVE_DAY */ + AND (par_freq_interval <> 9) /* RELATIVE_WEEKDAY */ + AND (par_freq_interval <> 10) /* RELATIVE_WEEKENDDAY */ + THEN /* Failure */ + RAISE 'The schedule for this job is invalid (reason: @freq_interval must be between 1 and 10 (1 = Sunday .. 7 = Saturday, 8 = Day, 9 = Weekday, 10 = Weekend-day) for a monthly-relative job.).' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + END IF; + + IF ((par_freq_type = 8) /* FREQTYPE_WEEKLY */ + OR (par_freq_type = 16) /* FREQTYPE_MONTHLY */ + OR (par_freq_type = 32)) /* FREQTYPE_MONTHLYRELATIVE */ + AND (par_freq_recurrence_factor < 1) + THEN /* Failure */ + RAISE 'The schedule for this job is invalid (reason: @freq_recurrence_factor must be at least 1.).' USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + /* Success */ + returncode := 0; + RETURN; +END; +$body$ +LANGUAGE 'plpgsql' +STABLE; + +CREATE OR REPLACE FUNCTION sys.babelfish_sp_verify_schedule_identifiers ( + par_name_of_name_parameter varchar, + par_name_of_id_parameter varchar, + inout par_schedule_name varchar, + inout par_schedule_id integer, + inout par_owner_sid char, + inout par_orig_server_id integer, + par_job_id_filter integer = NULL::integer, + out returncode integer +) +AS +$body$ +DECLARE + var_retval INT; + var_schedule_id_as_char VARCHAR(36); + var_sch_name_count INT; +BEGIN + /* Remove any leading/trailing spaces from parameters */ + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_name_of_name_parameter)) INTO par_name_of_name_parameter; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_name_of_id_parameter)) INTO par_name_of_id_parameter; + SELECT PG_CATALOG.LTRIM(PG_CATALOG.RTRIM(par_schedule_name)) INTO par_schedule_name; + SELECT 0 INTO var_sch_name_count; + + IF (par_schedule_name = '') + THEN + SELECT NULL INTO par_schedule_name; + END IF; + + IF ((par_schedule_name IS NULL) AND (par_schedule_id IS NULL)) OR ((par_schedule_name IS NOT NULL) AND (par_schedule_id IS NOT NULL)) + THEN /* Failure */ + RAISE 'Supply either % or % to identify the schedule.', par_name_of_id_parameter, par_name_of_name_parameter USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + /* Check schedule id */ + IF (par_schedule_id IS NOT NULL) + THEN + /* Look at all schedules */ + SELECT name + , owner_sid + , originating_server_id + INTO par_schedule_name + , par_owner_sid + , par_orig_server_id + FROM sys.sysschedules + WHERE (schedule_id = par_schedule_id); + + IF (par_schedule_name IS NULL) + THEN /* Failure */ + SELECT CAST (par_schedule_id AS VARCHAR(36)) + INTO var_schedule_id_as_char; + + RAISE 'The specified % ("%") does not exist.', 'schedule_id', var_schedule_id_as_char USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + ELSE + IF (par_schedule_name IS NOT NULL) + THEN + /* Check if the schedule name is ambiguous */ + IF (SELECT COUNT(*) FROM sys.sysschedules WHERE name = par_schedule_name) > 1 + THEN /* Failure */ + RAISE 'There are two or more sysschedules named "%". Specify % instead of % to uniquely identify the sysschedules.', par_job_name, par_name_of_id_parameter, par_name_of_name_parameter USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + + /* The name is not ambiguous, so get the corresponding job_id (if the job exists) */ + SELECT schedule_id + , owner_sid + INTO par_schedule_id, par_owner_sid + FROM sys.sysschedules + WHERE (name = par_schedule_name); + + /* the view would take care of all the permissions issues. */ + IF (par_schedule_id IS NULL) + THEN /* Failure */ + RAISE 'The specified % ("%") does not exist.', 'par_schedule_name', par_schedule_name USING ERRCODE := '50000'; + returncode := 1; + RETURN; + END IF; + END IF; + END IF; + + /* Success */ + returncode := 0; + RETURN; +END; +$body$ +LANGUAGE 'plpgsql' +STABLE; + +CREATE OR REPLACE FUNCTION babelfish_get_name_delimiter_pos(name TEXT) +RETURNS INTEGER +AS $$ +DECLARE + pos int; +BEGIN + IF (length(name) <= 2 AND (position('"' IN name) != 0 OR position(']' IN name) != 0 OR position('[' IN name) != 0)) + -- invalid name + THEN RETURN 0; + ELSIF PG_CATALOG.left(name, 1) = '[' THEN + pos = position('].' IN name); + IF pos = 0 THEN + -- invalid name + RETURN 0; + ELSE + RETURN pos + 1; + END IF; + ELSIF PG_CATALOG.left(name, 1) = '"' THEN + -- search from position 1 in case name starts with a double quote. + pos = position('".' IN PG_CATALOG.right(name, length(name) - 1)); + IF pos = 0 THEN + -- invalid name + RETURN 0; + ELSE + RETURN pos + 2; + END IF; + ELSE + RETURN position('.' IN name); + END IF; +END; +$$ +LANGUAGE plpgsql +STABLE; + +-- valid names are db_name.schema_name.object_name or schema_name.object_name or object_name +CREATE OR REPLACE FUNCTION sys.babelfish_split_object_name( + name TEXT, + OUT db_name TEXT, + OUT schema_name TEXT, + OUT object_name TEXT) +AS $$ +DECLARE + lower_object_name text; + names text[2]; + counter int; + cur_pos int; +BEGIN + lower_object_name = lower(PG_CATALOG.rtrim(name)); + + counter = 1; + cur_pos = babelfish_get_name_delimiter_pos(lower_object_name); + + -- Parse user input into names split by '.' + WHILE cur_pos > 0 LOOP + IF counter > 3 THEN + -- Too many names provided + RETURN; + END IF; + + names[counter] = babelfish_remove_delimiter_pair(PG_CATALOG.rtrim(PG_CATALOG.left(lower_object_name, cur_pos - 1))); + + -- invalid name + IF names[counter] IS NULL THEN + RETURN; + END IF; + + lower_object_name = substring(lower_object_name from cur_pos + 1); + counter = counter + 1; + cur_pos = babelfish_get_name_delimiter_pos(lower_object_name); + END LOOP; + + CASE counter + WHEN 1 THEN + db_name = NULL; + schema_name = NULL; + WHEN 2 THEN + db_name = NULL; + schema_name = sys.babelfish_truncate_identifier(names[1]); + WHEN 3 THEN + db_name = sys.babelfish_truncate_identifier(names[1]); + schema_name = sys.babelfish_truncate_identifier(names[2]); + ELSE + RETURN; + END CASE; + + -- Assign each name accordingly + object_name = sys.babelfish_truncate_identifier(babelfish_remove_delimiter_pair(PG_CATALOG.rtrim(lower_object_name))); +END; +$$ +LANGUAGE plpgsql +STABLE; + +CREATE OR REPLACE FUNCTION sys.timezone(IN tzzone PG_CATALOG.TEXT , IN input_expr anyelement) +RETURNS sys.datetimeoffset +AS +$BODY$ +DECLARE + tz_offset PG_CATALOG.TEXT; + tz_name PG_CATALOG.TEXT; + lower_tzn PG_CATALOG.TEXT; + prev_res PG_CATALOG.TEXT; + result PG_CATALOG.TEXT; + is_dstt bool; + tz_diff PG_CATALOG.TEXT; + input_expr_tx PG_CATALOG.TEXT; + input_expr_tmz TIMESTAMPTZ; +BEGIN + IF input_expr IS NULL OR tzzone IS NULL THEN + RETURN NULL; + END IF; + + lower_tzn := lower(tzzone); + IF lower_tzn <> 'utc' THEN + tz_name := sys.babelfish_timezone_mapping(lower_tzn); + ELSE + tz_name := 'utc'; + END IF; + + IF tz_name = 'NULL' THEN + RAISE USING MESSAGE := format('Argument data type or the parameter %s provided to AT TIME ZONE clause is invalid.', tzzone); + END IF; + + IF pg_typeof(input_expr) IN ('sys.smalldatetime'::regtype, 'sys.datetime'::regtype, 'sys.datetime2'::regtype) THEN + input_expr_tx := input_expr::TEXT; + input_expr_tmz := input_expr_tx :: TIMESTAMPTZ; + + result := (SELECT input_expr_tmz AT TIME ZONE tz_name)::TEXT; + tz_diff := (SELECT result::TIMESTAMPTZ - input_expr_tmz)::TEXT; + if PG_CATALOG.LEFT(tz_diff,1) <> '-' THEN + tz_diff := concat('+',tz_diff); + END IF; + tz_offset := PG_CATALOG.left(tz_diff,6); + input_expr_tx := concat(input_expr_tx,tz_offset); + return cast(input_expr_tx as sys.datetimeoffset); + ELSIF pg_typeof(input_expr) = 'sys.DATETIMEOFFSET'::regtype THEN + input_expr_tx := input_expr::TEXT; + input_expr_tmz := input_expr_tx :: TIMESTAMPTZ; + result := (SELECT input_expr_tmz AT TIME ZONE tz_name)::TEXT; + tz_diff := (SELECT result::TIMESTAMPTZ - input_expr_tmz)::TEXT; + if PG_CATALOG.LEFT(tz_diff,1) <> '-' THEN + tz_diff := concat('+',tz_diff); + END IF; + tz_offset := PG_CATALOG.left(tz_diff,6); + result := concat(result,tz_offset); + return cast(result as sys.datetimeoffset); + ELSE + RAISE USING MESSAGE := 'Argument data type varchar is invalid for argument 1 of AT TIME ZONE function.'; + END IF; + +END; +$BODY$ +LANGUAGE 'plpgsql' STABLE; + +CREATE OR REPLACE FUNCTION sys.patindex_ai_collations(in pattern character varying, in expression character varying) returns bigint +AS 'babelfishpg_tsql', 'patindex_ai_collations' +LANGUAGE C +IMMUTABLE STRICT; + +create or replace function sys.PATINDEX(in pattern varchar, in expression varchar) returns bigint as +$body$ +declare + v_find_result VARCHAR; + v_pos bigint; + v_regexp_pattern VARCHAR; +begin + if pattern is null or expression is null then + return null; + end if; + if sys.is_collated_ai(expression) then + return sys.patindex_ai_collations(pattern, expression); + end if; + if PG_CATALOG.left(pattern, 1) = '%' collate sys.database_default then + v_regexp_pattern := regexp_replace(pattern, '^%', '%#"', 'i'); + else + v_regexp_pattern := '#"' || pattern; + end if; + + if PG_CATALOG.right(pattern, 1) = '%' collate sys.database_default then + v_regexp_pattern := regexp_replace(v_regexp_pattern, '%$', '#"%', 'i'); + else + v_regexp_pattern := v_regexp_pattern || '#"'; + end if; + v_find_result := substring(expression, v_regexp_pattern, '#'); + if v_find_result <> '' collate sys.database_default then + v_pos := strpos(expression, v_find_result); + else + v_pos := 0; + end if; + return v_pos; +end; +$body$ +language plpgsql immutable returns null on null input; + +CREATE OR REPLACE FUNCTION sys.has_perms_by_name( + securable SYS.SYSNAME, + securable_class SYS.NVARCHAR(60), + permission SYS.SYSNAME, + sub_securable SYS.SYSNAME DEFAULT NULL, + sub_securable_class SYS.NVARCHAR(60) DEFAULT NULL +) +RETURNS integer +LANGUAGE plpgsql +STABLE +AS $$ +DECLARE + db_name text COLLATE sys.database_default; + bbf_schema_name text; + pg_schema text COLLATE sys.database_default; + implied_dbo_permissions boolean; + fully_supported boolean; + is_cross_db boolean := false; + object_name text COLLATE sys.database_default; + database_id smallint; + namespace_id oid; + userid oid; + object_type text; + function_signature text; + qualified_name text; + return_value integer; + cs_as_securable text COLLATE "C" := securable; + cs_as_securable_class text COLLATE "C" := securable_class; + cs_as_permission text COLLATE "C" := permission; + cs_as_sub_securable text COLLATE "C" := sub_securable; + cs_as_sub_securable_class text COLLATE "C" := sub_securable_class; +BEGIN + return_value := NULL; + + -- Lower-case to avoid case issues, remove trailing whitespace to match SQL SERVER behavior + -- Objects created in Babelfish are stored in lower-case in pg_class/pg_proc + cs_as_securable = lower(PG_CATALOG.rtrim(cs_as_securable)); + cs_as_securable_class = lower(PG_CATALOG.rtrim(cs_as_securable_class)); + cs_as_permission = lower(PG_CATALOG.rtrim(cs_as_permission)); + cs_as_sub_securable = lower(PG_CATALOG.rtrim(cs_as_sub_securable)); + cs_as_sub_securable_class = lower(PG_CATALOG.rtrim(cs_as_sub_securable_class)); + + -- Assert that sub_securable and sub_securable_class are either both NULL or both defined + IF cs_as_sub_securable IS NOT NULL AND cs_as_sub_securable_class IS NULL THEN + RETURN NULL; + ELSIF cs_as_sub_securable IS NULL AND cs_as_sub_securable_class IS NOT NULL THEN + RETURN NULL; + -- If they are both defined, user must be evaluating column privileges. + -- Check that inputs are valid for column privileges: sub_securable_class must + -- be column, securable_class must be object, and permission cannot be any. + ELSIF cs_as_sub_securable_class IS NOT NULL + AND (cs_as_sub_securable_class != 'column' + OR cs_as_securable_class IS NULL + OR cs_as_securable_class != 'object' + OR cs_as_permission = 'any') THEN + RETURN NULL; + + -- If securable is null, securable_class must be null + ELSIF cs_as_securable IS NULL AND cs_as_securable_class IS NOT NULL THEN + RETURN NULL; + -- If securable_class is null, securable must be null + ELSIF cs_as_securable IS NOT NULL AND cs_as_securable_class IS NULL THEN + RETURN NULL; + END IF; + + IF cs_as_securable_class = 'server' THEN + -- SQL Server does not permit a securable_class value of 'server'. + -- securable_class should be NULL to evaluate server permissions. + RETURN NULL; + ELSIF cs_as_securable_class IS NULL THEN + -- NULL indicates a server permission. Set this variable so that we can + -- search for the matching entry in babelfish_has_perms_by_name_permissions + cs_as_securable_class = 'server'; + END IF; + + IF cs_as_sub_securable IS NOT NULL THEN + cs_as_sub_securable := babelfish_remove_delimiter_pair(cs_as_sub_securable); + IF cs_as_sub_securable IS NULL THEN + RETURN NULL; + END IF; + END IF; + + SELECT p.implied_dbo_permissions,p.fully_supported + INTO implied_dbo_permissions,fully_supported + FROM babelfish_has_perms_by_name_permissions p + WHERE p.securable_type = cs_as_securable_class AND p.permission_name = cs_as_permission; + + IF implied_dbo_permissions IS NULL OR fully_supported IS NULL THEN + -- Securable class or permission is not valid, or permission is not valid for given securable + RETURN NULL; + END IF; + + IF cs_as_securable_class = 'database' AND cs_as_securable IS NOT NULL THEN + db_name = babelfish_remove_delimiter_pair(cs_as_securable); + IF db_name IS NULL THEN + RETURN NULL; + ELSIF (SELECT COUNT(name) FROM sys.databases WHERE name = db_name) != 1 THEN + RETURN 0; + END IF; + ELSIF cs_as_securable_class = 'schema' THEN + bbf_schema_name = babelfish_remove_delimiter_pair(cs_as_securable); + IF bbf_schema_name IS NULL THEN + RETURN NULL; + ELSIF (SELECT COUNT(nspname) FROM sys.babelfish_namespace_ext ext + WHERE ext.orig_name = bbf_schema_name + AND ext.dbid = sys.db_id()) != 1 THEN + RETURN 0; + END IF; + END IF; + + IF fully_supported = 'f' AND + (SELECT orig_username FROM sys.babelfish_authid_user_ext WHERE rolname = CURRENT_USER) = 'dbo' THEN + RETURN CAST(implied_dbo_permissions AS integer); + ELSIF fully_supported = 'f' THEN + RETURN 0; + END IF; + + -- The only permissions that are fully supported belong to the OBJECT securable class. + -- The block above has dealt with all permissions that are not fully supported, so + -- if we reach this point we know the securable class is OBJECT. + SELECT s.db_name, s.schema_name, s.object_name INTO db_name, bbf_schema_name, object_name + FROM babelfish_split_object_name(cs_as_securable) s; + + -- Invalid securable name + IF object_name IS NULL OR object_name = '' THEN + RETURN NULL; + END IF; + + -- If schema was not specified, use the default + IF bbf_schema_name IS NULL OR bbf_schema_name = '' THEN + bbf_schema_name := sys.schema_name(); + END IF; + + database_id := ( + SELECT CASE + WHEN db_name IS NULL OR db_name = '' THEN (sys.db_id()) + ELSE (sys.db_id(db_name)) + END); + + IF database_id <> sys.db_id() THEN + is_cross_db = true; + END IF; + + userid := ( + SELECT CASE + WHEN is_cross_db THEN sys.suser_id() + ELSE sys.user_id() + END); + + -- Translate schema name from bbf to postgres, e.g. dbo -> master_dbo + pg_schema := (SELECT nspname + FROM sys.babelfish_namespace_ext ext + WHERE ext.orig_name = bbf_schema_name + AND CAST(ext.dbid AS oid) = CAST(database_id AS oid)); + + IF pg_schema IS NULL THEN + -- Shared schemas like sys and pg_catalog do not exist in the table above. + -- These schemas do not need to be translated from Babelfish to Postgres + pg_schema := bbf_schema_name; + END IF; + + -- Surround with double-quotes to handle names that contain periods/spaces + qualified_name := concat('"', pg_schema, '"."', object_name, '"'); + + SELECT oid INTO namespace_id FROM pg_catalog.pg_namespace WHERE nspname = pg_schema COLLATE sys.database_default; + + object_type := ( + SELECT CASE + WHEN cs_as_sub_securable_class = 'column' + THEN CASE + WHEN (SELECT count(a.attname) + FROM pg_attribute a + INNER JOIN pg_class c ON c.oid = a.attrelid + INNER JOIN pg_namespace s ON s.oid = c.relnamespace + WHERE + a.attname = cs_as_sub_securable COLLATE sys.database_default + AND c.relname = object_name COLLATE sys.database_default + AND s.nspname = pg_schema COLLATE sys.database_default + AND NOT a.attisdropped + AND (s.nspname IN (SELECT nspname FROM sys.babelfish_namespace_ext) OR s.nspname = 'sys') + -- r = ordinary table, i = index, S = sequence, t = TOAST table, v = view, m = materialized view, c = composite type, f = foreign table, p = partitioned table + AND c.relkind IN ('r', 'v', 'm', 'f', 'p') + AND a.attnum > 0) = 1 + THEN 'column' + ELSE NULL + END + + WHEN (SELECT count(relname) + FROM pg_catalog.pg_class + WHERE relname = object_name COLLATE sys.database_default + AND relnamespace = namespace_id) = 1 + THEN 'table' + + WHEN (SELECT count(proname) + FROM pg_catalog.pg_proc + WHERE proname = object_name COLLATE sys.database_default + AND pronamespace = namespace_id + AND prokind = 'f') = 1 + THEN 'function' + + WHEN (SELECT count(proname) + FROM pg_catalog.pg_proc + WHERE proname = object_name COLLATE sys.database_default + AND pronamespace = namespace_id + AND prokind = 'p') = 1 + THEN 'procedure' + ELSE NULL + END + ); + + -- Object was not found + IF object_type IS NULL THEN + RETURN 0; + END IF; + + -- Get signature for function-like objects + IF object_type IN('function', 'procedure') THEN + SELECT CAST(oid AS regprocedure) + INTO function_signature + FROM pg_catalog.pg_proc + WHERE proname = object_name COLLATE sys.database_default + AND pronamespace = namespace_id; + END IF; + + return_value := ( + SELECT CASE + WHEN cs_as_permission = 'any' THEN babelfish_has_any_privilege(userid, object_type, pg_schema, object_name) + + WHEN object_type = 'column' + THEN CASE + WHEN cs_as_permission IN('insert', 'delete', 'execute') THEN NULL + ELSE CAST(has_column_privilege(userid, qualified_name, cs_as_sub_securable, cs_as_permission) AS integer) + END + + WHEN object_type = 'table' + THEN CASE + WHEN cs_as_permission = 'execute' THEN 0 + ELSE CAST(has_table_privilege(userid, qualified_name, cs_as_permission) AS integer) + END + + WHEN object_type = 'function' + THEN CASE + WHEN cs_as_permission IN('select', 'execute') + THEN CAST(has_function_privilege(userid, function_signature, 'execute') AS integer) + WHEN cs_as_permission IN('update', 'insert', 'delete', 'references') + THEN 0 + ELSE NULL + END + + WHEN object_type = 'procedure' + THEN CASE + WHEN cs_as_permission = 'execute' + THEN CAST(has_function_privilege(userid, function_signature, 'execute') AS integer) + WHEN cs_as_permission IN('select', 'update', 'insert', 'delete', 'references') + THEN 0 + ELSE NULL + END + + ELSE NULL + END + ); + + RETURN return_value; + EXCEPTION WHEN OTHERS THEN RETURN NULL; +END; +$$; + +CREATE OR REPLACE FUNCTION OBJECTPROPERTYEX( + id INT, + property SYS.VARCHAR +) +RETURNS SYS.SQL_VARIANT +AS $$ +BEGIN + property := PG_CATALOG.RTRIM(LOWER(COALESCE(property, ''))); + + IF NOT EXISTS(SELECT ao.object_id FROM sys.all_objects ao WHERE object_id = id) + THEN + RETURN NULL; + END IF; + + IF property = 'basetype' -- BaseType + THEN + RETURN (SELECT CAST(ao.type AS SYS.SQL_VARIANT) + FROM sys.all_objects ao + WHERE ao.object_id = id + LIMIT 1 + ); + END IF; + + RETURN CAST(OBJECTPROPERTY(id, property) AS SYS.SQL_VARIANT); +END +$$ +LANGUAGE plpgsql STABLE; + +CREATE OR REPLACE FUNCTION sys.date_bucket(IN datepart PG_CATALOG.TEXT, IN number INTEGER, IN date ANYELEMENT, IN origin ANYELEMENT default NULL) RETURNS ANYELEMENT +AS +$body$ +DECLARE + required_bucket INT; + years_diff INT; + quarters_diff INT; + months_diff INT; + hours_diff INT; + minutes_diff INT; + seconds_diff INT; + milliseconds_diff INT; + timezone INT; + result_time time; + result_date timestamp; + offset_string PG_CATALOG.text; + date_difference_interval INTERVAL; + millisec_trunc_diff_interval INTERVAL; + date_arg_datatype regtype; + is_valid boolean; +BEGIN + BEGIN + date_arg_datatype := pg_typeof(date); + is_valid := sys.date_bucket_internal_helper(datepart, number, true, true, date); + + -- If optional argument origin's value is not provided by user then set it's default value of valid datatype. + IF origin IS NULL THEN + IF date_arg_datatype = 'sys.datetime'::regtype THEN + origin := CAST('1900-01-01 00:00:00.000' AS sys.datetime); + ELSIF date_arg_datatype = 'sys.datetime2'::regtype THEN + origin := CAST('1900-01-01 00:00:00.000' AS sys.datetime2); + ELSIF date_arg_datatype = 'sys.datetimeoffset'::regtype THEN + origin := CAST('1900-01-01 00:00:00.000' AS sys.datetimeoffset); + ELSIF date_arg_datatype = 'sys.smalldatetime'::regtype THEN + origin := CAST('1900-01-01 00:00:00.000' AS sys.smalldatetime); + ELSIF date_arg_datatype = 'date'::regtype THEN + origin := CAST('1900-01-01 00:00:00.000' AS pg_catalog.date); + ELSIF date_arg_datatype = 'time'::regtype THEN + origin := CAST('00:00:00.000' AS pg_catalog.time); + END IF; + END IF; + END; + + /* support of date_bucket() for different kinds of date datatype starts here */ + -- support of date_bucket() when date is of 'time' datatype + IF date_arg_datatype = 'time'::regtype THEN + -- Find interval between date and origin and extract hour, minute, second, millisecond from the interval + date_difference_interval := date_trunc('millisecond', date) - date_trunc('millisecond', origin); + hours_diff := EXTRACT('hour' from date_difference_interval)::INT; + minutes_diff := EXTRACT('minute' from date_difference_interval)::INT; + seconds_diff := FLOOR(EXTRACT('second' from date_difference_interval))::INT; + milliseconds_diff := FLOOR(EXTRACT('millisecond' from date_difference_interval))::INT; + CASE datepart + WHEN 'hour' THEN + -- Here we are finding how many buckets we have to add in the origin so that we can reach to a bucket in which date belongs. + -- For cases where origin > date, we might end up in a bucket which exceeds date by 1 bucket. + -- For Ex. 'date_bucket(hour, 2, '01:00:00', '08:00:00')' hence check if the result_time is greater then date + -- For comparision we are trunceting the result_time to milliseconds + required_bucket := hours_diff/number; + result_time := origin + make_interval(hours => required_bucket * number); + IF date_trunc('millisecond', result_time) > date THEN + RETURN result_time - make_interval(hours => number); + END IF; + RETURN result_time; + + WHEN 'minute' THEN + required_bucket := (hours_diff * 60 + minutes_diff)/number; + result_time := origin + make_interval(mins => required_bucket * number); + IF date_trunc('millisecond', result_time) > date THEN + RETURN result_time - make_interval(mins => number); + END IF; + RETURN result_time; + + WHEN 'second' THEN + required_bucket := ((hours_diff * 60 + minutes_diff) * 60 + seconds_diff)/number; + result_time := origin + make_interval(secs => required_bucket * number); + IF date_trunc('millisecond', result_time) > date THEN + RETURN result_time - make_interval(secs => number); + END IF; + RETURN result_time; + + WHEN 'millisecond' THEN + required_bucket := (((hours_diff * 60 + minutes_diff) * 60) * 1000 + milliseconds_diff)/number; + result_time := origin + make_interval(secs => ((required_bucket * number)::numeric) * 0.001); + IF date_trunc('millisecond', result_time) > date THEN + RETURN result_time - make_interval(secs => (number::numeric) * 0.001); + END IF; + RETURN result_time; + END CASE; + + -- support of date_bucket() when date is of {'datetime2', 'datetimeoffset'} datatype + -- handling separately because both the datatypes have precision in milliseconds + ELSIF date_arg_datatype IN ('sys.datetime2'::regtype, 'sys.datetimeoffset'::regtype) THEN + -- when datepart is {year, quarter, month} make use of AGE() function to find number of buckets + IF datepart IN ('year', 'quarter', 'month') THEN + date_difference_interval := AGE(date_trunc('day', date::timestamp), date_trunc('day', origin::timestamp)); + years_diff := EXTRACT('Year' from date_difference_interval)::INT; + months_diff := EXTRACT('Month' from date_difference_interval)::INT; + CASE datepart + WHEN 'year' THEN + -- Here we are finding how many buckets we have to add in the origin so that we can reach to a bucket in which date belongs. + -- For cases where origin > date, we might end up in a bucket which exceeds date by 1 bucket. + -- For Ex. date_bucket(year, 2, '2010-01-01', '2019-01-01')) hence check if the result_time is greater then date. + -- For comparision we are trunceting the result_time to milliseconds + required_bucket := years_diff/number; + result_date := origin::timestamp + make_interval(years => required_bucket * number); + IF result_date > date::timestamp THEN + result_date = result_date - make_interval(years => number); + END IF; + + WHEN 'month' THEN + required_bucket := (12 * years_diff + months_diff)/number; + result_date := origin::timestamp + make_interval(months => required_bucket * number); + IF result_date > date::timestamp THEN + result_date = result_date - make_interval(months => number); + END IF; + + WHEN 'quarter' THEN + quarters_diff := (12 * years_diff + months_diff)/3; + required_bucket := quarters_diff/number; + result_date := origin::timestamp + make_interval(months => required_bucket * number * 3); + IF result_date > date::timestamp THEN + result_date = result_date - make_interval(months => number*3); + END IF; + END CASE; + + -- when datepart is {week, day, hour, minute, second, millisecond} make use of built-in date_bin() postgresql function. + ELSE + -- trunceting origin to millisecond before passing it to date_bin() function. + -- store the difference between origin and trunceted origin to add it in the result of date_bin() function + date_difference_interval := concat(number, ' ', datepart)::INTERVAL; + millisec_trunc_diff_interval := (origin::timestamp - date_trunc('millisecond', origin::timestamp))::interval; + result_date = date_bin(date_difference_interval, date::timestamp, date_trunc('millisecond', origin::timestamp)) + millisec_trunc_diff_interval; + + -- Filetering cases where the required bucket ends at date then date_bin() gives start point of this bucket as result. + IF result_date + date_difference_interval <= date::timestamp THEN + result_date = result_date + date_difference_interval; + END IF; + END IF; + + -- All the above operations are performed by converting every date datatype into TIMESTAMPS. + -- datetimeoffset is typecasted into TIMESTAMPS that changes the value. + -- Ex. '2023-02-23 09:19:21.23 +10:12'::sys.datetimeoffset::timestamp => '2023-02-22 23:07:21.23' + -- The output of date_bucket() for datetimeoffset datatype will always be in the same time-zone as of provided date argument. + -- Here, converting TIMESTAMP into datetimeoffset datatype with the same timezone as of date argument. + IF date_arg_datatype = 'sys.datetimeoffset'::regtype THEN + timezone = sys.babelfish_get_datetimeoffset_tzoffset(date)::INTEGER; + offset_string = PG_CATALOG.right(date::PG_CATALOG.TEXT, 6); + result_date = result_date + make_interval(mins => timezone); + RETURN concat(result_date, ' ', offset_string)::sys.datetimeoffset; + ELSE + RETURN result_date; + END IF; + + -- support of date_bucket() when date is of {'date', 'datetime', 'smalldatetime'} datatype + ELSE + -- Round datetime to fixed bins (e.g. .000, .003, .007) + IF date_arg_datatype = 'sys.datetime'::regtype THEN + date := sys.babelfish_conv_string_to_datetime('DATETIME', date::TEXT)::sys.datetime; + origin := sys.babelfish_conv_string_to_datetime('DATETIME', origin::TEXT)::sys.datetime; + END IF; + -- when datepart is {year, quarter, month} make use of AGE() function to find number of buckets + IF datepart IN ('year', 'quarter', 'month') THEN + date_difference_interval := AGE(date_trunc('day', date::timestamp), date_trunc('day', origin::timestamp)); + years_diff := EXTRACT('Year' from date_difference_interval)::INT; + months_diff := EXTRACT('Month' from date_difference_interval)::INT; + CASE datepart + WHEN 'year' THEN + -- Here we are finding how many buckets we have to add in the origin so that we can reach to a bucket in which date belongs. + -- For cases where origin > date, we might end up in a bucket which exceeds date by 1 bucket. + -- For Example. date_bucket(year, 2, '2010-01-01', '2019-01-01') hence check if the result_time is greater then date. + -- For comparision we are trunceting the result_time to milliseconds + required_bucket := years_diff/number; + result_date := origin::timestamp + make_interval(years => required_bucket * number); + IF result_date > date::timestamp THEN + result_date = result_date - make_interval(years => number); + END IF; + + WHEN 'month' THEN + required_bucket := (12 * years_diff + months_diff)/number; + result_date := origin::timestamp + make_interval(months => required_bucket * number); + IF result_date > date::timestamp THEN + result_date = result_date - make_interval(months => number); + END IF; + + WHEN 'quarter' THEN + quarters_diff := (12 * years_diff + months_diff)/3; + required_bucket := quarters_diff/number; + result_date := origin::timestamp + make_interval(months => required_bucket * number * 3); + IF result_date > date::timestamp THEN + result_date = result_date - make_interval(months => number * 3); + END IF; + END CASE; + RETURN result_date; + + -- when datepart is {week, day, hour, minute, second, millisecond} make use of built-in date_bin() postgresql function. + ELSE + -- trunceting origin to millisecond before passing it to date_bin() function. + -- store the difference between origin and trunceted origin to add it in the result of date_bin() function + date_difference_interval := concat(number, ' ', datepart)::INTERVAL; + result_date = date_bin(date_difference_interval, date::TIMESTAMP, origin::TIMESTAMP); + -- Filetering cases where the required bucket ends at date then date_bin() gives start point of this bucket as result. + IF result_date + date_difference_interval <= date::TIMESTAMP THEN + result_date = result_date + date_difference_interval; + END IF; + RETURN result_date; + END IF; + END IF; +END; +$body$ +LANGUAGE plpgsql IMMUTABLE; + +CREATE OR REPLACE FUNCTION sys.DATETRUNC(IN datepart PG_CATALOG.TEXT, IN date ANYELEMENT) RETURNS ANYELEMENT AS +$body$ +DECLARE + days_offset INT; + v_day INT; + result_date timestamp; + input_expr_timestamp timestamp; + date_arg_datatype regtype; + offset_string PG_CATALOG.TEXT; + datefirst_value INT; +BEGIN + BEGIN + /* perform input validation */ + date_arg_datatype := pg_typeof(date); + IF datepart NOT IN ('year', 'quarter', 'month', 'week', 'tsql_week', 'hour', 'minute', 'second', 'millisecond', 'microsecond', + 'doy', 'day', 'nanosecond', 'tzoffset') THEN + RAISE EXCEPTION '''%'' is not a recognized datetrunc option.', datepart; + ELSIF date_arg_datatype NOT IN ('date'::regtype, 'time'::regtype, 'sys.datetime'::regtype, 'sys.datetime2'::regtype, + 'sys.datetimeoffset'::regtype, 'sys.smalldatetime'::regtype) THEN + RAISE EXCEPTION 'Argument data type ''%'' is invalid for argument 2 of datetrunc function.', date_arg_datatype; + ELSIF datepart IN ('nanosecond', 'tzoffset') THEN + RAISE EXCEPTION 'The datepart ''%'' is not supported by date function datetrunc for data type ''%''.',datepart, date_arg_datatype; + ELSIF datepart IN ('dow') THEN + RAISE EXCEPTION 'The datepart ''weekday'' is not supported by date function datetrunc for data type ''%''.', date_arg_datatype; + ELSIF date_arg_datatype = 'date'::regtype AND datepart IN ('hour', 'minute', 'second', 'millisecond', 'microsecond') THEN + RAISE EXCEPTION 'The datepart ''%'' is not supported by date function datetrunc for data type ''date''.', datepart; + ELSIF date_arg_datatype = 'datetime'::regtype AND datepart IN ('microsecond') THEN + RAISE EXCEPTION 'The datepart ''%'' is not supported by date function datetrunc for data type ''datetime''.', datepart; + ELSIF date_arg_datatype = 'smalldatetime'::regtype AND datepart IN ('millisecond', 'microsecond') THEN + RAISE EXCEPTION 'The datepart ''%'' is not supported by date function datetrunc for data type ''smalldatetime''.', datepart; + ELSIF date_arg_datatype = 'time'::regtype THEN + IF datepart IN ('year', 'quarter', 'month', 'doy', 'day', 'week', 'tsql_week') THEN + RAISE EXCEPTION 'The datepart ''%'' is not supported by date function datetrunc for data type ''time''.', datepart; + END IF; + -- Limitation in determining if the specified fractional scale (if provided any) for time datatype is + -- insufficient to support provided datepart (millisecond, microsecond) value + ELSIF date_arg_datatype IN ('datetime2'::regtype, 'datetimeoffset'::regtype) THEN + -- Limitation in determining if the specified fractional scale (if provided any) for the above datatype is + -- insufficient to support for provided datepart (millisecond, microsecond) value + END IF; + + /* input validation is complete, proceed with result calculation. */ + IF date_arg_datatype = 'time'::regtype THEN + RETURN date_trunc(datepart, date); + ELSE + input_expr_timestamp = date::timestamp; + -- preserving offset_string value in the case of datetimeoffset datatype before converting it to timestamps + IF date_arg_datatype = 'sys.datetimeoffset'::regtype THEN + offset_string = PG_CATALOG.RIGHT(date::PG_CATALOG.TEXT, 6); + input_expr_timestamp := PG_CATALOG.LEFT(date::PG_CATALOG.TEXT, -6)::timestamp; + END IF; + CASE + WHEN datepart IN ('year', 'quarter', 'month', 'week', 'hour', 'minute', 'second', 'millisecond', 'microsecond') THEN + result_date := date_trunc(datepart, input_expr_timestamp); + WHEN datepart IN ('doy', 'day') THEN + result_date := date_trunc('day', input_expr_timestamp); + WHEN datepart IN ('tsql_week') THEN + -- sql server datepart 'iso_week' is similar to postgres 'week' datepart + -- handle sql server datepart 'week' here based on the value of set variable 'DATEFIRST' + v_day := EXTRACT(dow from input_expr_timestamp)::INT; + datefirst_value := current_setting('babelfishpg_tsql.datefirst')::INT; + IF v_day = 0 THEN + v_day := 7; + END IF; + result_date := date_trunc('day', input_expr_timestamp); + days_offset := (7 + v_day - datefirst_value)%7; + result_date := result_date - make_interval(days => days_offset); + END CASE; + -- concat offset_string to result_date in case of datetimeoffset before converting it to datetimeoffset datatype. + IF date_arg_datatype = 'sys.datetimeoffset'::regtype THEN + RETURN concat(result_date, ' ', offset_string)::sys.datetimeoffset; + ELSE + RETURN result_date; + END IF; + END IF; + END; +END; +$body$ +LANGUAGE plpgsql STABLE; + +CREATE OR REPLACE FUNCTION sys.bbf_get_immediate_base_type_of_UDT(OID) +RETURNS OID +AS 'babelfishpg_tsql', 'get_immediate_base_type_of_UDT' +LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +-- wrapper functions for reverse +CREATE OR REPLACE FUNCTION sys.reverse(string ANYELEMENT) +RETURNS sys.VARCHAR +AS +$BODY$ +DECLARE + string_arg_datatype text; + string_arg_typeid oid; + string_basetype oid; +BEGIN + string_arg_typeid := pg_typeof(string)::oid; + string_arg_datatype := sys.translate_pg_type_to_tsql(string_arg_typeid); + IF string_arg_datatype IS NULL THEN + -- for User Defined Datatype, use immediate base type to check for argument datatype validation + string_basetype := sys.bbf_get_immediate_base_type_of_UDT(string_arg_typeid); + string_arg_datatype := sys.translate_pg_type_to_tsql(string_basetype); + END IF; + + -- restricting arguments with invalid datatypes for reverse function + IF string_arg_datatype IN ('image', 'sql_variant', 'xml', 'geometry', 'geography') THEN + RAISE EXCEPTION 'Argument data type % is invalid for argument 1 of reverse function.', string_arg_datatype; + END IF; + + IF string IS NULL THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.reverse(string::sys.varchar); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.reverse(string sys.NCHAR) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.reverse(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.reverse(string sys.NVARCHAR) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.reverse(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Adding following definition will make sure that reverse with text input +-- will use following definition instead of PG reverse +CREATE OR REPLACE FUNCTION sys.reverse(string TEXT) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.reverse(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +-- Adding following definition will make sure that reverse with ntext input +-- will use following definition instead of PG reverse +CREATE OR REPLACE FUNCTION sys.reverse(string NTEXT) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + RETURN PG_CATALOG.reverse(string); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +create or replace view sys.tables as +with tt_internal as MATERIALIZED +( + select * from sys.table_types_internal +) +select + CAST(t.relname as sys._ci_sysname) as name + , CAST(t.oid as int) as object_id + , CAST(NULL as int) as principal_id + , CAST(t.relnamespace as int) as schema_id + , 0 as parent_object_id + , CAST('U' as sys.bpchar(2)) as type + , CAST('USER_TABLE' as sys.nvarchar(60)) as type_desc + , CAST((select string_agg( + case + when option like 'bbf_rel_create_date=%%' then substring(option, 21) + else NULL + end, ',') + from unnest(t.reloptions) as option) + as sys.datetime) as create_date + , CAST((select string_agg( + case + when option like 'bbf_rel_create_date=%%' then substring(option, 21) + else NULL + end, ',') + from unnest(t.reloptions) as option) + as sys.datetime) as modify_date + , CAST(0 as sys.bit) as is_ms_shipped + , CAST(0 as sys.bit) as is_published + , CAST(0 as sys.bit) as is_schema_published + , case reltoastrelid when 0 then 0 else 1 end as lob_data_space_id + , CAST(NULL as int) as filestream_data_space_id + , CAST(relnatts as int) as max_column_id_used + , CAST(0 as sys.bit) as lock_on_bulk_load + , CAST(1 as sys.bit) as uses_ansi_nulls + , CAST(0 as sys.bit) as is_replicated + , CAST(0 as sys.bit) as has_replication_filter + , CAST(0 as sys.bit) as is_merge_published + , CAST(0 as sys.bit) as is_sync_tran_subscribed + , CAST(0 as sys.bit) as has_unchecked_assembly_data + , 0 as text_in_row_limit + , CAST(0 as sys.bit) as large_value_types_out_of_row + , CAST(0 as sys.bit) as is_tracked_by_cdc + , CAST(0 as sys.tinyint) as lock_escalation + , CAST('TABLE' as sys.nvarchar(60)) as lock_escalation_desc + , CAST(0 as sys.bit) as is_filetable + , CAST(0 as sys.tinyint) as durability + , CAST('SCHEMA_AND_DATA' as sys.nvarchar(60)) as durability_desc + , CAST(0 as sys.bit) is_memory_optimized + , case relpersistence when 't' then CAST(2 as sys.tinyint) else CAST(0 as sys.tinyint) end as temporal_type + , case relpersistence when 't' then CAST('SYSTEM_VERSIONED_TEMPORAL_TABLE' as sys.nvarchar(60)) else CAST('NON_TEMPORAL_TABLE' as sys.nvarchar(60)) end as temporal_type_desc + , CAST(null as integer) as history_table_id + , CAST(0 as sys.bit) as is_remote_data_archive_enabled + , CAST(0 as sys.bit) as is_external +from pg_class t +inner join sys.schemas sch on sch.schema_id = t.relnamespace +left join tt_internal tt on t.oid = tt.typrelid +where tt.typrelid is null +and (t.relkind = 'r' or t.relkind = 'p') +and t.relispartition = false +and has_schema_privilege(t.relnamespace, 'USAGE') +and has_table_privilege(t.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER'); +GRANT SELECT ON sys.tables TO PUBLIC; + +-- Rename functions for dependencies +DO $$ +DECLARE + exception_message text; +BEGIN + -- Rename REPLICATE for dependencies + ALTER FUNCTION sys.REPLICATE(TEXT, INTEGER) RENAME TO replicate_deprecated_in_4_3_0_0; + +EXCEPTION WHEN OTHERS THEN + GET STACKED DIAGNOSTICS + exception_message = MESSAGE_TEXT; + RAISE WARNING '%', exception_message; +END; +$$; + +-- wrapper functions for replicate +CREATE OR REPLACE FUNCTION sys.replicate(string ANYELEMENT, i INTEGER) +RETURNS sys.VARCHAR +AS +$BODY$ +DECLARE + string_arg_datatype text; + string_arg_typeid oid; + string_basetype oid; +BEGIN + string_arg_typeid := pg_typeof(string)::oid; + string_arg_datatype := sys.translate_pg_type_to_tsql(string_arg_typeid); + IF string_arg_datatype IS NULL THEN + -- for User Defined Datatype, use immediate base type to check for argument datatype validation + string_basetype := sys.bbf_get_immediate_base_type_of_UDT(string_arg_typeid); + string_arg_datatype := sys.translate_pg_type_to_tsql(string_basetype); + END IF; + + -- restricting arguments with invalid datatypes for replicate function + IF string_arg_datatype IN ('image', 'sql_variant', 'xml', 'geometry', 'geography') THEN + RAISE EXCEPTION 'Argument data type % is invalid for argument 1 of replicate function.', string_arg_datatype; + END IF; + + IF i < 0 THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.repeat(string::sys.varchar, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.replicate(string sys.NCHAR, i INTEGER) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + IF i < 0 THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.repeat(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.replicate(string sys.NVARCHAR, i INTEGER) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + IF i < 0 THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.repeat(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Adding following definition will make sure that replicate with text input +-- will use following definition instead of PG replicate +CREATE OR REPLACE FUNCTION sys.replicate(string TEXT, i INTEGER) +RETURNS sys.VARCHAR +AS +$BODY$ +BEGIN + IF i < 0 THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.repeat(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Adding following definition will make sure that replicate with ntext input +-- will use following definition instead of PG replicate +CREATE OR REPLACE FUNCTION sys.replicate(string NTEXT, i INTEGER) +RETURNS sys.NVARCHAR +AS +$BODY$ +BEGIN + IF i < 0 THEN + RETURN NULL; + END IF; + + RETURN PG_CATALOG.repeat(string, i); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- DROP deprecated function of replicate (if exists) +DO $$ +DECLARE + exception_message text; +BEGIN + -- DROP replicate_deprecated_in_4_3_0_0 + CALL sys.babelfish_drop_deprecated_object('function', 'sys', 'replicate_deprecated_in_4_3_0_0'); + +EXCEPTION WHEN OTHERS THEN + GET STACKED DIAGNOSTICS + exception_message = MESSAGE_TEXT; + RAISE WARNING '%', exception_message; +END; +$$; + +create or replace view sys.all_columns as +select CAST(c.oid as int) as object_id + , CAST(a.attname as sys.sysname) as name + , CAST(a.attnum as int) as column_id + , CAST(t.oid as int) as system_type_id + , CAST(t.oid as int) as user_type_id + , CAST(sys.tsql_type_max_length_helper(coalesce(tsql_type_name, tsql_base_type_name), a.attlen, a.atttypmod) as smallint) as max_length + , CAST(case + when a.atttypmod != -1 then + sys.tsql_type_precision_helper(coalesce(tsql_type_name, tsql_base_type_name), a.atttypmod) + else + sys.tsql_type_precision_helper(coalesce(tsql_type_name, tsql_base_type_name), t.typtypmod) + end as sys.tinyint) as precision + , CAST(case + when a.atttypmod != -1 THEN + sys.tsql_type_scale_helper(coalesce(tsql_type_name, tsql_base_type_name), a.atttypmod, false) + else + sys.tsql_type_scale_helper(coalesce(tsql_type_name, tsql_base_type_name), t.typtypmod, false) + end as sys.tinyint) as scale + , CAST(coll.collname as sys.sysname) as collation_name + , case when a.attnotnull then CAST(0 as sys.bit) else CAST(1 as sys.bit) end as is_nullable + , CAST(0 as sys.bit) as is_ansi_padded + , CAST(0 as sys.bit) as is_rowguidcol + , CAST(case when a.attidentity <> ''::"char" then 1 else 0 end AS sys.bit) as is_identity + , CAST(case when a.attgenerated <> ''::"char" then 1 else 0 end AS sys.bit) as is_computed + , CAST(0 as sys.bit) as is_filestream + , CAST(0 as sys.bit) as is_replicated + , CAST(0 as sys.bit) as is_non_sql_subscribed + , CAST(0 as sys.bit) as is_merge_published + , CAST(0 as sys.bit) as is_dts_replicated + , CAST(0 as sys.bit) as is_xml_document + , CAST(0 as int) as xml_collection_id + , CAST(coalesce(d.oid, 0) as int) as default_object_id + , CAST(coalesce((select oid from pg_constraint where conrelid = t.oid and contype = 'c' and a.attnum = any(conkey) limit 1), 0) as int) as rule_object_id + , CAST(0 as sys.bit) as is_sparse + , CAST(0 as sys.bit) as is_column_set + , CAST(0 as sys.tinyint) as generated_always_type + , CAST('NOT_APPLICABLE' as sys.nvarchar(60)) as generated_always_type_desc +from pg_attribute a +inner join pg_class c on c.oid = a.attrelid +inner join pg_type t on t.oid = a.atttypid +inner join pg_namespace s on s.oid = c.relnamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join pg_attrdef d on c.oid = d.adrelid and a.attnum = d.adnum +left join pg_collation coll on coll.oid = a.attcollation +, sys.translate_pg_type_to_tsql(a.atttypid) AS tsql_type_name +, sys.translate_pg_type_to_tsql(t.typbasetype) AS tsql_base_type_name +where not a.attisdropped +and (s.nspname = 'sys' or ext.nspname is not null) +-- r = ordinary table, i = index, S = sequence, t = TOAST table, v = view, m = materialized view, c = composite type, f = foreign table, p = partitioned table +and c.relkind in ('r', 'v', 'm', 'f', 'p') +and c.relispartition = false +and has_schema_privilege(s.oid, 'USAGE') +and has_column_privilege(quote_ident(s.nspname) ||'.'||quote_ident(c.relname), a.attname, 'SELECT,INSERT,UPDATE,REFERENCES') +and a.attnum > 0; +GRANT SELECT ON sys.all_columns TO PUBLIC; + + +-- internal function in order to workaround BABEL-1597 +CREATE OR REPLACE FUNCTION sys.columns_internal() +RETURNS TABLE ( + out_object_id int, + out_name sys.sysname, + out_column_id int, + out_system_type_id int, + out_user_type_id int, + out_max_length smallint, + out_precision sys.tinyint, + out_scale sys.tinyint, + out_collation_name sys.sysname, + out_collation_id int, + out_offset smallint, + out_is_nullable sys.bit, + out_is_ansi_padded sys.bit, + out_is_rowguidcol sys.bit, + out_is_identity sys.bit, + out_is_computed sys.bit, + out_is_filestream sys.bit, + out_is_replicated sys.bit, + out_is_non_sql_subscribed sys.bit, + out_is_merge_published sys.bit, + out_is_dts_replicated sys.bit, + out_is_xml_document sys.bit, + out_xml_collection_id int, + out_default_object_id int, + out_rule_object_id int, + out_is_sparse sys.bit, + out_is_column_set sys.bit, + out_generated_always_type sys.tinyint, + out_generated_always_type_desc sys.nvarchar(60), + out_encryption_type int, + out_encryption_type_desc sys.nvarchar(64), + out_encryption_algorithm_name sys.sysname, + out_column_encryption_key_id int, + out_column_encryption_key_database_name sys.sysname, + out_is_hidden sys.bit, + out_is_masked sys.bit, + out_graph_type int, + out_graph_type_desc sys.nvarchar(60) +) +AS +$$ +BEGIN + RETURN QUERY + SELECT CAST(c.oid AS int), + CAST(a.attname AS sys.sysname), + CAST(a.attnum AS int), + CASE + WHEN tsql_type_name IS NOT NULL OR t.typbasetype = 0 THEN + -- either tsql or PG base type + CAST(a.atttypid AS int) + ELSE + CAST(t.typbasetype AS int) + END, + CAST(a.atttypid AS int), + CASE + WHEN a.atttypmod != -1 THEN + sys.tsql_type_max_length_helper(coalesce(tsql_type_name, tsql_base_type_name), a.attlen, a.atttypmod) + ELSE + sys.tsql_type_max_length_helper(coalesce(tsql_type_name, tsql_base_type_name), a.attlen, t.typtypmod) + END, + CASE + WHEN a.atttypmod != -1 THEN + sys.tsql_type_precision_helper(coalesce(tsql_type_name, tsql_base_type_name), a.atttypmod) + ELSE + sys.tsql_type_precision_helper(coalesce(tsql_type_name, tsql_base_type_name), t.typtypmod) + END, + CASE + WHEN a.atttypmod != -1 THEN + sys.tsql_type_scale_helper(coalesce(tsql_type_name, tsql_base_type_name), a.atttypmod, false) + ELSE + sys.tsql_type_scale_helper(coalesce(tsql_type_name, tsql_base_type_name), t.typtypmod, false) + END, + CAST(coll.collname AS sys.sysname), + CAST(a.attcollation AS int), + CAST(a.attnum AS smallint), + CAST(case when a.attnotnull then 0 else 1 end AS sys.bit), + CAST(case when t.typname in ('bpchar', 'nchar', 'binary') then 1 else 0 end AS sys.bit), + CAST(0 AS sys.bit), + CAST(case when a.attidentity <> ''::"char" then 1 else 0 end AS sys.bit), + CAST(case when a.attgenerated <> ''::"char" then 1 else 0 end AS sys.bit), + CAST(0 AS sys.bit), + CAST(0 AS sys.bit), + CAST(0 AS sys.bit), + CAST(0 AS sys.bit), + CAST(0 AS sys.bit), + CAST(0 AS sys.bit), + CAST(0 AS int), + CAST(coalesce(d.oid, 0) AS int), + CAST(coalesce((select oid from pg_constraint where conrelid = t.oid + and contype = 'c' and a.attnum = any(conkey) limit 1), 0) AS int), + CAST(0 AS sys.bit), + CAST(0 AS sys.bit), + CAST(0 AS sys.tinyint), + CAST('NOT_APPLICABLE' AS sys.nvarchar(60)), + CAST(null AS int), + CAST(null AS sys.nvarchar(64)), + CAST(null AS sys.sysname), + CAST(null AS int), + CAST(null AS sys.sysname), + CAST(0 AS sys.bit), + CAST(0 AS sys.bit), + CAST(null AS int), + CAST(null AS sys.nvarchar(60)) + FROM pg_attribute a + INNER JOIN pg_class c ON c.oid = a.attrelid + INNER JOIN pg_type t ON t.oid = a.atttypid + INNER JOIN sys.schemas sch on c.relnamespace = sch.schema_id + INNER JOIN sys.pg_namespace_ext ext on sch.schema_id = ext.oid + LEFT JOIN pg_attrdef d ON c.oid = d.adrelid AND a.attnum = d.adnum + LEFT JOIN pg_collation coll ON coll.oid = a.attcollation + , sys.translate_pg_type_to_tsql(a.atttypid) AS tsql_type_name + , sys.translate_pg_type_to_tsql(t.typbasetype) AS tsql_base_type_name + WHERE NOT a.attisdropped + AND a.attnum > 0 + -- r = ordinary table, i = index, S = sequence, t = TOAST table, v = view, m = materialized view, c = composite type, f = foreign table, p = partitioned table + AND c.relkind IN ('r', 'v', 'm', 'f', 'p') + AND c.relispartition = false + AND has_schema_privilege(sch.schema_id, 'USAGE') + AND has_column_privilege(a.attrelid, a.attname, 'SELECT,INSERT,UPDATE,REFERENCES') + union all + -- system tables information + SELECT CAST(c.oid AS int), + CAST(a.attname AS sys.sysname), + CAST(a.attnum AS int), + CASE + WHEN tsql_type_name IS NOT NULL OR t.typbasetype = 0 THEN + -- either tsql or PG base type + CAST(a.atttypid AS int) + ELSE + CAST(t.typbasetype AS int) + END, + CAST(a.atttypid AS int), + CASE + WHEN a.atttypmod != -1 THEN + sys.tsql_type_max_length_helper(coalesce(tsql_type_name, tsql_base_type_name), a.attlen, a.atttypmod) + ELSE + sys.tsql_type_max_length_helper(coalesce(tsql_type_name, tsql_base_type_name), a.attlen, t.typtypmod) + END, + CASE + WHEN a.atttypmod != -1 THEN + sys.tsql_type_precision_helper(coalesce(tsql_type_name, tsql_base_type_name), a.atttypmod) + ELSE + sys.tsql_type_precision_helper(coalesce(tsql_type_name, tsql_base_type_name), t.typtypmod) + END, + CASE + WHEN a.atttypmod != -1 THEN + sys.tsql_type_scale_helper(coalesce(tsql_type_name, tsql_base_type_name), a.atttypmod, false) + ELSE + sys.tsql_type_scale_helper(coalesce(tsql_type_name, tsql_base_type_name), t.typtypmod, false) + END, + CAST(coll.collname AS sys.sysname), + CAST(a.attcollation AS int), + CAST(a.attnum AS smallint), + CAST(case when a.attnotnull then 0 else 1 end AS sys.bit), + CAST(case when t.typname in ('bpchar', 'nchar', 'binary') then 1 else 0 end AS sys.bit), + CAST(0 AS sys.bit), + CAST(case when a.attidentity <> ''::"char" then 1 else 0 end AS sys.bit), + CAST(case when a.attgenerated <> ''::"char" then 1 else 0 end AS sys.bit), + CAST(0 AS sys.bit), + CAST(0 AS sys.bit), + CAST(0 AS sys.bit), + CAST(0 AS sys.bit), + CAST(0 AS sys.bit), + CAST(0 AS sys.bit), + CAST(0 AS int), + CAST(coalesce(d.oid, 0) AS int), + CAST(coalesce((select oid from pg_constraint where conrelid = t.oid + and contype = 'c' and a.attnum = any(conkey) limit 1), 0) AS int), + CAST(0 AS sys.bit), + CAST(0 AS sys.bit), + CAST(0 AS sys.tinyint), + CAST('NOT_APPLICABLE' AS sys.nvarchar(60)), + CAST(null AS int), + CAST(null AS sys.nvarchar(64)), + CAST(null AS sys.sysname), + CAST(null AS int), + CAST(null AS sys.sysname), + CAST(0 AS sys.bit), + CAST(0 AS sys.bit), + CAST(null AS int), + CAST(null AS sys.nvarchar(60)) + FROM pg_attribute a + INNER JOIN pg_class c ON c.oid = a.attrelid + INNER JOIN pg_type t ON t.oid = a.atttypid + INNER JOIN pg_namespace nsp ON (nsp.oid = c.relnamespace and nsp.nspname = 'sys') + LEFT JOIN pg_attrdef d ON c.oid = d.adrelid AND a.attnum = d.adnum + LEFT JOIN pg_collation coll ON coll.oid = a.attcollation + , sys.translate_pg_type_to_tsql(a.atttypid) AS tsql_type_name + , sys.translate_pg_type_to_tsql(t.typbasetype) AS tsql_base_type_name + WHERE NOT a.attisdropped + AND a.attnum > 0 + AND c.relkind = 'r' + AND has_schema_privilege(nsp.oid, 'USAGE') + AND has_column_privilege(a.attrelid, a.attname, 'SELECT,INSERT,UPDATE,REFERENCES'); +END; +$$ +language plpgsql STABLE; + +create or replace view sys.indexes as +-- Get all indexes from all system and user tables +with index_id_map as MATERIALIZED( + select + indexrelid, + case + when indisclustered then 1 + else 1+row_number() over(partition by indrelid order by indexrelid) + end as index_id + from pg_index +) +select + cast(X.indrelid as int) as object_id + , cast(I.relname as sys.sysname) as name + , cast(case when X.indisclustered then 1 else 2 end as sys.tinyint) as type + , cast(case when X.indisclustered then 'CLUSTERED' else 'NONCLUSTERED' end as sys.nvarchar(60)) as type_desc + , cast(case when X.indisunique then 1 else 0 end as sys.bit) as is_unique + , cast(case when ps.scheme_id is null then 1 else ps.scheme_id end as int) as data_space_id + , cast(0 as sys.bit) as ignore_dup_key + , cast(case when X.indisprimary then 1 else 0 end as sys.bit) as is_primary_key + , cast(case when const.oid is null then 0 else 1 end as sys.bit) as is_unique_constraint + , cast(0 as sys.tinyint) as fill_factor + , cast(case when X.indpred is null then 0 else 1 end as sys.bit) as is_padded + , cast(case when X.indisready then 0 else 1 end as sys.bit) as is_disabled + , cast(0 as sys.bit) as is_hypothetical + , cast(1 as sys.bit) as allow_row_locks + , cast(1 as sys.bit) as allow_page_locks + , cast(0 as sys.bit) as has_filter + , cast(null as sys.nvarchar) as filter_definition + , cast(0 as sys.bit) as auto_created + , cast(imap.index_id as int) as index_id +from pg_index X +inner join index_id_map imap on imap.indexrelid = X.indexrelid +inner join pg_class I on I.oid = X.indexrelid +inner join pg_class ptbl on ptbl.oid = X.indrelid and ptbl.relispartition = false +inner join pg_namespace nsp on nsp.oid = I.relnamespace +left join sys.babelfish_namespace_ext ext on (nsp.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.babelfish_partition_depend pd on + (ext.orig_name = pd.schema_name COLLATE sys.database_default + and CAST(ptbl.relname AS sys.nvarchar(128)) = pd.table_name COLLATE sys.database_default and pd.dbid = sys.db_id() and ptbl.relkind = 'p') +left join sys.babelfish_partition_scheme ps on (ps.partition_scheme_name = pd.partition_scheme_name and ps.dbid = sys.db_id()) +-- check if index is a unique constraint +left join pg_constraint const on const.conindid = I.oid and const.contype = 'u' +where has_schema_privilege(I.relnamespace, 'USAGE') +-- index is active +and X.indislive +-- filter to get all the objects that belong to sys or babelfish schemas +and (nsp.nspname = 'sys' or ext.nspname is not null) + +union all +-- Create HEAP entries for each system and user table +select + cast(t.oid as int) as object_id + , cast(null as sys.sysname) as name + , cast(0 as sys.tinyint) as type + , cast('HEAP' as sys.nvarchar(60)) as type_desc + , cast(0 as sys.bit) as is_unique + , cast(case when ps.scheme_id is null then 1 else ps.scheme_id end as int) as data_space_id + , cast(0 as sys.bit) as ignore_dup_key + , cast(0 as sys.bit) as is_primary_key + , cast(0 as sys.bit) as is_unique_constraint + , cast(0 as sys.tinyint) as fill_factor + , cast(0 as sys.bit) as is_padded + , cast(0 as sys.bit) as is_disabled + , cast(0 as sys.bit) as is_hypothetical + , cast(1 as sys.bit) as allow_row_locks + , cast(1 as sys.bit) as allow_page_locks + , cast(0 as sys.bit) as has_filter + , cast(null as sys.nvarchar) as filter_definition + , cast(0 as sys.bit) as auto_created + , cast(0 as int) as index_id +from pg_class t +inner join pg_namespace nsp on nsp.oid = t.relnamespace +left join sys.babelfish_namespace_ext ext on (nsp.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.babelfish_partition_depend pd on + (ext.orig_name = pd.schema_name COLLATE sys.database_default + and CAST(t.relname AS sys.nvarchar(128)) = pd.table_name COLLATE sys.database_default and pd.dbid = sys.db_id()) +left join sys.babelfish_partition_scheme ps on (ps.partition_scheme_name = pd.partition_scheme_name and ps.dbid = sys.db_id()) +where (t.relkind = 'r' or t.relkind = 'p') +and t.relispartition = false +-- filter to get all the objects that belong to sys or babelfish schemas +and (nsp.nspname = 'sys' or ext.nspname is not null) +and has_schema_privilege(t.relnamespace, 'USAGE') +and has_table_privilege(t.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') +order by object_id, type_desc; +GRANT SELECT ON sys.indexes TO PUBLIC; + +create or replace view sys.all_objects as +select + name collate sys.database_default + , cast (object_id as integer) + , cast ( principal_id as integer) + , cast (schema_id as integer) + , cast (parent_object_id as integer) + , type collate sys.database_default + , cast (type_desc as sys.nvarchar(60)) + , cast (create_date as sys.datetime) + , cast (modify_date as sys.datetime) + , is_ms_shipped + , cast (is_published as sys.bit) + , cast (is_schema_published as sys.bit) +from +( +-- Currently for pg_class, pg_proc UNIONs, we separated user defined objects and system objects because the +-- optimiser will be able to make a better estimation of number of rows(in case the query contains a filter on +-- is_ms_shipped column) and in turn chooses a better query plan. + +-- details of system tables +select + t.relname::sys.sysname as name + , t.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , 0 as parent_object_id + , 'U'::char(2) as type + , 'USER_TABLE' as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , 1::sys.bit as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_class t inner join pg_namespace s on s.oid = t.relnamespace +left join sys.table_types_internal tt on t.oid = tt.typrelid +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = t.relname and nis.schemaid = s.oid and nis.type = 'U' +where t.relpersistence in ('p', 'u', 't') +and t.relkind = 'r' +and (s.nspname = 'sys' or (nis.name is not null and ext.nspname is not null)) +and tt.typrelid is null +and has_schema_privilege(s.oid, 'USAGE') +and has_table_privilege(t.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') + +union all +-- details of user defined tables +select + t.relname::sys.sysname as name + , t.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , 0 as parent_object_id + , 'U'::char(2) as type + , 'USER_TABLE' as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , 0::sys.bit as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_class t inner join pg_namespace s on s.oid = t.relnamespace +left join sys.table_types_internal tt on t.oid = tt.typrelid +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = t.relname and nis.schemaid = s.oid and nis.type = 'U' +where t.relpersistence in ('p', 'u', 't') +and (t.relkind = 'r' or t.relkind = 'p') +and t.relispartition = false +and s.nspname <> 'sys' and nis.name is null +and ext.nspname is not null +and tt.typrelid is null +and has_schema_privilege(s.oid, 'USAGE') +and has_table_privilege(t.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') + +union all +-- details of system views +select + t.relname::sys.sysname as name + , t.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , 0 as parent_object_id + , 'V'::char(2) as type + , 'VIEW'::varchar(60) as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , 1::sys.bit as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_class t inner join pg_namespace s on s.oid = t.relnamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = t.relname and nis.schemaid = s.oid and nis.type = 'V' +where t.relkind = 'v' +and (s.nspname = 'sys' or (nis.name is not null and ext.nspname is not null)) +and has_schema_privilege(s.oid, 'USAGE') +and has_table_privilege(t.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') +union all +-- Details of user defined views +select + t.relname::sys.sysname as name + , t.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , 0 as parent_object_id + , 'V'::char(2) as type + , 'VIEW'::varchar(60) as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , 0::sys.bit as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_class t inner join pg_namespace s on s.oid = t.relnamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = t.relname and nis.schemaid = s.oid and nis.type = 'V' +where t.relkind = 'v' +and s.nspname <> 'sys' and nis.name is null +and ext.nspname is not null +and has_schema_privilege(s.oid, 'USAGE') +and has_table_privilege(t.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') +union all +-- details of user defined and system foreign key constraints +select + c.conname::sys.sysname as name + , c.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , c.conrelid as parent_object_id + , 'F'::char(2) as type + , 'FOREIGN_KEY_CONSTRAINT' + , null::timestamp as create_date + , null::timestamp as modify_date + , CAST (case when (s.nspname = 'sys' or nis.name is not null) then 1 + else 0 end as sys.bit ) as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_constraint c +inner join pg_namespace s on s.oid = c.connamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = c.conname and nis.schemaid = s.oid and nis.type = 'F' +where has_schema_privilege(s.oid, 'USAGE') +and c.contype = 'f' +and (s.nspname = 'sys' or ext.nspname is not null) +union all +-- details of user defined and system primary key constraints +select + c.conname::sys.sysname as name + , c.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , c.conrelid as parent_object_id + , 'PK'::char(2) as type + , 'PRIMARY_KEY_CONSTRAINT' as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , CAST (case when (s.nspname = 'sys' or nis.name is not null) then 1 + else 0 end as sys.bit ) as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_constraint c +inner join pg_namespace s on s.oid = c.connamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = c.conname and nis.schemaid = s.oid and nis.type = 'PK' +where has_schema_privilege(s.oid, 'USAGE') +and c.contype = 'p' +and (s.nspname = 'sys' or ext.nspname is not null) +union all +-- details of system defined procedures +select + p.proname::sys.sysname as name + , case + when t.typname = 'trigger' then tr.oid else p.oid + end as object_id + , null::integer as principal_id + , s.oid as schema_id + , cast (case when tr.tgrelid is not null + then tr.tgrelid + else 0 end as int) + as parent_object_id + , case p.prokind + when 'p' then 'P'::char(2) + when 'a' then 'AF'::char(2) + else + case + when t.typname = 'trigger' + then 'TR'::char(2) + when p.proretset then + case + when t.typtype = 'c' + then 'TF'::char(2) + else 'IF'::char(2) + end + else 'FN'::char(2) + end + end as type + , case p.prokind + when 'p' then 'SQL_STORED_PROCEDURE'::varchar(60) + when 'a' then 'AGGREGATE_FUNCTION'::varchar(60) + else + case + when t.typname = 'trigger' + then 'SQL_TRIGGER'::varchar(60) + when p.proretset then + case + when t.typtype = 'c' + then 'SQL_TABLE_VALUED_FUNCTION'::varchar(60) + else 'SQL_INLINE_TABLE_VALUED_FUNCTION'::varchar(60) + end + else 'SQL_SCALAR_FUNCTION'::varchar(60) + end + end as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , 1::sys.bit as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_proc p +inner join pg_namespace s on s.oid = p.pronamespace +inner join pg_catalog.pg_type t on t.oid = p.prorettype +left join pg_trigger tr on tr.tgfoid = p.oid +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = p.proname and nis.schemaid = s.oid +and nis.type = (case p.prokind + when 'p' then 'P'::char(2) + when 'a' then 'AF'::char(2) + else + case + when t.typname = 'trigger' + then 'TR'::char(2) + when p.proretset then + case + when t.typtype = 'c' + then 'TF'::char(2) + else 'IF'::char(2) + end + else 'FN'::char(2) + end + end) +where (s.nspname = 'sys' or (nis.name is not null and ext.nspname is not null)) +and has_schema_privilege(s.oid, 'USAGE') +and has_function_privilege(p.oid, 'EXECUTE') +and p.proname != 'pltsql_call_handler' + +union all +-- details of user defined procedures +select + p.proname::sys.sysname as name + , case + when t.typname = 'trigger' then tr.oid else p.oid + end as object_id + , null::integer as principal_id + , s.oid as schema_id + , cast (case when tr.tgrelid is not null + then tr.tgrelid + else 0 end as int) + as parent_object_id + , case p.prokind + when 'p' then 'P'::char(2) + when 'a' then 'AF'::char(2) + else + case + when t.typname = 'trigger' + then 'TR'::char(2) + when p.proretset then + case + when t.typtype = 'c' + then 'TF'::char(2) + else 'IF'::char(2) + end + else 'FN'::char(2) + end + end as type + , case p.prokind + when 'p' then 'SQL_STORED_PROCEDURE'::varchar(60) + when 'a' then 'AGGREGATE_FUNCTION'::varchar(60) + else + case + when t.typname = 'trigger' + then 'SQL_TRIGGER'::varchar(60) + when p.proretset then + case + when t.typtype = 'c' + then 'SQL_TABLE_VALUED_FUNCTION'::varchar(60) + else 'SQL_INLINE_TABLE_VALUED_FUNCTION'::varchar(60) + end + else 'SQL_SCALAR_FUNCTION'::varchar(60) + end + end as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , 0::sys.bit as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_proc p +inner join pg_namespace s on s.oid = p.pronamespace +inner join pg_catalog.pg_type t on t.oid = p.prorettype +left join pg_trigger tr on tr.tgfoid = p.oid +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = p.proname and nis.schemaid = s.oid +and nis.type = (case p.prokind + when 'p' then 'P'::char(2) + when 'a' then 'AF'::char(2) + else + case + when t.typname = 'trigger' + then 'TR'::char(2) + when p.proretset then + case + when t.typtype = 'c' + then 'TF'::char(2) + else 'IF'::char(2) + end + else 'FN'::char(2) + end + end) +where s.nspname <> 'sys' and nis.name is null +and ext.nspname is not null +and has_schema_privilege(s.oid, 'USAGE') +and has_function_privilege(p.oid, 'EXECUTE') + +union all +-- details of all default constraints +select + ('DF_' || o.relname || '_' || d.oid)::sys.sysname as name + , d.oid as object_id + , null::int as principal_id + , o.relnamespace as schema_id + , d.adrelid as parent_object_id + , 'D'::char(2) as type + , 'DEFAULT_CONSTRAINT'::sys.nvarchar(60) AS type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , CAST (case when (s.nspname = 'sys' or nis.name is not null) then 1 + else 0 end as sys.bit ) as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_catalog.pg_attrdef d +inner join pg_attribute a on a.attrelid = d.adrelid and d.adnum = a.attnum +inner join pg_class o on d.adrelid = o.oid +inner join pg_namespace s on s.oid = o.relnamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = ('DF_' || o.relname || '_' || d.oid) and nis.schemaid = s.oid and nis.type = 'D' +where a.atthasdef = 't' and a.attgenerated = '' +and (s.nspname = 'sys' or ext.nspname is not null) +and has_schema_privilege(s.oid, 'USAGE') +and has_column_privilege(a.attrelid, a.attname, 'SELECT,INSERT,UPDATE,REFERENCES') +union all +-- details of all check constraints +select + c.conname::sys.sysname + , c.oid::integer as object_id + , NULL::integer as principal_id + , s.oid as schema_id + , c.conrelid::integer as parent_object_id + , 'C'::char(2) as type + , 'CHECK_CONSTRAINT'::sys.nvarchar(60) as type_desc + , null::sys.datetime as create_date + , null::sys.datetime as modify_date + , CAST (case when (s.nspname = 'sys' or nis.name is not null) then 1 + else 0 end as sys.bit ) as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_catalog.pg_constraint as c +inner join pg_namespace s on s.oid = c.connamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = c.conname and nis.schemaid = s.oid and nis.type = 'C' +where has_schema_privilege(s.oid, 'USAGE') +and c.contype = 'c' and c.conrelid != 0 +and (s.nspname = 'sys' or ext.nspname is not null) +union all +-- details of user defined and system defined sequence objects +select + p.relname::sys.sysname as name + , p.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , 0 as parent_object_id + , 'SO'::char(2) as type + , 'SEQUENCE_OBJECT'::varchar(60) as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , CAST (case when (s.nspname = 'sys' or nis.name is not null) then 1 + else 0 end as sys.bit ) as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_class p +inner join pg_namespace s on s.oid = p.relnamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = p.relname and nis.schemaid = s.oid and nis.type = 'SO' +where p.relkind = 'S' +and (s.nspname = 'sys' or ext.nspname is not null) +and has_schema_privilege(s.oid, 'USAGE') +union all +-- details of user defined table types +select + ('TT_' || tt.name || '_' || tt.type_table_object_id)::sys.sysname as name + , tt.type_table_object_id as object_id + , tt.principal_id as principal_id + , tt.schema_id as schema_id + , 0 as parent_object_id + , 'TT'::char(2) as type + , 'TABLE_TYPE'::varchar(60) as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , CAST (case when (tt.schema_id::regnamespace::text = 'sys' or nis.name is not null) then 1 + else 0 end as sys.bit ) as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from sys.table_types tt +left join sys.shipped_objects_not_in_sys nis on nis.name = ('TT_' || tt.name || '_' || tt.type_table_object_id)::name and nis.schemaid = tt.schema_id and nis.type = 'TT' +) ot; +GRANT SELECT ON sys.all_objects TO PUBLIC; + +CREATE OR REPLACE VIEW sys.index_columns +AS +WITH index_id_map AS MATERIALIZED ( + SELECT + indexrelid, + CASE + WHEN indisclustered THEN 1 + ELSE 1+row_number() OVER(PARTITION BY indrelid ORDER BY indexrelid) + END AS index_id + FROM pg_index +) +SELECT + CAST(i.indrelid AS INT) AS object_id, + -- should match index_id of sys.indexes + CAST(imap.index_id AS INT) AS index_id, + CAST(a.index_column_id AS INT) AS index_column_id, + CAST(a.attnum AS INT) AS column_id, + CAST(CASE + WHEN a.index_column_id <= i.indnkeyatts THEN a.index_column_id + ELSE 0 + END AS SYS.TINYINT) AS key_ordinal, + CAST(0 AS SYS.TINYINT) AS partition_ordinal, + CAST(CASE + WHEN i.indoption[a.index_column_id-1] & 1 = 1 THEN 1 + ELSE 0 + END AS SYS.BIT) AS is_descending_key, + CAST(CASE + WHEN a.index_column_id > i.indnkeyatts THEN 1 + ELSE 0 + END AS SYS.BIT) AS is_included_column +FROM + pg_index i + INNER JOIN index_id_map imap ON imap.indexrelid = i.indexrelid + INNER JOIN pg_class c ON i.indrelid = c.oid and c.relispartition = false + INNER JOIN pg_namespace nsp ON nsp.oid = c.relnamespace + LEFT JOIN sys.babelfish_namespace_ext ext ON (nsp.nspname = ext.nspname AND ext.dbid = sys.db_id()) + LEFT JOIN unnest(i.indkey) WITH ORDINALITY AS a(attnum, index_column_id) ON true +WHERE + has_schema_privilege(c.relnamespace, 'USAGE') AND + has_table_privilege(c.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') AND + (nsp.nspname = 'sys' OR ext.nspname is not null) AND + i.indislive +UNION ALL +-- entries for index of partitioned table +SELECT + CAST(i.indrelid AS INT) AS object_id, + -- should match index_id of sys.indexes + CAST(imap.index_id AS INT) AS index_id, + CAST(ARRAY_LENGTH(i.indkey, 1) + 1 AS INT) AS index_column_id, + CAST(a.attnum AS INT) AS column_id, + CAST(0 AS SYS.TINYINT) AS key_ordinal, + CAST(a.ordinal_position AS SYS.TINYINT) AS partition_ordinal, + CAST(0 AS SYS.BIT) AS is_descending_key, + CAST(0 AS SYS.BIT) AS is_included_column +FROM + pg_index i + INNER JOIN index_id_map imap ON imap.indexrelid = i.indexrelid + INNER JOIN pg_class tbl on tbl.oid = i.indrelid and tbl.relkind = 'p' + INNER JOIN pg_namespace nsp on tbl.relnamespace = nsp.oid + INNER JOIN sys.babelfish_namespace_ext ext on (nsp.nspname = ext.nspname and ext.dbid = sys.db_id()) + INNER JOIN pg_partitioned_table ppt ON ppt.partrelid = tbl.oid + LEFT JOIN unnest(ppt.partattrs) WITH ORDINALITY AS a(attnum, ordinal_position) ON true +WHERE + has_schema_privilege(tbl.relnamespace, 'USAGE') AND + has_table_privilege(tbl.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') AND + i.indislive +UNION ALL +-- Heap entries for partitioned table +SELECT + CAST(t.oid as int) as object_id, + CAST(0 AS INT) AS index_id, + CAST(a.ordinal_position AS INT) AS index_column_id, + CAST(a.attnum AS INT) AS column_id, + CAST(0 AS SYS.TINYINT) AS key_ordinal, + CAST(a.ordinal_position AS SYS.TINYINT) AS partition_ordinal, + CAST(0 AS SYS.BIT) AS is_descending_key, + CAST(0 AS SYS.BIT) AS is_included_column +FROM + pg_class t + INNER JOIN pg_namespace nsp on t.relnamespace = nsp.oid + INNER JOIN sys.babelfish_namespace_ext ext on (nsp.nspname = ext.nspname and ext.dbid = sys.db_id()) + INNER JOIN pg_partitioned_table ppt ON ppt.partrelid = t.oid + LEFT JOIN unnest(ppt.partattrs) WITH ORDINALITY AS a(attnum, ordinal_position) ON true +WHERE + t.relkind = 'p' + AND has_schema_privilege(t.relnamespace, 'USAGE') + AND has_table_privilege(t.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER'); +GRANT SELECT ON sys.index_columns TO PUBLIC; + +/* + * COLUMNS view internal + */ + +CREATE OR REPLACE VIEW information_schema_tsql.columns_internal AS + SELECT c.oid AS "TABLE_OID", + CAST(nc.dbname AS sys.nvarchar(128)) AS "TABLE_CATALOG", + CAST(ext.orig_name AS sys.nvarchar(128)) AS "TABLE_SCHEMA", + CAST( + COALESCE( + (SELECT string_agg( + CASE + WHEN option LIKE 'bbf_original_rel_name=%' THEN substring(option, 23 /* prefix length */) + ELSE NULL + END, ',') + FROM unnest(c.reloptions) AS option), + c.relname) + AS sys.nvarchar(128)) AS "TABLE_NAME", + + CAST( + COALESCE( + (SELECT string_agg( + CASE + WHEN option LIKE 'bbf_original_name=%' THEN substring(option, 19 /* prefix length */) + ELSE NULL + END, ',') + FROM unnest(a.attoptions) AS option), + a.attname) + AS sys.nvarchar(128)) AS "COLUMN_NAME", + + CAST(a.attnum AS int) AS "ORDINAL_POSITION", + CAST(CASE WHEN a.attgenerated = '' THEN pg_get_expr(ad.adbin, ad.adrelid) END AS sys.nvarchar(4000)) AS "COLUMN_DEFAULT", + CAST(CASE WHEN a.attnotnull OR (t.typtype = 'd' AND t.typnotnull) THEN 'NO' ELSE 'YES' END + AS varchar(3)) + AS "IS_NULLABLE", + + CAST( + CASE WHEN tsql_type_name = 'sysname' THEN sys.translate_pg_type_to_tsql(t.typbasetype) + WHEN tsql_type_name.tsql_type_name IS NULL THEN format_type(t.oid, NULL::integer) + ELSE tsql_type_name END + AS sys.nvarchar(128)) + AS "DATA_TYPE", + + CAST( + information_schema_tsql._pgtsql_char_max_length(tsql_type_name, true_typmod) + AS int) + AS "CHARACTER_MAXIMUM_LENGTH", + + CAST( + information_schema_tsql._pgtsql_char_octet_length(tsql_type_name, true_typmod) + AS int) + AS "CHARACTER_OCTET_LENGTH", + + CAST( + /* Handle Tinyint separately */ + information_schema_tsql._pgtsql_numeric_precision(tsql_type_name, true_typid, true_typmod) + AS sys.tinyint) + AS "NUMERIC_PRECISION", + + CAST( + information_schema_tsql._pgtsql_numeric_precision_radix(tsql_type_name, true_typid, true_typmod) + AS smallint) + AS "NUMERIC_PRECISION_RADIX", + + CAST( + information_schema_tsql._pgtsql_numeric_scale(tsql_type_name, true_typid, true_typmod) + AS int) + AS "NUMERIC_SCALE", + + CAST( + information_schema_tsql._pgtsql_datetime_precision(tsql_type_name, true_typmod) + AS smallint) + AS "DATETIME_PRECISION", + + CAST(null AS sys.nvarchar(128)) AS "CHARACTER_SET_CATALOG", + CAST(null AS sys.nvarchar(128)) AS "CHARACTER_SET_SCHEMA", + /* + * TODO: We need to first create mapping of collation name to char-set name; + * Until then return null. + */ + CAST(null AS sys.nvarchar(128)) AS "CHARACTER_SET_NAME", + + CAST(NULL as sys.nvarchar(128)) AS "COLLATION_CATALOG", + CAST(NULL as sys.nvarchar(128)) AS "COLLATION_SCHEMA", + + /* Returns Babelfish specific collation name. */ + CAST(co.collname AS sys.nvarchar(128)) AS "COLLATION_NAME", + + CAST(CASE WHEN t.typtype = 'd' AND nt.nspname <> 'pg_catalog' AND nt.nspname <> 'sys' + THEN nc.dbname ELSE null END + AS sys.nvarchar(128)) AS "DOMAIN_CATALOG", + CAST(CASE WHEN t.typtype = 'd' AND nt.nspname <> 'pg_catalog' AND nt.nspname <> 'sys' + THEN ext.orig_name ELSE null END + AS sys.nvarchar(128)) AS "DOMAIN_SCHEMA", + CAST(CASE WHEN t.typtype = 'd' AND nt.nspname <> 'pg_catalog' AND nt.nspname <> 'sys' + THEN t.typname ELSE null END + AS sys.nvarchar(128)) AS "DOMAIN_NAME" + + FROM (pg_attribute a LEFT JOIN pg_attrdef ad ON attrelid = adrelid AND attnum = adnum) + JOIN (pg_class c JOIN sys.pg_namespace_ext nc ON (c.relnamespace = nc.oid)) ON a.attrelid = c.oid + JOIN (pg_type t JOIN pg_namespace nt ON (t.typnamespace = nt.oid)) ON a.atttypid = t.oid + LEFT JOIN (pg_type bt JOIN pg_namespace nbt ON (bt.typnamespace = nbt.oid)) + ON (t.typtype = 'd' AND t.typbasetype = bt.oid) + LEFT JOIN pg_collation co on co.oid = a.attcollation + LEFT OUTER JOIN sys.babelfish_namespace_ext ext on nc.nspname = ext.nspname, + information_schema_tsql._pgtsql_truetypid(nt, a, t) AS true_typid, + information_schema_tsql._pgtsql_truetypmod(nt, a, t) AS true_typmod, + sys.translate_pg_type_to_tsql(true_typid) AS tsql_type_name + + WHERE (NOT pg_is_other_temp_schema(nc.oid)) + AND a.attnum > 0 AND NOT a.attisdropped + AND c.relkind IN ('r', 'v', 'p') + AND c.relispartition = false + AND (pg_has_role(c.relowner, 'USAGE') + OR has_column_privilege(c.oid, a.attnum, + 'SELECT, INSERT, UPDATE, REFERENCES')) + AND ext.dbid =sys.db_id(); + +/* + * TABLES view + */ + +CREATE OR REPLACE VIEW information_schema_tsql.tables AS + SELECT CAST(nc.dbname AS sys.nvarchar(128)) AS "TABLE_CATALOG", + CAST(ext.orig_name AS sys.nvarchar(128)) AS "TABLE_SCHEMA", + CAST( + COALESCE( + (SELECT string_agg( + CASE + WHEN option LIKE 'bbf_original_rel_name=%' THEN substring(option, 23) + ELSE NULL + END, ',') + FROM unnest(c.reloptions) AS option), + c.relname) + AS sys._ci_sysname) AS "TABLE_NAME", + + CAST( + CASE WHEN c.relkind IN ('r', 'p') THEN 'BASE TABLE' + WHEN c.relkind = 'v' THEN 'VIEW' + ELSE null END + AS sys.varchar(10)) COLLATE sys.database_default AS "TABLE_TYPE" + + FROM sys.pg_namespace_ext nc JOIN pg_class c ON (nc.oid = c.relnamespace) + LEFT OUTER JOIN sys.babelfish_namespace_ext ext on nc.nspname = ext.nspname + LEFT JOIN sys.table_types_internal tt on c.oid = tt.typrelid + + WHERE c.relkind IN ('r', 'v', 'p') + AND c.relispartition = false + AND (NOT pg_is_other_temp_schema(nc.oid)) + AND tt.typrelid IS NULL + AND (pg_has_role(c.relowner, 'USAGE') + OR has_table_privilege(c.oid, 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER') + OR has_any_column_privilege(c.oid, 'SELECT, INSERT, UPDATE, REFERENCES') ) + AND ext.dbid = sys.db_id() + AND (NOT c.relname = 'sysdatabases'); + +GRANT SELECT ON information_schema_tsql.tables TO PUBLIC; + +/* + * TABLE_CONSTRAINTS view + */ + +CREATE OR REPLACE VIEW information_schema_tsql.table_constraints AS + SELECT CAST(nc.dbname AS sys.nvarchar(128)) AS "CONSTRAINT_CATALOG", + CAST(extc.orig_name AS sys.nvarchar(128)) AS "CONSTRAINT_SCHEMA", + CAST(c.conname AS sys.sysname) AS "CONSTRAINT_NAME", + CAST(nr.dbname AS sys.nvarchar(128)) AS "TABLE_CATALOG", + CAST(extr.orig_name AS sys.nvarchar(128)) AS "TABLE_SCHEMA", + CAST(r.relname AS sys.sysname) AS "TABLE_NAME", + CAST( + CASE c.contype WHEN 'c' THEN 'CHECK' + WHEN 'f' THEN 'FOREIGN KEY' + WHEN 'p' THEN 'PRIMARY KEY' + WHEN 'u' THEN 'UNIQUE' END + AS sys.varchar(11)) COLLATE sys.database_default AS "CONSTRAINT_TYPE", + CAST('NO' AS sys.varchar(2)) AS "IS_DEFERRABLE", + CAST('NO' AS sys.varchar(2)) AS "INITIALLY_DEFERRED" + + FROM sys.pg_namespace_ext nc LEFT OUTER JOIN sys.babelfish_namespace_ext extc ON nc.nspname = extc.nspname, + sys.pg_namespace_ext nr LEFT OUTER JOIN sys.babelfish_namespace_ext extr ON nr.nspname = extr.nspname, + pg_constraint c, + pg_class r + + WHERE nc.oid = c.connamespace AND nr.oid = r.relnamespace + AND c.conrelid = r.oid + AND c.contype NOT IN ('t', 'x') + AND r.relkind IN ('r', 'p') + AND relispartition = false + AND (NOT pg_is_other_temp_schema(nr.oid)) + AND (pg_has_role(r.relowner, 'USAGE') + OR has_table_privilege(r.oid, 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER') + OR has_any_column_privilege(r.oid, 'SELECT, INSERT, UPDATE, REFERENCES') ) + AND extc.dbid = sys.db_id(); + +GRANT SELECT ON information_schema_tsql.table_constraints TO PUBLIC; + +/* + * CHECK_CONSTRAINTS view + */ + +CREATE OR REPLACE VIEW information_schema_tsql.check_constraints AS + SELECT CAST(nc.dbname AS sys.nvarchar(128)) AS "CONSTRAINT_CATALOG", + CAST(extc.orig_name AS sys.nvarchar(128)) AS "CONSTRAINT_SCHEMA", + CAST(c.conname AS sys.sysname) AS "CONSTRAINT_NAME", + CAST(sys.tsql_get_constraintdef(c.oid) AS sys.nvarchar(4000)) AS "CHECK_CLAUSE" + + FROM sys.pg_namespace_ext nc LEFT OUTER JOIN sys.babelfish_namespace_ext extc ON nc.nspname = extc.nspname, + pg_constraint c, + pg_class r + + WHERE nc.oid = c.connamespace AND nc.oid = r.relnamespace + AND c.conrelid = r.oid + AND c.contype = 'c' + AND r.relkind IN ('r', 'p') + AND r.relispartition = false + AND (NOT pg_is_other_temp_schema(nc.oid)) + AND (pg_has_role(r.relowner, 'USAGE') + OR has_table_privilege(r.oid, 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER') + OR has_any_column_privilege(r.oid, 'SELECT, INSERT, UPDATE, REFERENCES')) + AND extc.dbid = sys.db_id(); + +GRANT SELECT ON information_schema_tsql.check_constraints TO PUBLIC; + +/* + * CONSTARINT_COLUMN_USAGE + */ + +CREATE OR REPLACE VIEW information_schema_tsql.CONSTRAINT_COLUMN_USAGE AS +SELECT CAST(tblcat AS sys.nvarchar(128)) AS "TABLE_CATALOG", + CAST(tblschema AS sys.nvarchar(128)) AS "TABLE_SCHEMA", + CAST(tblname AS sys.nvarchar(128)) AS "TABLE_NAME" , + CAST(colname AS sys.nvarchar(128)) AS "COLUMN_NAME", + CAST(cstrcat AS sys.nvarchar(128)) AS "CONSTRAINT_CATALOG", + CAST(cstrschema AS sys.nvarchar(128)) AS "CONSTRAINT_SCHEMA", + CAST(cstrname AS sys.nvarchar(128)) AS "CONSTRAINT_NAME" + +FROM ( + /* check constraints */ + SELECT DISTINCT extr.orig_name, r.relname, r.relowner, a.attname, extc.orig_name, c.conname, nr.dbname, nc.dbname + FROM sys.pg_namespace_ext nc LEFT OUTER JOIN sys.babelfish_namespace_ext extc ON nc.nspname = extc.nspname, + sys.pg_namespace_ext nr LEFT OUTER JOIN sys.babelfish_namespace_ext extr ON nr.nspname = extr.nspname, + pg_attribute a, + pg_constraint c, + pg_class r, pg_depend d + + WHERE nr.oid = r.relnamespace + AND r.oid = a.attrelid + AND d.refclassid = 'pg_catalog.pg_class'::regclass + AND d.refobjid = r.oid + AND d.refobjsubid = a.attnum + AND d.classid = 'pg_catalog.pg_constraint'::regclass + AND d.objid = c.oid + AND c.connamespace = nc.oid + AND c.contype = 'c' + AND r.relkind IN ('r', 'p') + AND r.relispartition = false + AND NOT a.attisdropped + AND (pg_has_role(r.relowner, 'USAGE') + OR has_table_privilege(r.oid, 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER') + OR has_any_column_privilege(r.oid, 'SELECT, INSERT, UPDATE, REFERENCES')) + + UNION ALL + + /* unique/primary key/foreign key constraints */ + SELECT extr.orig_name, r.relname, r.relowner, a.attname, extc.orig_name, c.conname, nr.dbname, nc.dbname + FROM sys.pg_namespace_ext nc LEFT OUTER JOIN sys.babelfish_namespace_ext extc ON nc.nspname = extc.nspname, + sys.pg_namespace_ext nr LEFT OUTER JOIN sys.babelfish_namespace_ext extr ON nr.nspname = extr.nspname, + pg_attribute a, + pg_constraint c, + pg_class r + WHERE nr.oid = r.relnamespace + AND r.oid = a.attrelid + AND nc.oid = c.connamespace + AND r.oid = c.conrelid + AND a.attnum = ANY (c.conkey) + AND NOT a.attisdropped + AND c.contype IN ('p', 'u', 'f') + AND r.relkind IN ('r', 'p') + AND r.relispartition = false + AND (pg_has_role(r.relowner, 'USAGE') + OR has_table_privilege(r.oid, 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER') + OR has_any_column_privilege(r.oid, 'SELECT, INSERT, UPDATE, REFERENCES')) + + ) AS x (tblschema, tblname, tblowner, colname, cstrschema, cstrname, tblcat, cstrcat); + +GRANT SELECT ON information_schema_tsql.CONSTRAINT_COLUMN_USAGE TO PUBLIC; + +CREATE OR REPLACE VIEW information_schema_tsql.key_column_usage AS + SELECT + CAST(nc.dbname AS sys.nvarchar(128)) AS "CONSTRAINT_CATALOG", + CAST(ext.orig_name AS sys.nvarchar(128)) AS "CONSTRAINT_SCHEMA", + CAST(c.conname AS sys.nvarchar(128)) AS "CONSTRAINT_NAME", + CAST(nc.dbname AS sys.nvarchar(128)) AS "TABLE_CATALOG", + CAST(ext.orig_name AS sys.nvarchar(128)) AS "TABLE_SCHEMA", + CAST(r.relname AS sys.nvarchar(128)) AS "TABLE_NAME", + CAST(a.attname AS sys.nvarchar(128)) AS "COLUMN_NAME", + CAST(ord AS int) AS "ORDINAL_POSITION" + FROM + pg_constraint c + JOIN pg_class r ON r.oid = c.conrelid AND c.contype in ('p','u','f') AND r.relkind in ('r','p') AND r.relispartition = false + JOIN sys.pg_namespace_ext nc ON nc.oid = c.connamespace AND r.relnamespace = nc.oid + JOIN sys.babelfish_namespace_ext ext ON ext.nspname = nc.nspname AND ext.dbid = sys.db_id() + CROSS JOIN unnest(c.conkey) WITH ORDINALITY AS ak(j,ord) + LEFT JOIN pg_attribute a ON a.attrelid = r.oid AND a.attnum = ak.j + WHERE + pg_has_role(r.relowner, 'USAGE'::text) + OR has_column_privilege(r.oid, a.attnum, 'SELECT, INSERT, UPDATE, REFERENCES'::text) + AND NOT pg_is_other_temp_schema(nc.oid) + ; +GRANT SELECT ON information_schema_tsql.key_column_usage TO PUBLIC; + +CREATE OR REPLACE VIEW sys.sp_tables_view AS +SELECT +t2.dbname AS TABLE_QUALIFIER, +CAST(t3.name AS name) AS TABLE_OWNER, +t1.relname AS TABLE_NAME, + +CASE +WHEN t1.relkind = 'v' + THEN 'VIEW' +ELSE 'TABLE' +END AS TABLE_TYPE, + +CAST(NULL AS varchar(254)) AS remarks +FROM pg_catalog.pg_class AS t1, sys.pg_namespace_ext AS t2, sys.schemas AS t3 +WHERE t1.relnamespace = t3.schema_id AND t1.relnamespace = t2.oid AND t1.relkind IN ('r','p','v','m') +AND t1.relispartition = false +AND has_schema_privilege(t1.relnamespace, 'USAGE') +AND has_table_privilege(t1.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER'); +GRANT SELECT ON sys.sp_tables_view TO PUBLIC; + +CREATE OR REPLACE FUNCTION sys.babelfish_split_identifier(IN identifier VARCHAR, OUT value VARCHAR) +RETURNS SETOF VARCHAR AS 'babelfishpg_tsql', 'split_identifier_internal' +LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE PROCEDURE sys.babelfish_sp_rename_word_parse( + IN "@input" sys.nvarchar(776), + IN "@objtype" sys.varchar(13), + INOUT "@subname" sys.nvarchar(776), + INOUT "@curr_relname" sys.nvarchar(776), + INOUT "@schemaname" sys.nvarchar(776), + INOUT "@dbname" sys.nvarchar(776) +) +AS $$ +BEGIN + SELECT (ROW_NUMBER() OVER (ORDER BY NULL)) as row, * + INTO #sp_rename_temptable + FROM sys.babelfish_split_identifier(@input) ORDER BY row DESC; + + SELECT (ROW_NUMBER() OVER (ORDER BY NULL)) as id, * + INTO #sp_rename_temptable2 + FROM #sp_rename_temptable; + + DECLARE @row_count INT; + SELECT @row_count = COUNT(*) FROM #sp_rename_temptable2; + + IF @objtype = 'COLUMN' + BEGIN + IF @row_count = 1 + BEGIN + THROW 33557097, N'Either the parameter @objname is ambiguous or the claimed @objtype (COLUMN) is wrong.', 1; + END + ELSE IF @row_count > 4 + BEGIN + THROW 33557097, N'No item by the given @objname could be found in the current database', 1; + END + ELSE + BEGIN + IF @row_count > 1 + BEGIN + SELECT @subname = value FROM #sp_rename_temptable2 WHERE id = 1; + SELECT @curr_relname = value FROM #sp_rename_temptable2 WHERE id = 2; + SET @schemaname = sys.schema_name(); + + END + IF @row_count > 2 + BEGIN + SELECT @schemaname = value FROM #sp_rename_temptable2 WHERE id = 3; + END + IF @row_count > 3 + BEGIN + SELECT @dbname = value FROM #sp_rename_temptable2 WHERE id = 4; + IF @dbname != sys.db_name() + BEGIN + THROW 33557097, N'No item by the given @objname could be found in the current database', 1; + END + END + END + END + ELSE + BEGIN + IF @row_count > 3 + BEGIN + THROW 33557097, N'No item by the given @objname could be found in the current database', 1; + END + ELSE + BEGIN + SET @curr_relname = NULL; + IF @row_count > 0 + BEGIN + SELECT @subname = value FROM #sp_rename_temptable2 WHERE id = 1; + SET @schemaname = sys.schema_name(); + END + IF @row_count > 1 + BEGIN + SELECT @schemaname = value FROM #sp_rename_temptable2 WHERE id = 2; + END + IF @row_count > 2 + BEGIN + SELECT @dbname = value FROM #sp_rename_temptable2 WHERE id = 3; + IF @dbname != sys.db_name() + BEGIN + THROW 33557097, N'No item by the given @objname could be found in the current database', 1; + END + END + END + END +END; +$$ +LANGUAGE 'pltsql'; + +CREATE OR REPLACE VIEW sys.sequences +AS SELECT + so.*, + CAST(0 as sys.sql_variant) AS start_value + , CAST(0 as sys.sql_variant) AS increment + , CAST(0 as sys.sql_variant) AS minimum_value + , CAST(0 as sys.sql_variant) AS maximum_value + , CAST(0 as sys.BIT) AS is_cycling + , CAST(0 as sys.BIT) AS is_cached + , CAST(0 as INT) AS cache_size + , CAST(0 as INT) AS system_type_id + , CAST(0 as INT) AS user_type_id + , CAST(0 as sys.TINYINT) AS precision + , CAST(0 as sys.TINYINT) AS scale + , CAST(0 as sys.sql_variant) AS current_value + , CAST(0 as sys.BIT) AS is_exhausted + , CAST(0 as sys.sql_variant) AS last_used_value +FROM sys.objects so +WHERE FALSE; +GRANT SELECT ON sys.sequences TO PUBLIC; + +CREATE OR REPLACE FUNCTION sys.babelfish_conv_string_to_datetime(IN p_datatype TEXT, + IN p_datetimestring TEXT, + IN p_style NUMERIC DEFAULT 0) +RETURNS TIMESTAMP WITHOUT TIME ZONE +AS +$BODY$ +DECLARE + v_day VARCHAR COLLATE "C"; + v_year VARCHAR COLLATE "C"; + v_month VARCHAR COLLATE "C"; + v_style SMALLINT; + v_scale SMALLINT; + v_hours VARCHAR COLLATE "C"; + v_hijridate DATE; + v_minutes VARCHAR COLLATE "C"; + v_seconds VARCHAR COLLATE "C"; + v_fseconds VARCHAR COLLATE "C"; + v_datatype VARCHAR COLLATE "C"; + v_timepart VARCHAR COLLATE "C"; + v_leftpart VARCHAR COLLATE "C"; + v_middlepart VARCHAR COLLATE "C"; + v_rightpart VARCHAR COLLATE "C"; + v_datestring VARCHAR COLLATE "C"; + v_err_message VARCHAR COLLATE "C"; + v_date_format VARCHAR COLLATE "C"; + v_res_datatype VARCHAR COLLATE "C"; + v_datetimestring VARCHAR COLLATE "C"; + v_datatype_groups TEXT[]; + v_regmatch_groups TEXT[]; + v_lang_metadata_json JSONB; + v_compmonth_regexp VARCHAR COLLATE "C"; + v_resdatetime TIMESTAMP(6) WITHOUT TIME ZONE; + CONVERSION_LANG CONSTANT VARCHAR COLLATE "C" := ''; + DATE_FORMAT CONSTANT VARCHAR COLLATE "C" := ''; + DAYMM_REGEXP CONSTANT VARCHAR COLLATE "C" := '(\d{1,2})'; + FULLYEAR_REGEXP CONSTANT VARCHAR COLLATE "C" := '(\d{4})'; + SHORTYEAR_REGEXP CONSTANT VARCHAR COLLATE "C" := '(\d{1,2})'; + COMPYEAR_REGEXP CONSTANT VARCHAR COLLATE "C" := '(\d{1,2}|\d{4})'; + AMPM_REGEXP CONSTANT VARCHAR COLLATE "C" := '(?:[AP]M)'; + MASKSEP_REGEXP CONSTANT VARCHAR COLLATE "C" := '(?:\.|-|/)'; + TIMEUNIT_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*\d{1,2}\s*'; + FRACTSECS_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*\d{1,9}\s*'; + DATATYPE_REGEXP CONSTANT VARCHAR COLLATE "C" := '^(DATETIME|SMALLDATETIME|DATETIME2)\s*(?:\()?\s*((?:-)?\d+)?\s*(?:\))?$'; + DIGITREPRESENT_REGEXP CONSTANT VARCHAR COLLATE "C" := '^\-?\d+\.?(?:\d+)?$'; + HHMMSSFS_PART_REGEXP CONSTANT VARCHAR COLLATE "C" := concat(TIMEUNIT_REGEXP, AMPM_REGEXP, '|', + TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, AMPM_REGEXP, '?|', + TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, '\.', FRACTSECS_REGEXP, AMPM_REGEXP, '?|', + TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, AMPM_REGEXP, '?|', + TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, '(?:\.|\:)', FRACTSECS_REGEXP, AMPM_REGEXP, '?'); + HHMMSSFS_DOT_PART_REGEXP CONSTANT VARCHAR COLLATE "C" := concat(TIMEUNIT_REGEXP, AMPM_REGEXP, '|', + TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, AMPM_REGEXP, '?|', + TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, '\.', FRACTSECS_REGEXP, AMPM_REGEXP, '?|', + TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, AMPM_REGEXP, '?|', + TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, '(?:\.)', FRACTSECS_REGEXP, AMPM_REGEXP, '?'); + HHMMSSFS_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^(', HHMMSSFS_PART_REGEXP, ')$'); + DEFMASK1_0_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^(', HHMMSSFS_PART_REGEXP, ')?\s*', + MASKSEP_REGEXP, '*\s*($comp_month$)\s*', DAYMM_REGEXP, '\s+', COMPYEAR_REGEXP, + '\s*(', HHMMSSFS_PART_REGEXP, ')?$'); + DEFMASK1_1_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', MASKSEP_REGEXP, '?\s*($comp_month$)\s*', DAYMM_REGEXP, '\s+', COMPYEAR_REGEXP, '$'); + DEFMASK1_2_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', MASKSEP_REGEXP, '\s*($comp_month$)\s*', DAYMM_REGEXP, '\s+', COMPYEAR_REGEXP, '$'); + DEFMASK2_0_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^(', HHMMSSFS_PART_REGEXP, ')?\s*', + DAYMM_REGEXP, '\s*', MASKSEP_REGEXP, '*\s*($comp_month$)\s*', COMPYEAR_REGEXP, + '\s*(', HHMMSSFS_PART_REGEXP, ')?$'); + DEFMASK2_1_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', DAYMM_REGEXP, '\s*', MASKSEP_REGEXP, '?\s*($comp_month$)\s*', COMPYEAR_REGEXP, '$'); + DEFMASK2_2_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', DAYMM_REGEXP, '\s*', MASKSEP_REGEXP, '\s*($comp_month$)\s*', COMPYEAR_REGEXP, '$'); + DEFMASK3_0_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^(', HHMMSSFS_PART_REGEXP, ')?\s*', + FULLYEAR_REGEXP, '\s*', MASKSEP_REGEXP, '*\s*($comp_month$)\s*', DAYMM_REGEXP, + '\s*(', HHMMSSFS_PART_REGEXP, ')?$'); + DEFMASK3_1_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', FULLYEAR_REGEXP, '\s*', MASKSEP_REGEXP, '?\s*($comp_month$)\s*', DAYMM_REGEXP, '$'); + DEFMASK3_2_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', FULLYEAR_REGEXP, '\s*', MASKSEP_REGEXP, '\s*($comp_month$)\s*', DAYMM_REGEXP, '$'); + DEFMASK4_0_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^(', HHMMSSFS_PART_REGEXP, ')?\s*', + FULLYEAR_REGEXP, '\s+', DAYMM_REGEXP, '\s*', MASKSEP_REGEXP, '*\s*($comp_month$)', + '\s*(', HHMMSSFS_PART_REGEXP, ')?$'); + DEFMASK4_1_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', FULLYEAR_REGEXP, '\s+', DAYMM_REGEXP, '\s*', MASKSEP_REGEXP, '?\s*($comp_month$)$'); + DEFMASK4_2_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', FULLYEAR_REGEXP, '\s+', DAYMM_REGEXP, '\s*', MASKSEP_REGEXP, '\s*($comp_month$)$'); + DEFMASK5_0_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^(', HHMMSSFS_PART_REGEXP, ')?\s*', + DAYMM_REGEXP, '\s+', COMPYEAR_REGEXP, '\s*', MASKSEP_REGEXP, '*\s*($comp_month$)', + '\s*(', HHMMSSFS_PART_REGEXP, ')?$'); + DEFMASK5_1_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', DAYMM_REGEXP, '\s+', COMPYEAR_REGEXP, '\s*', MASKSEP_REGEXP, '?\s*($comp_month$)$'); + DEFMASK5_2_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', DAYMM_REGEXP, '\s+', COMPYEAR_REGEXP, '\s*', MASKSEP_REGEXP, '\s*($comp_month$)$'); + DEFMASK6_0_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^(', HHMMSSFS_PART_REGEXP, ')?\s*', + MASKSEP_REGEXP, '*\s*($comp_month$)\s*', FULLYEAR_REGEXP, '\s+', DAYMM_REGEXP, + '\s*(', HHMMSSFS_PART_REGEXP, ')?$'); + DEFMASK6_1_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', MASKSEP_REGEXP, '?\s*($comp_month$)\s*', FULLYEAR_REGEXP, '\s+', DAYMM_REGEXP, '$'); + DEFMASK6_2_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', MASKSEP_REGEXP, '\s*($comp_month$)\s*', FULLYEAR_REGEXP, '\s+', DAYMM_REGEXP, '$'); + DEFMASK7_0_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^(', HHMMSSFS_PART_REGEXP, ')?\s*', + MASKSEP_REGEXP, '*\s*($comp_month$)\s*', DAYMM_REGEXP, '\s*,\s*', COMPYEAR_REGEXP, + '\s*(', HHMMSSFS_PART_REGEXP, ')?$'); + DEFMASK7_1_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', MASKSEP_REGEXP, '?\s*($comp_month$)\s*', DAYMM_REGEXP, '\s*,\s*', COMPYEAR_REGEXP, '$'); + DEFMASK7_2_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', MASKSEP_REGEXP, '\s*($comp_month$)\s*', DAYMM_REGEXP, '\s*,\s*', COMPYEAR_REGEXP, '$'); + DEFMASK8_0_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^(', HHMMSSFS_PART_REGEXP, ')?\s*', + FULLYEAR_REGEXP, '\s*', MASKSEP_REGEXP, '*\s*($comp_month$)', + '\s*(', HHMMSSFS_PART_REGEXP, ')?$'); + DEFMASK8_1_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', FULLYEAR_REGEXP, '\s*', MASKSEP_REGEXP, '?\s*($comp_month$)$'); + DEFMASK8_2_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', FULLYEAR_REGEXP, '\s*', MASKSEP_REGEXP, '\s*($comp_month$)$'); + DEFMASK9_0_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^(', HHMMSSFS_PART_REGEXP, ')?\s*', + MASKSEP_REGEXP, '*\s*($comp_month$)\s*', FULLYEAR_REGEXP, + '\s*(', HHMMSSFS_PART_REGEXP, ')?$'); + DEFMASK9_1_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', MASKSEP_REGEXP, '?\s*($comp_month$)\s*', FULLYEAR_REGEXP, '$'); + DEFMASK9_2_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', MASKSEP_REGEXP, '\s*($comp_month$)\s*', FULLYEAR_REGEXP, '$'); + DEFMASK10_0_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^(', HHMMSSFS_PART_REGEXP, ')?\s*', + DAYMM_REGEXP, '\s*', MASKSEP_REGEXP, '\s*($comp_month$)\s*', MASKSEP_REGEXP, '\s*', COMPYEAR_REGEXP, + '\s*(', HHMMSSFS_PART_REGEXP, ')?$'); + DEFMASK10_1_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', DAYMM_REGEXP, '\s*', MASKSEP_REGEXP, '\s*($comp_month$)\s*', MASKSEP_REGEXP, '\s*', COMPYEAR_REGEXP, '$'); + DOT_SLASH_DASH_COMPYEAR1_0_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^(', HHMMSSFS_PART_REGEXP, ')?\s*', + DAYMM_REGEXP, '\s*(?:\.|/|-)\s*', DAYMM_REGEXP, '\s*(?:\.|/|-)\s*', COMPYEAR_REGEXP, + '\s*(', HHMMSSFS_PART_REGEXP, ')?$'); + DOT_SLASH_DASH_COMPYEAR1_1_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', DAYMM_REGEXP, '\s*', MASKSEP_REGEXP, '\s*', DAYMM_REGEXP, '\s*', MASKSEP_REGEXP, '\s*', COMPYEAR_REGEXP, '$'); + DOT_SLASH_DASH_SHORTYEAR_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', DAYMM_REGEXP, '\s*', MASKSEP_REGEXP, '\s*', DAYMM_REGEXP, '\s*', MASKSEP_REGEXP, '\s*', SHORTYEAR_REGEXP, '$'); + DOT_SLASH_DASH_FULLYEAR1_0_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^(', HHMMSSFS_PART_REGEXP, ')?\s*', + DAYMM_REGEXP, '\s*(?:\.|/|-)\s*', DAYMM_REGEXP, '\s*(?:\.|/|-)\s*', FULLYEAR_REGEXP, + '\s*(', HHMMSSFS_PART_REGEXP, ')?$'); + DOT_SLASH_DASH_FULLYEAR1_1_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', DAYMM_REGEXP, '\s*', MASKSEP_REGEXP, '\s*', DAYMM_REGEXP, '\s*', MASKSEP_REGEXP, '\s*', FULLYEAR_REGEXP, '$'); + FULLYEAR_DOT_SLASH_DASH1_0_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^(', HHMMSSFS_PART_REGEXP, ')?\s*', + FULLYEAR_REGEXP, '\s*', MASKSEP_REGEXP, '\s*', DAYMM_REGEXP, '\s*', MASKSEP_REGEXP, '\s*', DAYMM_REGEXP, + '\s*(', HHMMSSFS_PART_REGEXP, ')?$'); + FULLYEAR_DOT_SLASH_DASH1_1_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', FULLYEAR_REGEXP, '\s*', MASKSEP_REGEXP, '\s*', DAYMM_REGEXP, '\s*', MASKSEP_REGEXP, '\s*', DAYMM_REGEXP, '$'); + SHORT_DIGITMASK1_0_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^(', HHMMSSFS_PART_REGEXP, ')?\s*\d{6}\s*(', HHMMSSFS_PART_REGEXP, ')?$'); + FULL_DIGITMASK1_0_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^(', HHMMSSFS_PART_REGEXP, ')?\s*\d{8}\s*(', HHMMSSFS_PART_REGEXP, ')?$'); +BEGIN + v_datatype := trim(p_datatype); + v_datetimestring := pg_catalog.upper(trim(p_datetimestring)); + v_style := floor(p_style)::SMALLINT; + + v_datatype_groups := regexp_matches(v_datatype, DATATYPE_REGEXP, 'gi'); + + v_res_datatype := pg_catalog.upper(v_datatype_groups[1]); + v_scale := v_datatype_groups[2]::SMALLINT; + + IF (v_res_datatype IS NULL) THEN + RAISE datatype_mismatch; + ELSIF (v_res_datatype <> 'DATETIME2' AND v_scale IS NOT NULL) + THEN + RAISE invalid_indicator_parameter_value; + ELSIF (coalesce(v_scale, 0) NOT BETWEEN 0 AND 7) + THEN + RAISE interval_field_overflow; + ELSIF (v_scale IS NULL) THEN + v_scale := 7; + END IF; + + IF (scale(p_style) > 0) THEN + RAISE most_specific_type_mismatch; + ELSIF (NOT ((v_style BETWEEN 0 AND 14) OR + (v_style BETWEEN 20 AND 25) OR + (v_style BETWEEN 100 AND 114) OR + (v_style IN (120, 121, 126, 127, 130, 131))) AND + v_res_datatype = 'DATETIME2') + THEN + RAISE invalid_parameter_value; + END IF; + + v_timepart := trim(substring(v_datetimestring, HHMMSSFS_PART_REGEXP)); + v_datestring := trim(regexp_replace(v_datetimestring, HHMMSSFS_PART_REGEXP, '', 'gi')); + + BEGIN + v_lang_metadata_json := sys.babelfish_get_lang_metadata_json(CONVERSION_LANG); + EXCEPTION + WHEN OTHERS THEN + RAISE invalid_escape_sequence; + END; + + v_date_format := coalesce(nullif(DATE_FORMAT, ''), v_lang_metadata_json ->> 'date_format'); + + v_compmonth_regexp := array_to_string(array_cat(ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'months_shortnames')), + ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'months_names'))), '|'); + + IF (v_datetimestring ~* pg_catalog.replace(DEFMASK1_0_REGEXP, '$comp_month$', v_compmonth_regexp) OR + v_datetimestring ~* pg_catalog.replace(DEFMASK2_0_REGEXP, '$comp_month$', v_compmonth_regexp) OR + v_datetimestring ~* pg_catalog.replace(DEFMASK3_0_REGEXP, '$comp_month$', v_compmonth_regexp) OR + v_datetimestring ~* pg_catalog.replace(DEFMASK4_0_REGEXP, '$comp_month$', v_compmonth_regexp) OR + v_datetimestring ~* pg_catalog.replace(DEFMASK5_0_REGEXP, '$comp_month$', v_compmonth_regexp) OR + v_datetimestring ~* pg_catalog.replace(DEFMASK6_0_REGEXP, '$comp_month$', v_compmonth_regexp) OR + v_datetimestring ~* pg_catalog.replace(DEFMASK7_0_REGEXP, '$comp_month$', v_compmonth_regexp) OR + v_datetimestring ~* pg_catalog.replace(DEFMASK8_0_REGEXP, '$comp_month$', v_compmonth_regexp) OR + v_datetimestring ~* pg_catalog.replace(DEFMASK9_0_REGEXP, '$comp_month$', v_compmonth_regexp) OR + v_datetimestring ~* pg_catalog.replace(DEFMASK10_0_REGEXP, '$comp_month$', v_compmonth_regexp)) + THEN + IF ((v_style IN (127, 130, 131) AND v_res_datatype IN ('DATETIME', 'SMALLDATETIME')) OR + (v_style IN (130, 131) AND v_res_datatype = 'DATETIME2')) + THEN + RAISE invalid_datetime_format; + END IF; + + IF ((v_datestring ~* pg_catalog.replace(DEFMASK1_2_REGEXP, '$comp_month$', v_compmonth_regexp) OR + v_datestring ~* pg_catalog.replace(DEFMASK2_2_REGEXP, '$comp_month$', v_compmonth_regexp) OR + v_datestring ~* pg_catalog.replace(DEFMASK3_2_REGEXP, '$comp_month$', v_compmonth_regexp) OR + v_datestring ~* pg_catalog.replace(DEFMASK4_2_REGEXP, '$comp_month$', v_compmonth_regexp) OR + v_datestring ~* pg_catalog.replace(DEFMASK5_2_REGEXP, '$comp_month$', v_compmonth_regexp) OR + v_datestring ~* pg_catalog.replace(DEFMASK6_2_REGEXP, '$comp_month$', v_compmonth_regexp) OR + v_datestring ~* pg_catalog.replace(DEFMASK7_2_REGEXP, '$comp_month$', v_compmonth_regexp) OR + v_datestring ~* pg_catalog.replace(DEFMASK8_2_REGEXP, '$comp_month$', v_compmonth_regexp) OR + v_datestring ~* pg_catalog.replace(DEFMASK9_2_REGEXP, '$comp_month$', v_compmonth_regexp)) AND + v_res_datatype = 'DATETIME2') + THEN + RAISE invalid_datetime_format; + END IF; + + IF (v_datestring ~* pg_catalog.replace(DEFMASK1_1_REGEXP, '$comp_month$', v_compmonth_regexp)) + THEN + v_regmatch_groups := regexp_matches(v_datestring, pg_catalog.replace(DEFMASK1_1_REGEXP, '$comp_month$', v_compmonth_regexp), 'gi'); + v_day := v_regmatch_groups[2]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[1], v_lang_metadata_json); + v_year := sys.babelfish_get_full_year(v_regmatch_groups[3]); + + ELSIF (v_datestring ~* pg_catalog.replace(DEFMASK2_1_REGEXP, '$comp_month$', v_compmonth_regexp)) + THEN + v_regmatch_groups := regexp_matches(v_datestring, pg_catalog.replace(DEFMASK2_1_REGEXP, '$comp_month$', v_compmonth_regexp), 'gi'); + v_day := v_regmatch_groups[1]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[2], v_lang_metadata_json); + v_year := sys.babelfish_get_full_year(v_regmatch_groups[3]); + + ELSIF (v_datestring ~* pg_catalog.replace(DEFMASK3_1_REGEXP, '$comp_month$', v_compmonth_regexp)) + THEN + v_regmatch_groups := regexp_matches(v_datestring, pg_catalog.replace(DEFMASK3_1_REGEXP, '$comp_month$', v_compmonth_regexp), 'gi'); + v_day := v_regmatch_groups[3]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[2], v_lang_metadata_json); + v_year := v_regmatch_groups[1]; + + ELSIF (v_datestring ~* pg_catalog.replace(DEFMASK4_1_REGEXP, '$comp_month$', v_compmonth_regexp)) + THEN + v_regmatch_groups := regexp_matches(v_datestring, pg_catalog.replace(DEFMASK4_1_REGEXP, '$comp_month$', v_compmonth_regexp), 'gi'); + v_day := v_regmatch_groups[2]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[3], v_lang_metadata_json); + v_year := v_regmatch_groups[1]; + + ELSIF (v_datestring ~* pg_catalog.replace(DEFMASK5_1_REGEXP, '$comp_month$', v_compmonth_regexp)) + THEN + v_regmatch_groups := regexp_matches(v_datestring, pg_catalog.replace(DEFMASK5_1_REGEXP, '$comp_month$', v_compmonth_regexp), 'gi'); + v_day := v_regmatch_groups[1]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[3], v_lang_metadata_json); + v_year := sys.babelfish_get_full_year(v_regmatch_groups[2]); + + ELSIF (v_datestring ~* pg_catalog.replace(DEFMASK6_1_REGEXP, '$comp_month$', v_compmonth_regexp)) + THEN + v_regmatch_groups := regexp_matches(v_datestring, pg_catalog.replace(DEFMASK6_1_REGEXP, '$comp_month$', v_compmonth_regexp), 'gi'); + v_day := v_regmatch_groups[3]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[1], v_lang_metadata_json); + v_year := v_regmatch_groups[2]; + + ELSIF (v_datestring ~* pg_catalog.replace(DEFMASK7_1_REGEXP, '$comp_month$', v_compmonth_regexp)) + THEN + v_regmatch_groups := regexp_matches(v_datestring, pg_catalog.replace(DEFMASK7_1_REGEXP, '$comp_month$', v_compmonth_regexp), 'gi'); + v_day := v_regmatch_groups[2]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[1], v_lang_metadata_json); + v_year := sys.babelfish_get_full_year(v_regmatch_groups[3]); + + ELSIF (v_datestring ~* pg_catalog.replace(DEFMASK8_1_REGEXP, '$comp_month$', v_compmonth_regexp)) + THEN + v_regmatch_groups := regexp_matches(v_datestring, pg_catalog.replace(DEFMASK8_1_REGEXP, '$comp_month$', v_compmonth_regexp), 'gi'); + v_day := '01'; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[2], v_lang_metadata_json); + v_year := v_regmatch_groups[1]; + + ELSIF (v_datestring ~* pg_catalog.replace(DEFMASK9_1_REGEXP, '$comp_month$', v_compmonth_regexp)) + THEN + v_regmatch_groups := regexp_matches(v_datestring, pg_catalog.replace(DEFMASK9_1_REGEXP, '$comp_month$', v_compmonth_regexp), 'gi'); + v_day := '01'; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[1], v_lang_metadata_json); + v_year := v_regmatch_groups[2]; + + ELSIF (v_datestring ~* pg_catalog.replace(DEFMASK10_1_REGEXP, '$comp_month$', v_compmonth_regexp)) + THEN + v_regmatch_groups := regexp_matches(v_datestring, pg_catalog.replace(DEFMASK10_1_REGEXP, '$comp_month$', v_compmonth_regexp), 'gi'); + v_day := v_regmatch_groups[1]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[2], v_lang_metadata_json); + v_year := sys.babelfish_get_full_year(v_regmatch_groups[3]); + ELSE + RAISE invalid_character_value_for_cast; + END IF; + ELSIF (v_datetimestring ~* DOT_SLASH_DASH_COMPYEAR1_0_REGEXP) + THEN + IF (v_style IN (6, 7, 8, 9, 12, 13, 14, 24, 100, 106, 107, 108, 109, 112, 113, 114, 130) AND + v_res_datatype = 'DATETIME2') + THEN + RAISE invalid_regular_expression; + END IF; + + v_regmatch_groups := regexp_matches(v_datestring, DOT_SLASH_DASH_COMPYEAR1_1_REGEXP, 'gi'); + v_leftpart := v_regmatch_groups[1]; + v_middlepart := v_regmatch_groups[2]; + v_rightpart := v_regmatch_groups[3]; + + IF (v_datestring ~* DOT_SLASH_DASH_SHORTYEAR_REGEXP) + THEN + IF ((v_style NOT IN (0, 1, 2, 3, 4, 5, 10, 11) AND v_res_datatype IN ('DATETIME', 'SMALLDATETIME')) OR + (v_style NOT IN (0, 1, 2, 3, 4, 5, 10, 11, 12) AND v_res_datatype = 'DATETIME2')) + THEN + RAISE invalid_datetime_format; + END IF; + + IF ((v_style IN (1, 10) AND v_date_format <> 'MDY' AND v_res_datatype IN ('DATETIME', 'SMALLDATETIME')) OR + (v_style IN (0, 1, 10) AND v_date_format NOT IN ('DMY', 'DYM', 'MYD', 'YMD', 'YDM') AND v_res_datatype IN ('DATETIME', 'SMALLDATETIME')) OR + (v_style IN (0, 1, 10, 22) AND v_date_format NOT IN ('DMY', 'DYM', 'MYD', 'YMD', 'YDM') AND v_res_datatype = 'DATETIME2') OR + (v_style IN (1, 10, 22) AND v_date_format IN ('DMY', 'DYM', 'MYD', 'YMD', 'YDM') AND v_res_datatype = 'DATETIME2')) + THEN + v_day := v_middlepart; + v_month := v_leftpart; + v_year := sys.babelfish_get_full_year(v_rightpart); + + ELSIF ((v_style IN (2, 11) AND v_date_format <> 'YMD') OR + (v_style IN (0, 2, 11) AND v_date_format = 'YMD')) + THEN + v_day := v_rightpart; + v_month := v_middlepart; + v_year := sys.babelfish_get_full_year(v_leftpart); + + ELSIF ((v_style IN (3, 4, 5) AND v_date_format <> 'DMY') OR + (v_style IN (0, 3, 4, 5) AND v_date_format = 'DMY')) + THEN + v_day := v_leftpart; + v_month := v_middlepart; + v_year := sys.babelfish_get_full_year(v_rightpart); + + ELSIF (v_style = 0 AND v_date_format = 'DYM') + THEN + v_day = v_leftpart; + v_month = v_rightpart; + v_year = sys.babelfish_get_full_year(v_middlepart); + + ELSIF (v_style = 0 AND v_date_format = 'MYD') + THEN + v_day := v_rightpart; + v_month := v_leftpart; + v_year = sys.babelfish_get_full_year(v_middlepart); + + ELSIF (v_style = 0 AND v_date_format = 'YDM') + THEN + IF (v_res_datatype = 'DATETIME2') THEN + RAISE character_not_in_repertoire; + END IF; + + v_day := v_middlepart; + v_month := v_rightpart; + v_year := sys.babelfish_get_full_year(v_leftpart); + ELSE + RAISE invalid_character_value_for_cast; + END IF; + ELSIF (v_datestring ~* DOT_SLASH_DASH_FULLYEAR1_1_REGEXP) + THEN + IF (v_style NOT IN (0, 20, 21, 101, 102, 103, 104, 105, 110, 111, 120, 121, 130, 131) AND + v_res_datatype IN ('DATETIME', 'SMALLDATETIME')) + THEN + RAISE invalid_datetime_format; + ELSIF (v_style IN (130, 131) AND v_res_datatype = 'SMALLDATETIME') THEN + RAISE invalid_character_value_for_cast; + END IF; + + v_year := v_rightpart; + IF (v_leftpart::SMALLINT <= 12) + THEN + IF ((v_style IN (103, 104, 105, 130, 131) AND v_date_format NOT IN ('DMY', 'DYM', 'YDM')) OR + (v_style IN (0, 103, 104, 105, 130, 131) AND ((v_date_format = 'DMY' AND v_res_datatype = 'DATETIME2') OR + (v_date_format IN ('DMY', 'DYM', 'YDM') AND v_res_datatype <> 'DATETIME2'))) OR + (v_style IN (103, 104, 105, 130, 131) AND v_date_format IN ('DMY', 'DYM', 'YDM') AND v_res_datatype = 'DATETIME2')) + THEN + v_day := v_leftpart; + v_month := v_middlepart; + + ELSIF ((v_style IN (20, 21, 101, 102, 110, 111, 120, 121) AND v_date_format IN ('DMY', 'DYM', 'YDM') AND v_res_datatype IN ('DATETIME', 'SMALLDATETIME')) OR + (v_style IN (0, 20, 21, 101, 102, 110, 111, 120, 121) AND v_date_format NOT IN ('DMY', 'DYM', 'YDM') AND v_res_datatype IN ('DATETIME', 'SMALLDATETIME')) OR + (v_style IN (101, 110) AND v_date_format IN ('DMY', 'DYM', 'MYD', 'YDM') AND v_res_datatype = 'DATETIME2') OR + (v_style IN (0, 101, 110) AND v_date_format NOT IN ('DMY', 'DYM', 'MYD', 'YDM') AND v_res_datatype = 'DATETIME2')) + THEN + v_day := v_middlepart; + v_month := v_leftpart; + END IF; + ELSE + IF ((v_style IN (103, 104, 105, 130, 131) AND v_date_format NOT IN ('DMY', 'DYM', 'YDM')) OR + (v_style IN (0, 103, 104, 105, 130, 131) AND ((v_date_format = 'DMY' AND v_res_datatype = 'DATETIME2') OR + (v_date_format IN ('DMY', 'DYM', 'YDM') AND v_res_datatype <> 'DATETIME2'))) OR + (v_style IN (103, 104, 105, 130, 131) AND v_date_format IN ('DMY', 'DYM', 'YDM') AND v_res_datatype = 'DATETIME2')) + THEN + v_day := v_leftpart; + v_month := v_middlepart; + ELSE + IF (v_res_datatype = 'DATETIME2') THEN + RAISE invalid_datetime_format; + END IF; + + RAISE invalid_character_value_for_cast; + END IF; + END IF; + END IF; + ELSIF (v_datetimestring ~* FULLYEAR_DOT_SLASH_DASH1_0_REGEXP) + THEN + IF (v_style NOT IN (0, 20, 21, 101, 102, 103, 104, 105, 110, 111, 120, 121, 130, 131) AND + v_res_datatype IN ('DATETIME', 'SMALLDATETIME')) + THEN + RAISE invalid_datetime_format; + ELSIF (v_style IN (6, 7, 8, 9, 12, 13, 14, 24, 100, 106, 107, 108, 109, 112, 113, 114, 130) AND + v_res_datatype = 'DATETIME2') + THEN + RAISE invalid_regular_expression; + ELSIF (v_style IN (130, 131) AND v_res_datatype = 'SMALLDATETIME') + THEN + RAISE invalid_character_value_for_cast; + END IF; + + v_regmatch_groups := regexp_matches(v_datestring, FULLYEAR_DOT_SLASH_DASH1_1_REGEXP, 'gi'); + v_year := v_regmatch_groups[1]; + v_middlepart := v_regmatch_groups[2]; + v_rightpart := v_regmatch_groups[3]; + + IF ((v_res_datatype IN ('DATETIME', 'SMALLDATETIME') AND v_rightpart::SMALLINT <= 12) OR v_res_datatype = 'DATETIME2') + THEN + IF ((v_style IN (20, 21, 101, 102, 110, 111, 120, 121) AND v_date_format IN ('DMY', 'DYM', 'YDM') AND v_res_datatype <> 'DATETIME2') OR + (v_style IN (0, 20, 21, 101, 102, 110, 111, 120, 121) AND v_date_format NOT IN ('DMY', 'DYM', 'YDM') AND v_res_datatype <> 'DATETIME2') OR + (v_style IN (0, 20, 21, 23, 25, 101, 102, 110, 111, 120, 121, 126, 127) AND v_res_datatype = 'DATETIME2')) + THEN + v_day := v_rightpart; + v_month := v_middlepart; + + ELSIF ((v_style IN (103, 104, 105, 130, 131) AND v_date_format NOT IN ('DMY', 'DYM', 'YDM')) OR + v_style IN (0, 103, 104, 105, 130, 131) AND v_date_format IN ('DMY', 'DYM', 'YDM')) + THEN + v_day := v_middlepart; + v_month := v_rightpart; + END IF; + ELSIF (v_res_datatype IN ('DATETIME', 'SMALLDATETIME') AND v_rightpart::SMALLINT > 12) + THEN + IF ((v_style IN (20, 21, 101, 102, 110, 111, 120, 121) AND v_date_format IN ('DMY', 'DYM', 'YDM')) OR + (v_style IN (0, 20, 21, 101, 102, 110, 111, 120, 121) AND v_date_format NOT IN ('DMY', 'DYM', 'YDM'))) + THEN + v_day := v_rightpart; + v_month := v_middlepart; + + ELSIF ((v_style IN (103, 104, 105, 130, 131) AND v_date_format NOT IN ('DMY', 'DYM', 'YDM')) OR + (v_style IN (0, 103, 104, 105, 130, 131) AND v_date_format IN ('DMY', 'DYM', 'YDM'))) + THEN + RAISE invalid_character_value_for_cast; + END IF; + END IF; + ELSIF (v_datetimestring ~* SHORT_DIGITMASK1_0_REGEXP OR + v_datetimestring ~* FULL_DIGITMASK1_0_REGEXP) + THEN + IF (v_style = 127 AND v_res_datatype <> 'DATETIME2') + THEN + RAISE invalid_datetime_format; + ELSIF (v_style IN (130, 131) AND v_res_datatype = 'SMALLDATETIME') + THEN + RAISE invalid_character_value_for_cast; + END IF; + + IF (v_datestring ~* '^\d{6}$') + THEN + v_day := substr(v_datestring, 5, 2); + v_month := substr(v_datestring, 3, 2); + v_year := sys.babelfish_get_full_year(substr(v_datestring, 1, 2)); + + ELSIF (v_datestring ~* '^\d{8}$') + THEN + v_day := substr(v_datestring, 7, 2); + v_month := substr(v_datestring, 5, 2); + v_year := substr(v_datestring, 1, 4); + END IF; + ELSIF (v_datetimestring ~* HHMMSSFS_REGEXP) + THEN + v_day := '01'; + v_month := '01'; + v_year := '1900'; + ELSIF (v_datetimestring ~* DIGITREPRESENT_REGEXP) + THEN + v_resdatetime = CAST('1900-01-01 00:00:00.0' AS sys.DATETIME) + v_datetimestring::NUMERIC; + RETURN v_resdatetime; + ELSE + RAISE invalid_datetime_format; + END IF; + + IF (((v_datetimestring ~* HHMMSSFS_PART_REGEXP AND v_res_datatype = 'DATETIME2') OR + (v_datetimestring ~* SHORT_DIGITMASK1_0_REGEXP OR v_datetimestring ~* FULL_DIGITMASK1_0_REGEXP OR + v_datetimestring ~* FULLYEAR_DOT_SLASH_DASH1_0_REGEXP OR v_datetimestring ~* DOT_SLASH_DASH_FULLYEAR1_0_REGEXP)) AND + v_style IN (130, 131)) + THEN + v_hijridate := sys.babelfish_conv_hijri_to_greg(v_day, v_month, v_year) - 1; + v_day = to_char(v_hijridate, 'DD'); + v_month = to_char(v_hijridate, 'MM'); + v_year = to_char(v_hijridate, 'YYYY'); + END IF; + + v_hours := coalesce(sys.babelfish_get_timeunit_from_string(v_timepart, 'HOURS'), '0'); + v_minutes := coalesce(sys.babelfish_get_timeunit_from_string(v_timepart, 'MINUTES'), '0'); + v_seconds := coalesce(sys.babelfish_get_timeunit_from_string(v_timepart, 'SECONDS'), '0'); + v_fseconds := coalesce(sys.babelfish_get_timeunit_from_string(v_timepart, 'FRACTSECONDS'), '0'); + + IF ((v_res_datatype IN ('DATETIME', 'SMALLDATETIME') OR + (v_res_datatype = 'DATETIME2' AND v_timepart !~* HHMMSSFS_DOT_PART_REGEXP)) AND + char_length(v_fseconds) > 3) + THEN + RAISE invalid_datetime_format; + END IF; + + BEGIN + IF (v_res_datatype IN ('DATETIME', 'SMALLDATETIME')) + THEN + v_resdatetime := sys.datetimefromparts(v_year, v_month, v_day, + v_hours, v_minutes, v_seconds, + rpad(v_fseconds, 3, '0')); + IF (v_res_datatype = 'SMALLDATETIME' AND + to_char(v_resdatetime, 'SS') <> '00') + THEN + IF (to_char(v_resdatetime, 'SS')::SMALLINT >= 30) THEN + v_resdatetime := v_resdatetime + INTERVAL '1 minute'; + END IF; + + v_resdatetime := to_timestamp(to_char(v_resdatetime, 'DD.MM.YYYY.HH24.MI'), 'DD.MM.YYYY.HH24.MI'); + END IF; + ELSIF (v_res_datatype = 'DATETIME2') + THEN + v_fseconds := sys.babelfish_get_microsecs_from_fractsecs(v_fseconds, v_scale); + v_seconds := concat_ws('.', v_seconds, v_fseconds); + v_resdatetime := make_timestamp(v_year::SMALLINT, v_month::SMALLINT, v_day::SMALLINT, + v_hours::SMALLINT, v_minutes::SMALLINT, v_seconds::NUMERIC); + END IF; + EXCEPTION + WHEN datetime_field_overflow THEN + RAISE invalid_datetime_format; + WHEN OTHERS THEN + GET STACKED DIAGNOSTICS v_err_message = MESSAGE_TEXT; + + IF (v_err_message ~* 'Cannot construct data type') THEN + RAISE invalid_character_value_for_cast; + END IF; + END; + + RETURN v_resdatetime; +EXCEPTION + WHEN most_specific_type_mismatch THEN + RAISE USING MESSAGE := 'Argument data type NUMERIC is invalid for argument 3 of conv_string_to_datetime function.', + DETAIL := 'Use of incorrect "style" parameter value during conversion process.', + HINT := 'Change "style" parameter to the proper value and try again.'; + + WHEN invalid_parameter_value THEN + RAISE USING MESSAGE := pg_catalog.format('The style %s is not supported for conversions from VARCHAR to %s.', v_style, v_res_datatype), + DETAIL := 'Use of incorrect "style" parameter value during conversion process.', + HINT := 'Change "style" parameter to the proper value and try again.'; + + WHEN invalid_regular_expression THEN + RAISE USING MESSAGE := pg_catalog.format('The input character string doesn''t follow style %s.', v_style), + DETAIL := 'Selected "style" param value isn''t valid for conversion of passed character string.', + HINT := 'Either change the input character string or use a different style.'; + + WHEN datatype_mismatch THEN + RAISE USING MESSAGE := 'Data type should be one of these values: ''DATETIME'', ''SMALLDATETIME'', ''DATETIME2''/''DATETIME2(n)''.', + DETAIL := 'Use of incorrect "datatype" parameter value during conversion process.', + HINT := 'Change "datatype" parameter to the proper value and try again.'; + + WHEN invalid_indicator_parameter_value THEN + RAISE USING MESSAGE := pg_catalog.format('Invalid attributes specified for data type %s.', v_res_datatype), + DETAIL := 'Use of incorrect scale value, which is not corresponding to specified data type.', + HINT := 'Change data type scale component or select different data type and try again.'; + + WHEN interval_field_overflow THEN + RAISE USING MESSAGE := pg_catalog.format('Specified scale %s is invalid.', v_scale), + DETAIL := 'Use of incorrect data type scale value during conversion process.', + HINT := 'Change scale component of data type parameter to be in range [0..7] and try again.'; + + WHEN invalid_datetime_format THEN + RAISE USING MESSAGE := CASE v_res_datatype + WHEN 'SMALLDATETIME' THEN 'Conversion failed when converting character string to SMALLDATETIME data type.' + ELSE 'Conversion failed when converting date and time from character string.' + END, + DETAIL := 'Incorrect using of pair of input parameters values during conversion process.', + HINT := 'Check the input parameters values, correct them if needed, and try again.'; + + WHEN invalid_character_value_for_cast THEN + RAISE USING MESSAGE := 'The conversion of a VARCHAR data type to a DATETIME data type resulted in an out-of-range value.', + DETAIL := 'Use of incorrect pair of input parameter values during conversion process.', + HINT := 'Check input parameter values, correct them if needed, and try again.'; + + WHEN character_not_in_repertoire THEN + RAISE USING MESSAGE := 'The YDM date format isn''t supported when converting from this string format to date and time.', + DETAIL := 'Use of incorrect DATE_FORMAT constant value regarding string format parameter during conversion process.', + HINT := 'Change DATE_FORMAT constant to one of these values: MDY|DMY|DYM, recompile function and try again.'; + + WHEN invalid_escape_sequence THEN + RAISE USING MESSAGE := pg_catalog.format('Invalid CONVERSION_LANG constant value - ''%s''. Allowed values are: ''English'', ''Deutsch'', etc.', + CONVERSION_LANG), + DETAIL := 'Compiled incorrect CONVERSION_LANG constant value in function''s body.', + HINT := 'Correct CONVERSION_LANG constant value in function''s body, recompile it and try again.'; + + WHEN invalid_text_representation THEN + GET STACKED DIAGNOSTICS v_err_message = MESSAGE_TEXT; + v_err_message := substring(pg_catalog.lower(v_err_message), 'integer\:\s\"(.*)\"'); + + RAISE USING MESSAGE := pg_catalog.format('Error while trying to convert "%s" value to SMALLINT data type.', + v_err_message), + DETAIL := 'Passed argument value contains illegal characters.', + HINT := 'Correct passed argument value, remove all illegal characters.'; +END; +$BODY$ +LANGUAGE plpgsql +STABLE +RETURNS NULL ON NULL INPUT; + +CREATE OR REPLACE FUNCTION sys.babelfish_conv_string_to_time(IN p_datatype TEXT, + IN p_timestring TEXT, + IN p_style NUMERIC DEFAULT 0) +RETURNS TIME WITHOUT TIME ZONE +AS +$BODY$ +DECLARE + v_hours SMALLINT; + v_style SMALLINT; + v_scale SMALLINT; + v_daypart VARCHAR COLLATE "C"; + v_seconds VARCHAR COLLATE "C"; + v_minutes SMALLINT; + v_fseconds VARCHAR COLLATE "C"; + v_datatype VARCHAR COLLATE "C"; + v_timestring VARCHAR COLLATE "C"; + v_err_message VARCHAR COLLATE "C"; + v_src_datatype VARCHAR COLLATE "C"; + v_timeunit_mask VARCHAR COLLATE "C"; + v_datatype_groups TEXT[]; + v_regmatch_groups TEXT[]; + AMPM_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*([AP]M)'; + TIMEUNIT_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*(\d{1,2})\s*'; + FRACTSECS_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*(\d{1,9})'; + HHMMSSFS_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', TIMEUNIT_REGEXP, + '\:', TIMEUNIT_REGEXP, + '\:', TIMEUNIT_REGEXP, + '(?:\.|\:)', FRACTSECS_REGEXP, '$'); + HHMMSS_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, '$'); + HHMMFS_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, '\.', FRACTSECS_REGEXP, '$'); + HHMM_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, '$'); + HH_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', TIMEUNIT_REGEXP, '$'); + DATATYPE_REGEXP CONSTANT VARCHAR COLLATE "C" := '^(TIME)\s*(?:\()?\s*((?:-)?\d+)?\s*(?:\))?$'; +BEGIN + v_datatype := trim(regexp_replace(p_datatype, 'DATETIME', 'TIME', 'gi')); + v_timestring := pg_catalog.upper(trim(p_timestring)); + v_style := floor(p_style)::SMALLINT; + + v_datatype_groups := regexp_matches(v_datatype, DATATYPE_REGEXP, 'gi'); + + v_src_datatype := pg_catalog.upper(v_datatype_groups[1]); + v_scale := v_datatype_groups[2]::SMALLINT; + + IF (v_src_datatype IS NULL) THEN + RAISE datatype_mismatch; + ELSIF (coalesce(v_scale, 0) NOT BETWEEN 0 AND 7) + THEN + RAISE interval_field_overflow; + ELSIF (v_scale IS NULL) THEN + v_scale := 7; + END IF; + + IF (scale(p_style) > 0) THEN + RAISE most_specific_type_mismatch; + ELSIF (NOT ((v_style BETWEEN 0 AND 14) OR + (v_style BETWEEN 20 AND 25) OR + (v_style BETWEEN 100 AND 114) OR + v_style IN (120, 121, 126, 127, 130, 131))) + THEN + RAISE invalid_parameter_value; + END IF; + + v_daypart := substring(v_timestring, 'AM|PM'); + v_timestring := trim(regexp_replace(v_timestring, coalesce(v_daypart, ''), '')); + + v_timeunit_mask := + CASE + WHEN (v_timestring ~* HHMMSSFS_REGEXP) THEN HHMMSSFS_REGEXP + WHEN (v_timestring ~* HHMMSS_REGEXP) THEN HHMMSS_REGEXP + WHEN (v_timestring ~* HHMMFS_REGEXP) THEN HHMMFS_REGEXP + WHEN (v_timestring ~* HHMM_REGEXP) THEN HHMM_REGEXP + WHEN (v_timestring ~* HH_REGEXP) THEN HH_REGEXP + END; + + IF (v_timeunit_mask IS NULL) THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_timestring, v_timeunit_mask, 'gi'); + + v_hours := v_regmatch_groups[1]::SMALLINT; + v_minutes := v_regmatch_groups[2]::SMALLINT; + + IF (v_timestring ~* HHMMFS_REGEXP) THEN + v_fseconds := v_regmatch_groups[3]; + ELSE + v_seconds := v_regmatch_groups[3]; + v_fseconds := v_regmatch_groups[4]; + END IF; + + IF (v_daypart IS NOT NULL) THEN + IF ((v_daypart = 'AM' AND v_hours NOT BETWEEN 0 AND 12) OR + (v_daypart = 'PM' AND v_hours NOT BETWEEN 1 AND 23)) + THEN + RAISE numeric_value_out_of_range; + ELSIF (v_daypart = 'PM' AND v_hours < 12) THEN + v_hours := v_hours + 12; + ELSIF (v_daypart = 'AM' AND v_hours = 12) THEN + v_hours := v_hours - 12; + END IF; + END IF; + + v_fseconds := sys.babelfish_get_microsecs_from_fractsecs(v_fseconds, v_scale); + v_seconds := concat_ws('.', v_seconds, v_fseconds); + + RETURN make_time(v_hours, v_minutes, v_seconds::NUMERIC); +EXCEPTION + WHEN most_specific_type_mismatch THEN + RAISE USING MESSAGE := 'Argument data type NUMERIC is invalid for argument 3 of conv_string_to_time function.', + DETAIL := 'Use of incorrect "style" parameter value during conversion process.', + HINT := 'Change "style" parameter to the proper value and try again.'; + + WHEN invalid_parameter_value THEN + RAISE USING MESSAGE := pg_catalog.format('The style %s is not supported for conversions from VARCHAR to TIME.', v_style), + DETAIL := 'Use of incorrect "style" parameter value during conversion process.', + HINT := 'Change "style" parameter to the proper value and try again.'; + + WHEN datatype_mismatch THEN + RAISE USING MESSAGE := 'Source data type should be ''TIME'' or ''TIME(n)''.', + DETAIL := 'Use of incorrect "datatype" parameter value during conversion process.', + HINT := 'Change "datatype" parameter to the proper value and try again.'; + + WHEN interval_field_overflow THEN + RAISE USING MESSAGE := pg_catalog.format('Specified scale %s is invalid.', v_scale), + DETAIL := 'Use of incorrect data type scale value during conversion process.', + HINT := 'Change scale component of data type parameter to be in range [0..7] and try again.'; + + WHEN numeric_value_out_of_range THEN + RAISE USING MESSAGE := 'Could not extract correct hour value due to it''s inconsistency with AM|PM day part mark.', + DETAIL := 'Extracted hour value doesn''t fall in correct day part mark range: 0..12 for "AM" or 1..23 for "PM".', + HINT := 'Correct a hour value in the source string or remove AM|PM day part mark out of it.'; + + WHEN invalid_datetime_format THEN + RAISE USING MESSAGE := 'Conversion failed when converting time from character string.', + DETAIL := 'Incorrect using of pair of input parameters values during conversion process.', + HINT := 'Check the input parameters values, correct them if needed, and try again.'; + + WHEN invalid_text_representation THEN + GET STACKED DIAGNOSTICS v_err_message = MESSAGE_TEXT; + v_err_message := substring(pg_catalog.lower(v_err_message), 'integer\:\s\"(.*)\"'); + + RAISE USING MESSAGE := pg_catalog.format('Error while trying to convert "%s" value to SMALLINT data type.', + v_err_message), + DETAIL := 'Supplied value contains illegal characters.', + HINT := 'Correct supplied value, remove all illegal characters.'; +END; +$BODY$ +LANGUAGE plpgsql +STABLE +RETURNS NULL ON NULL INPUT; + +CREATE OR REPLACE FUNCTION sys.babelfish_get_lang_metadata_json(IN p_lang_spec_culture TEXT) +RETURNS JSONB +AS +$BODY$ +DECLARE + v_locale_parts TEXT[] COLLATE "C"; + v_lang_data_jsonb JSONB; + v_lang_spec_culture VARCHAR COLLATE "C"; + v_is_cached BOOLEAN := FALSE; +BEGIN + v_lang_spec_culture := pg_catalog.upper(trim(p_lang_spec_culture)); + + IF (char_length(v_lang_spec_culture) > 0) + THEN + BEGIN + v_lang_data_jsonb := nullif(current_setting(format('sys.lang_metadata_json.%s', + v_lang_spec_culture)), '')::JSONB; + EXCEPTION + WHEN undefined_object THEN + v_lang_data_jsonb := NULL; + END; + + IF (v_lang_data_jsonb IS NULL) + THEN + v_lang_spec_culture := pg_catalog.upper(regexp_replace(v_lang_spec_culture, '-\s*', '_', 'gi')); + IF (v_lang_spec_culture IN ('AR', 'FI') OR + v_lang_spec_culture ~ '_') + THEN + SELECT lang_data_jsonb + INTO STRICT v_lang_data_jsonb + FROM sys.babelfish_syslanguages + WHERE spec_culture = v_lang_spec_culture; + ELSE + SELECT lang_data_jsonb + INTO STRICT v_lang_data_jsonb + FROM sys.babelfish_syslanguages + WHERE lang_name_mssql = v_lang_spec_culture + OR lang_alias_mssql = v_lang_spec_culture; + END IF; + ELSE + v_is_cached := TRUE; + END IF; + ELSE + v_lang_spec_culture := current_setting('LC_TIME'); + + v_lang_spec_culture := CASE + WHEN (v_lang_spec_culture !~ '\.') THEN v_lang_spec_culture + ELSE substring(v_lang_spec_culture, '(.*)(?:\.)') + END; + + v_lang_spec_culture := pg_catalog.upper(regexp_replace(v_lang_spec_culture, ',\s*', '_', 'gi')); + + BEGIN + v_lang_data_jsonb := nullif(current_setting(format('sys.lang_metadata_json.%s', + v_lang_spec_culture)), '')::JSONB; + EXCEPTION + WHEN undefined_object THEN + v_lang_data_jsonb := NULL; + END; + + IF (v_lang_data_jsonb IS NULL) + THEN + BEGIN + IF (char_length(v_lang_spec_culture) = 5) + THEN + SELECT lang_data_jsonb + INTO STRICT v_lang_data_jsonb + FROM sys.babelfish_syslanguages + WHERE spec_culture = v_lang_spec_culture; + ELSE + v_locale_parts := string_to_array(v_lang_spec_culture, '-'); + + SELECT lang_data_jsonb + INTO STRICT v_lang_data_jsonb + FROM sys.babelfish_syslanguages + WHERE lang_name_pg = v_locale_parts[1] + AND territory = v_locale_parts[2]; + END IF; + EXCEPTION + WHEN OTHERS THEN + v_lang_spec_culture := 'EN_US'; + + SELECT lang_data_jsonb + INTO v_lang_data_jsonb + FROM sys.babelfish_syslanguages + WHERE spec_culture = v_lang_spec_culture; + END; + ELSE + v_is_cached := TRUE; + END IF; + END IF; + + IF (NOT v_is_cached) THEN + PERFORM set_config(format('sys.lang_metadata_json.%s', + v_lang_spec_culture), + v_lang_data_jsonb::TEXT, + FALSE); + END IF; + + RETURN v_lang_data_jsonb; +EXCEPTION + WHEN invalid_text_representation THEN + RAISE USING MESSAGE := pg_catalog.format('The language metadata JSON value extracted from chache is not a valid JSON object.', + p_lang_spec_culture), + HINT := 'Drop the current session, fix the appropriate record in "sys.babelfish_syslanguages" table, and try again after reconnection.'; + + WHEN OTHERS THEN + RAISE USING MESSAGE := pg_catalog.format('"%s" is not a valid special culture or language name parameter.', + p_lang_spec_culture), + DETAIL := 'Use of incorrect "lang_spec_culture" parameter value during conversion process.', + HINT := 'Change "lang_spec_culture" parameter to the proper value and try again.'; +END; +$BODY$ +LANGUAGE plpgsql +STABLE; + +CREATE OR REPLACE FUNCTION sys.babelfish_get_monthnum_by_name(IN p_monthname TEXT, + IN p_lang_metadata_json JSONB) +RETURNS VARCHAR +AS +$BODY$ +DECLARE + v_monthname TEXT; + v_monthnum SMALLINT; +BEGIN + v_monthname := pg_catalog.lower(trim(p_monthname)); + + v_monthnum := array_position(ARRAY(SELECT pg_catalog.lower(jsonb_array_elements_text(p_lang_metadata_json -> 'months_shortnames'))), v_monthname); + + v_monthnum := coalesce(v_monthnum, + array_position(ARRAY(SELECT pg_catalog.lower(jsonb_array_elements_text(p_lang_metadata_json -> 'months_names'))), v_monthname)); + + v_monthnum := coalesce(v_monthnum, + array_position(ARRAY(SELECT pg_catalog.lower(jsonb_array_elements_text(p_lang_metadata_json -> 'months_extrashortnames'))), v_monthname)); + + v_monthnum := coalesce(v_monthnum, + array_position(ARRAY(SELECT pg_catalog.lower(jsonb_array_elements_text(p_lang_metadata_json -> 'months_extranames'))), v_monthname)); + + IF (v_monthnum IS NULL) THEN + RAISE datetime_field_overflow; + END IF; + + RETURN v_monthnum; +EXCEPTION + WHEN datetime_field_overflow THEN + RAISE USING MESSAGE := pg_catalog.format('Can not convert value "%s" to a correct month number.', + trim(p_monthname)), + DETAIL := 'Supplied month name is not valid.', + HINT := 'Correct supplied month name value and try again.'; +END; +$BODY$ +LANGUAGE plpgsql +IMMUTABLE +RETURNS NULL ON NULL INPUT; + +CREATE OR REPLACE FUNCTION sys.babelfish_get_timeunit_from_string(IN p_timepart TEXT, + IN p_timeunit TEXT) +RETURNS VARCHAR +AS +$BODY$ +DECLARE + v_hours VARCHAR COLLATE "C"; + v_minutes VARCHAR COLLATE "C"; + v_seconds VARCHAR COLLATE "C"; + v_fractsecs VARCHAR COLLATE "C"; + v_daypart VARCHAR COLLATE "C"; + v_timepart VARCHAR COLLATE "C"; + v_timeunit VARCHAR COLLATE "C"; + v_err_message VARCHAR COLLATE "C"; + v_timeunit_mask VARCHAR COLLATE "C"; + v_regmatch_groups TEXT[]; + AMPM_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*([AP]M)'; + TIMEUNIT_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*(\d{1,2})\s*'; + FRACTSECS_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*(\d{1,9})'; + HHMMSSFS_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', TIMEUNIT_REGEXP, + '\:', TIMEUNIT_REGEXP, + '\:', TIMEUNIT_REGEXP, + '(?:\.|\:)', FRACTSECS_REGEXP, '$'); + HHMMSS_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, '$'); + HHMMFS_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, '\.', FRACTSECS_REGEXP, '$'); + HHMM_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', TIMEUNIT_REGEXP, '\:', TIMEUNIT_REGEXP, '$'); + HH_REGEXP CONSTANT VARCHAR COLLATE "C" := concat('^', TIMEUNIT_REGEXP, '$'); +BEGIN + v_timepart := pg_catalog.upper(trim(p_timepart)); + v_timeunit := pg_catalog.upper(trim(p_timeunit)); + + v_daypart := substring(v_timepart, 'AM|PM'); + v_timepart := trim(regexp_replace(v_timepart, coalesce(v_daypart, ''), '')); + + v_timeunit_mask := + CASE + WHEN (v_timepart ~* HHMMSSFS_REGEXP) THEN HHMMSSFS_REGEXP + WHEN (v_timepart ~* HHMMSS_REGEXP) THEN HHMMSS_REGEXP + WHEN (v_timepart ~* HHMMFS_REGEXP) THEN HHMMFS_REGEXP + WHEN (v_timepart ~* HHMM_REGEXP) THEN HHMM_REGEXP + WHEN (v_timepart ~* HH_REGEXP) THEN HH_REGEXP + END; + + v_regmatch_groups := regexp_matches(v_timepart, v_timeunit_mask, 'gi'); + + v_hours := v_regmatch_groups[1]; + v_minutes := v_regmatch_groups[2]; + + IF (v_timepart ~* HHMMFS_REGEXP) THEN + v_fractsecs := v_regmatch_groups[3]; + ELSE + v_seconds := v_regmatch_groups[3]; + v_fractsecs := v_regmatch_groups[4]; + END IF; + + IF (v_timeunit = 'HOURS' AND v_daypart IS NOT NULL) + THEN + IF ((v_daypart = 'AM' AND v_hours::SMALLINT NOT BETWEEN 0 AND 12) OR + (v_daypart = 'PM' AND v_hours::SMALLINT NOT BETWEEN 1 AND 23)) + THEN + RAISE numeric_value_out_of_range; + ELSIF (v_daypart = 'PM' AND v_hours::SMALLINT < 12) THEN + v_hours := (v_hours::SMALLINT + 12)::VARCHAR; + ELSIF (v_daypart = 'AM' AND v_hours::SMALLINT = 12) THEN + v_hours := (v_hours::SMALLINT - 12)::VARCHAR; + END IF; + END IF; + + RETURN CASE v_timeunit + WHEN 'HOURS' THEN v_hours + WHEN 'MINUTES' THEN v_minutes + WHEN 'SECONDS' THEN v_seconds + WHEN 'FRACTSECONDS' THEN v_fractsecs + END; +EXCEPTION + WHEN numeric_value_out_of_range THEN + RAISE USING MESSAGE := 'Could not extract correct hour value due to it''s inconsistency with AM|PM day part mark.', + DETAIL := 'Extracted hour value doesn''t fall in correct day part mark range: 0..12 for "AM" or 1..23 for "PM".', + HINT := 'Correct a hour value in the source string or remove AM|PM day part mark out of it.'; + + WHEN invalid_text_representation THEN + GET STACKED DIAGNOSTICS v_err_message = MESSAGE_TEXT; + v_err_message := substring(pg_catalog.lower(v_err_message), 'integer\:\s\"(.*)\"'); + + RAISE USING MESSAGE := pg_catalog.format('Error while trying to convert "%s" value to SMALLINT data type.', v_err_message), + DETAIL := 'Supplied value contains illegal characters.', + HINT := 'Correct supplied value, remove all illegal characters.'; +END; +$BODY$ +LANGUAGE plpgsql +IMMUTABLE +RETURNS NULL ON NULL INPUT; + +CREATE OR REPLACE FUNCTION sys.babelfish_get_weekdaynum_by_name(IN p_weekdayname TEXT, + IN p_lang_metadata_json JSONB) +RETURNS SMALLINT +AS +$BODY$ +DECLARE + v_weekdayname TEXT; + v_weekdaynum SMALLINT; +BEGIN + v_weekdayname := pg_catalog.lower(trim(p_weekdayname)); + + v_weekdaynum := array_position(ARRAY(SELECT pg_catalog.lower(jsonb_array_elements_text(p_lang_metadata_json -> 'days_names'))), v_weekdayname); + + v_weekdaynum := coalesce(v_weekdaynum, + array_position(ARRAY(SELECT pg_catalog.lower(jsonb_array_elements_text(p_lang_metadata_json -> 'days_shortnames'))), v_weekdayname)); + + v_weekdaynum := coalesce(v_weekdaynum, + array_position(ARRAY(SELECT pg_catalog.lower(jsonb_array_elements_text(p_lang_metadata_json -> 'days_extrashortnames'))), v_weekdayname)); + + IF (v_weekdaynum IS NULL) THEN + RAISE datetime_field_overflow; + END IF; + + RETURN v_weekdaynum; +EXCEPTION + WHEN datetime_field_overflow THEN + RAISE USING MESSAGE := pg_catalog.format('Can not convert value "%s" to a correct weekday number.', + trim(p_weekdayname)), + DETAIL := 'Supplied weekday name is not valid.', + HINT := 'Correct supplied weekday name value and try again.'; +END; +$BODY$ +LANGUAGE plpgsql +IMMUTABLE +RETURNS NULL ON NULL INPUT; + +CREATE OR REPLACE FUNCTION sys.babelfish_parse_to_time(IN p_datatype TEXT, + IN p_srctimestring TEXT, + IN p_culture TEXT DEFAULT '') +RETURNS TIME WITHOUT TIME ZONE +AS +$BODY$ +DECLARE + v_day VARCHAR COLLATE "C"; + v_year SMALLINT; + v_month VARCHAR COLLATE "C"; + v_res_date DATE; + v_scale SMALLINT; + v_hijridate DATE; + v_culture VARCHAR COLLATE "C"; + v_dayparts TEXT[]; + v_resmask VARCHAR COLLATE "C"; + v_datatype VARCHAR COLLATE "C"; + v_raw_year VARCHAR COLLATE "C"; + v_left_part VARCHAR COLLATE "C"; + v_right_part VARCHAR COLLATE "C"; + v_resmask_fi VARCHAR COLLATE "C"; + v_timestring VARCHAR COLLATE "C"; + v_correctnum VARCHAR COLLATE "C"; + v_weekdaynum SMALLINT; + v_err_message VARCHAR COLLATE "C"; + v_date_format VARCHAR COLLATE "C"; + v_weekdaynames TEXT[]; + v_hours SMALLINT := 0; + v_srctimestring VARCHAR COLLATE "C"; + v_minutes SMALLINT := 0; + v_res_datatype VARCHAR COLLATE "C"; + v_error_message VARCHAR COLLATE "C"; + v_found BOOLEAN := TRUE; + v_compday_regexp VARCHAR COLLATE "C"; + v_regmatch_groups TEXT[]; + v_datatype_groups TEXT[]; + v_seconds VARCHAR COLLATE "C" := '0'; + v_fseconds VARCHAR COLLATE "C" := '0'; + v_compmonth_regexp VARCHAR COLLATE "C"; + v_lang_metadata_json JSONB; + v_resmask_cnt SMALLINT := 10; + v_res_time TIME WITHOUT TIME ZONE; + DAYMM_REGEXP CONSTANT VARCHAR COLLATE "C" := '(\d{1,2})'; + FULLYEAR_REGEXP CONSTANT VARCHAR COLLATE "C" := '(\d{3,4})'; + SHORTYEAR_REGEXP CONSTANT VARCHAR COLLATE "C" := '(\d{1,2})'; + COMPYEAR_REGEXP CONSTANT VARCHAR COLLATE "C" := '(\d{1,4})'; + AMPM_REGEXP CONSTANT VARCHAR COLLATE "C" := '(?:[AP]M|ص|م)'; + TIMEUNIT_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*\d{1,2}\s*'; + MASKSEPONE_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*(?:/|-)?'; + MASKSEPTWO_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*(?:\s|/|-|\.|,)'; + MASKSEPTWO_FI_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*(?:\s|/|-|,)'; + MASKSEPTHREE_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*(?:/|-|\.|,)'; + TIME_MASKSEP_REGEXP CONSTANT VARCHAR COLLATE "C" := '(?:\s|\.|,)*'; + TIME_MASKSEP_FI_REGEXP CONSTANT VARCHAR COLLATE "C" := '(?:\s|,)*'; + WEEKDAYAMPM_START_REGEXP CONSTANT VARCHAR COLLATE "C" := '(^|[[:digit:][:space:]\.,])'; + WEEKDAYAMPM_END_REGEXP CONSTANT VARCHAR COLLATE "C" := '([[:digit:][:space:]\.,]|$)(?=[^/-]|$)'; + CORRECTNUM_REGEXP CONSTANT VARCHAR COLLATE "C" := '(?:([+-]\d{1,4})(?:[[:space:]\.,]|[AP]M|ص|م|$))'; + DATATYPE_REGEXP CONSTANT VARCHAR COLLATE "C" := '^(TIME)\s*(?:\()?\s*((?:-)?\d+)?\s*(?:\))?$'; + ANNO_DOMINI_REGEXP VARCHAR COLLATE "C" := '(AD|A\.D\.)'; + ANNO_DOMINI_COMPREGEXP VARCHAR COLLATE "C" := concat(WEEKDAYAMPM_START_REGEXP, ANNO_DOMINI_REGEXP, WEEKDAYAMPM_END_REGEXP); + HHMMSSFS_PART_REGEXP CONSTANT VARCHAR COLLATE "C" := + concat(TIMEUNIT_REGEXP, AMPM_REGEXP, '|', + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '\:', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '(?!\d)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?|', + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '\:', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '\:', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '(?!\d)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?|', + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '\:', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '\:', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\s*\d{1,2}\.\d+(?!\d)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?|', + AMPM_REGEXP, '?'); + HHMMSSFS_PART_FI_REGEXP CONSTANT VARCHAR COLLATE "C" := + concat(TIMEUNIT_REGEXP, AMPM_REGEXP, '|', + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '[\:\.]', TIME_MASKSEP_FI_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '(?!\d)', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?\.?|', + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '[\:\.]', TIME_MASKSEP_FI_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '[\:\.]', TIME_MASKSEP_FI_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '(?!\d)', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?|', + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '[\:\.]', TIME_MASKSEP_FI_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '[\:\.]', TIME_MASKSEP_FI_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, '\s*\d{1,2}\.\d+(?!\d)\.?', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?|', + AMPM_REGEXP, '?'); + v_defmask1_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, + '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_REGEXP, '(?:[\.|,]+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)', TIME_MASKSEP_REGEXP, '$'); + v_defmask1_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, + '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_FI_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:', MASKSEPTWO_FI_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[,]+', AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, CORRECTNUM_REGEXP, '?))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_FI_REGEXP, '(?:[\.|,]+', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask2_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, + '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_REGEXP, '(?:(?:[\.|,]+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?)|', + CORRECTNUM_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, '$'); + v_defmask2_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, + '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_FI_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_FI_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, + AMPM_REGEXP, TIME_MASKSEP_FI_REGEXP, CORRECTNUM_REGEXP, '?))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_FI_REGEXP, '(?:(?:[\.|,]+', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, TIME_MASKSEP_FI_REGEXP, CORRECTNUM_REGEXP, '?)|', + CORRECTNUM_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask3_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, ')|', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + TIME_MASKSEP_REGEXP, '(', TIME_MASKSEP_REGEXP, AMPM_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask3_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + TIME_MASKSEP_FI_REGEXP, '[\./]?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)', + FULLYEAR_REGEXP, + TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask4_0_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, '\s*(', AMPM_REGEXP, ')', + TIME_MASKSEP_REGEXP, '$'); + v_defmask4_1_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:\s|,)+', + DAYMM_REGEXP, '\s*(', AMPM_REGEXP, ')', + TIME_MASKSEP_REGEXP, '$'); + v_defmask4_2_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '\s*[\.]+', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, '\s*(', AMPM_REGEXP, ')', + TIME_MASKSEP_REGEXP, '$'); + v_defmask5_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask5_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask6_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|\.|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_REGEXP, '))?', TIME_MASKSEP_REGEXP, '$'); + v_defmask6_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:\s*[\.])?', + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask7_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|\.|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_REGEXP, '))?', TIME_MASKSEP_REGEXP, '$'); + v_defmask7_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask8_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:[\.|,]+', AMPM_REGEXP, ')?', + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask8_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_FI_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[,]+', AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[,]+', AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:[\,]+|\s*/\s*)', AMPM_REGEXP, ')?', + TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask9_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', + HHMMSSFS_PART_REGEXP, + ')', TIME_MASKSEP_REGEXP, '$'); + v_defmask9_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, '(', + HHMMSSFS_PART_FI_REGEXP, + ')', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask10_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)?', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask10_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)?', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask11_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask11_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask12_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask12_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask13_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$'); + v_defmask13_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask14_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + '($comp_month$)' + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)', TIME_MASKSEP_REGEXP, + COMPYEAR_REGEXP, + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask14_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + '($comp_month$)' + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)', TIME_MASKSEP_FI_REGEXP, + COMPYEAR_REGEXP, + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask15_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + COMPYEAR_REGEXP, + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask15_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + COMPYEAR_REGEXP, + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask16_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)', TIME_MASKSEP_REGEXP, + COMPYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask16_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)', TIME_MASKSEP_REGEXP, + COMPYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask17_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask17_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask18_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask18_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask19_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|\.|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_REGEXP, '))?', TIME_MASKSEP_REGEXP, '$'); + v_defmask19_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + CONVERSION_LANG CONSTANT VARCHAR COLLATE "C" := ''; + DATE_FORMAT CONSTANT VARCHAR COLLATE "C" := ''; +BEGIN + v_datatype := trim(p_datatype); + v_srctimestring := pg_catalog.upper(trim(p_srctimestring)); + v_culture := coalesce(nullif(pg_catalog.upper(trim(p_culture)), ''), 'EN-US'); + + v_datatype_groups := regexp_matches(v_datatype, DATATYPE_REGEXP, 'gi'); + + v_res_datatype := pg_catalog.upper(v_datatype_groups[1]); + v_scale := v_datatype_groups[2]::SMALLINT; + + IF (v_res_datatype IS NULL) THEN + RAISE datatype_mismatch; + ELSIF (coalesce(v_scale, 0) NOT BETWEEN 0 AND 7) + THEN + RAISE interval_field_overflow; + ELSIF (v_scale IS NULL) THEN + v_scale := 7; + END IF; + + v_dayparts := ARRAY(SELECT pg_catalog.upper(array_to_string(regexp_matches(v_srctimestring, '[AP]M|ص|م', 'gi'), ''))); + + IF (array_length(v_dayparts, 1) > 1) THEN + RAISE invalid_datetime_format; + END IF; + + BEGIN + v_lang_metadata_json := sys.babelfish_get_lang_metadata_json(coalesce(nullif(CONVERSION_LANG, ''), p_culture)); + EXCEPTION + WHEN OTHERS THEN + RAISE invalid_parameter_value; + END; + + v_compday_regexp := array_to_string(array_cat(array_cat(ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'days_names')), + ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'days_shortnames'))), + ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'days_extrashortnames'))), '|'); + + v_weekdaynames := ARRAY(SELECT array_to_string(regexp_matches(v_srctimestring, v_compday_regexp, 'gi'), '')); + + IF (array_length(v_weekdaynames, 1) > 1) THEN + RAISE invalid_datetime_format; + END IF; + + IF (v_weekdaynames[1] IS NOT NULL AND + v_srctimestring ~* concat(WEEKDAYAMPM_START_REGEXP, '(', v_compday_regexp, ')', WEEKDAYAMPM_END_REGEXP)) + THEN + v_srctimestring := pg_catalog.replace(v_srctimestring, v_weekdaynames[1], ' '); + END IF; + + IF (v_srctimestring ~* ANNO_DOMINI_COMPREGEXP) + THEN + IF (v_culture !~ 'EN[-_]US|DA[-_]DK|SV[-_]SE|EN[-_]GB|HI[-_]IS') THEN + RAISE invalid_datetime_format; + END IF; + + v_srctimestring := regexp_replace(v_srctimestring, + ANNO_DOMINI_COMPREGEXP, + regexp_replace(array_to_string(regexp_matches(v_srctimestring, ANNO_DOMINI_COMPREGEXP, 'gi'), ''), + ANNO_DOMINI_REGEXP, ' ', 'gi'), + 'gi'); + END IF; + + v_date_format := coalesce(nullif(pg_catalog.upper(trim(DATE_FORMAT)), ''), v_lang_metadata_json ->> 'date_format'); + + v_compmonth_regexp := + array_to_string(array_cat(array_cat(ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'months_shortnames')), + ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'months_names'))), + array_cat(ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'months_extrashortnames')), + ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'months_extranames'))) + ), '|'); + + IF ((v_srctimestring ~* v_defmask1_regexp AND v_culture <> 'FI') OR + (v_srctimestring ~* v_defmask1_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_srctimestring ~ concat(CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV') + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_srctimestring, CASE v_culture + WHEN 'FI' THEN v_defmask1_fi_regexp + ELSE v_defmask1_regexp + END, 'gi'); + v_timestring := v_regmatch_groups[2]; + v_correctnum := coalesce(v_regmatch_groups[1], v_regmatch_groups[3], + v_regmatch_groups[5], v_regmatch_groups[6]); + + IF (v_date_format = 'DMY' OR + v_culture IN ('SV-SE', 'SV_SE', 'LV-LV', 'LV_LV')) + THEN + v_day := v_regmatch_groups[4]; + v_month := v_regmatch_groups[7]; + ELSE + v_day := v_regmatch_groups[7]; + v_month := v_regmatch_groups[4]; + END IF; + + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA')) + THEN + IF (v_day::SMALLINT > 30 OR + v_month::SMALLINT > 12) THEN + RAISE invalid_datetime_format; + END IF; + + v_raw_year := to_char(sys.babelfish_conv_greg_to_hijri(current_date + 1), 'YYYY'); + v_hijridate := sys.babelfish_conv_hijri_to_greg(v_day, v_month, v_raw_year) - 1; + + v_day := to_char(v_hijridate, 'DD'); + v_month := to_char(v_hijridate, 'MM'); + v_year := to_char(v_hijridate, 'YYYY')::SMALLINT; + ELSE + v_year := to_char(current_date, 'YYYY')::SMALLINT; + END IF; + + ELSIF ((v_srctimestring ~* v_defmask6_regexp AND v_culture <> 'FI') OR + (v_srctimestring ~* v_defmask6_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA') OR + (v_srctimestring ~ concat('\s*\d{1,2}\.\s*(?:\.|\d+(?!\d)\s*\.)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{3,4}', + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, '\d{1,2}|', + '\d{3,4}', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, + TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}\s*(?:\.)+|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV')) + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_srctimestring, CASE v_culture + WHEN 'FI' THEN v_defmask6_fi_regexp + ELSE v_defmask6_regexp + END, 'gi'); + v_timestring := concat(v_regmatch_groups[1], v_regmatch_groups[5]); + v_day := v_regmatch_groups[4]; + v_month := v_regmatch_groups[3]; + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_regmatch_groups[2]::SMALLINT - 543 + ELSE v_regmatch_groups[2]::SMALLINT + END; + + ELSIF ((v_srctimestring ~* v_defmask2_regexp AND v_culture <> 'FI') OR + (v_srctimestring ~* v_defmask2_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA') OR + (v_srctimestring ~ concat('\s*\d{1,2}\.\s*(?:\.|\d+(?!\d)\s*\.)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{3,4}', + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?))', TIME_MASKSEP_REGEXP, '\d{1,2}|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV')) + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_srctimestring, CASE v_culture + WHEN 'FI' THEN v_defmask2_fi_regexp + ELSE v_defmask2_regexp + END, 'gi'); + v_timestring := v_regmatch_groups[2]; + v_correctnum := coalesce(v_regmatch_groups[1], v_regmatch_groups[3], v_regmatch_groups[5], + v_regmatch_groups[6], v_regmatch_groups[8], v_regmatch_groups[9]); + v_day := '01'; + v_month := v_regmatch_groups[7]; + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_regmatch_groups[4]::SMALLINT - 543 + ELSE v_regmatch_groups[4]::SMALLINT + END; + + ELSIF (v_srctimestring ~* v_defmask4_1_regexp OR + (v_srctimestring ~* v_defmask4_2_regexp AND v_culture !~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV') OR + (v_srctimestring ~* v_defmask9_regexp AND v_culture <> 'FI') OR + (v_srctimestring ~* v_defmask9_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_srctimestring ~ concat('\d+\s*\.?(?:,+|,*', AMPM_REGEXP, ')', TIME_MASKSEP_FI_REGEXP, '\.+', TIME_MASKSEP_REGEXP, '$|', + '\d+\s*\.', TIME_MASKSEP_FI_REGEXP, '\.', TIME_MASKSEP_FI_REGEXP, '$') AND + v_culture = 'FI') + THEN + RAISE invalid_datetime_format; + END IF; + + IF (v_srctimestring ~* v_defmask4_0_regexp) THEN + v_timestring := (regexp_matches(v_srctimestring, v_defmask4_0_regexp, 'gi'))[1]; + ELSE + v_timestring := v_srctimestring; + END IF; + + v_res_date := current_date; + v_day := to_char(v_res_date, 'DD'); + v_month := to_char(v_res_date, 'MM'); + v_year := to_char(v_res_date, 'YYYY')::SMALLINT; + + ELSIF ((v_srctimestring ~* v_defmask3_regexp AND v_culture <> 'FI') OR + (v_srctimestring ~* v_defmask3_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA') OR + (v_srctimestring ~ concat('\s*\d{1,2}\.\s*(?:\.|\d+(?!\d)\s*\.)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', + TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, '|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV')) + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_srctimestring, CASE v_culture + WHEN 'FI' THEN v_defmask3_fi_regexp + ELSE v_defmask3_regexp + END, 'gi'); + v_timestring := v_regmatch_groups[1]; + v_day := '01'; + v_month := v_regmatch_groups[2]; + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_regmatch_groups[3]::SMALLINT - 543 + ELSE v_regmatch_groups[3]::SMALLINT + END; + + ELSIF ((v_srctimestring ~* v_defmask5_regexp AND v_culture <> 'FI') OR + (v_srctimestring ~* v_defmask5_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA') OR + (v_srctimestring ~ concat('\s*\d{1,2}\.\s*(?:\.|\d+(?!\d)\s*\.)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, + TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, + TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{3,4}', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$|', + '\d{1,2}', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{3,4}\s*(?:\.)+|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV')) + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_srctimestring, v_defmask5_regexp, 'gi'); + v_timestring := concat(v_regmatch_groups[1], v_regmatch_groups[5]); + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_regmatch_groups[4]::SMALLINT - 543 + ELSE v_regmatch_groups[4]::SMALLINT + END; + + IF (v_date_format = 'DMY' OR + v_culture IN ('LV-LV', 'LV_LV')) + THEN + v_day := v_regmatch_groups[2]; + v_month := v_regmatch_groups[3]; + ELSE + v_day := v_regmatch_groups[3]; + v_month := v_regmatch_groups[2]; + END IF; + + ELSIF ((v_srctimestring ~* v_defmask7_regexp AND v_culture <> 'FI') OR + (v_srctimestring ~* v_defmask7_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA') OR + (v_srctimestring ~ concat('\s*\d{1,2}\.\s*(?:\.|\d+(?!\d)\s*\.)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', + MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{3,4}|', + '\d{3,4}', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}\s*(?:\.)+|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV')) + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_srctimestring, CASE v_culture + WHEN 'FI' THEN v_defmask7_fi_regexp + ELSE v_defmask7_regexp + END, 'gi'); + v_timestring := concat(v_regmatch_groups[1], v_regmatch_groups[5]); + v_day := v_regmatch_groups[4]; + v_month := v_regmatch_groups[2]; + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_regmatch_groups[3]::SMALLINT - 543 + ELSE v_regmatch_groups[3]::SMALLINT + END; + + ELSIF ((v_srctimestring ~* v_defmask8_regexp AND v_culture <> 'FI') OR + (v_srctimestring ~* v_defmask8_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_srctimestring ~ concat('\s*\d{1,2}\.\s*(?:\.|\d+(?!\d)\s*\.)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', + MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, + TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}|', + '\d{1,2}', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, + TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}\s*(?:\.)+|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'FI|DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV') + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_srctimestring, CASE v_culture + WHEN 'FI' THEN v_defmask8_fi_regexp + ELSE v_defmask8_regexp + END, 'gi'); + v_timestring := concat(v_regmatch_groups[1], v_regmatch_groups[5]); + + IF (v_date_format = 'DMY' OR + v_culture IN ('LV-LV', 'LV_LV')) + THEN + v_day := v_regmatch_groups[2]; + v_month := v_regmatch_groups[3]; + v_raw_year := v_regmatch_groups[4]; + ELSIF (v_date_format = 'YMD') + THEN + v_day := v_regmatch_groups[4]; + v_month := v_regmatch_groups[3]; + v_raw_year := v_regmatch_groups[2]; + ELSE + v_day := v_regmatch_groups[3]; + v_month := v_regmatch_groups[2]; + v_raw_year := v_regmatch_groups[4]; + END IF; + + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA')) + THEN + IF (v_day::SMALLINT > 30 OR + v_month::SMALLINT > 12) THEN + RAISE invalid_datetime_format; + END IF; + + v_raw_year := sys.babelfish_get_full_year(v_raw_year, '14'); + v_hijridate := sys.babelfish_conv_hijri_to_greg(v_day, v_month, v_raw_year) - 1; + + v_day := to_char(v_hijridate, 'DD'); + v_month := to_char(v_hijridate, 'MM'); + v_year := to_char(v_hijridate, 'YYYY')::SMALLINT; + + ELSIF (v_culture IN ('TH-TH', 'TH_TH')) THEN + v_year := sys.babelfish_get_full_year(v_raw_year)::SMALLINT - 43; + ELSE + v_year := sys.babelfish_get_full_year(v_raw_year, '', 29)::SMALLINT; + END IF; + ELSE + v_found := FALSE; + END IF; + + WHILE (NOT v_found AND v_resmask_cnt < 20) + LOOP + v_resmask := pg_catalog.replace(CASE v_resmask_cnt + WHEN 10 THEN v_defmask10_regexp + WHEN 11 THEN v_defmask11_regexp + WHEN 12 THEN v_defmask12_regexp + WHEN 13 THEN v_defmask13_regexp + WHEN 14 THEN v_defmask14_regexp + WHEN 15 THEN v_defmask15_regexp + WHEN 16 THEN v_defmask16_regexp + WHEN 17 THEN v_defmask17_regexp + WHEN 18 THEN v_defmask18_regexp + WHEN 19 THEN v_defmask19_regexp + END, + '$comp_month$', v_compmonth_regexp); + + v_resmask_fi := pg_catalog.replace(CASE v_resmask_cnt + WHEN 10 THEN v_defmask10_fi_regexp + WHEN 11 THEN v_defmask11_fi_regexp + WHEN 12 THEN v_defmask12_fi_regexp + WHEN 13 THEN v_defmask13_fi_regexp + WHEN 14 THEN v_defmask14_fi_regexp + WHEN 15 THEN v_defmask15_fi_regexp + WHEN 16 THEN v_defmask16_fi_regexp + WHEN 17 THEN v_defmask17_fi_regexp + WHEN 18 THEN v_defmask18_fi_regexp + WHEN 19 THEN v_defmask19_fi_regexp + END, + '$comp_month$', v_compmonth_regexp); + + IF ((v_srctimestring ~* v_resmask AND v_culture <> 'FI') OR + (v_srctimestring ~* v_resmask_fi AND v_culture = 'FI')) + THEN + v_found := TRUE; + v_regmatch_groups := regexp_matches(v_srctimestring, CASE v_culture + WHEN 'FI' THEN v_resmask_fi + ELSE v_resmask + END, 'gi'); + v_timestring := CASE + WHEN v_resmask_cnt IN (10, 11, 12, 13) THEN concat(v_regmatch_groups[1], v_regmatch_groups[4]) + ELSE concat(v_regmatch_groups[1], v_regmatch_groups[5]) + END; + + IF (v_resmask_cnt = 10) + THEN + IF (v_regmatch_groups[3] = 'MAR' AND + v_culture IN ('IT-IT', 'IT_IT')) + THEN + RAISE invalid_datetime_format; + END IF; + + IF (v_date_format = 'YMD' AND v_culture NOT IN ('SV-SE', 'SV_SE', 'LV-LV', 'LV_LV')) + THEN + v_day := '01'; + v_year := sys.babelfish_get_full_year(v_regmatch_groups[2], '', 29)::SMALLINT; + ELSE + v_day := v_regmatch_groups[2]; + v_year := to_char(current_date, 'YYYY')::SMALLINT; + END IF; + + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[3], v_lang_metadata_json); + v_raw_year := to_char(sys.babelfish_conv_greg_to_hijri(current_date + 1), 'YYYY'); + + ELSIF (v_resmask_cnt = 11) + THEN + IF (v_date_format IN ('YMD', 'MDY') AND v_culture NOT IN ('SV-SE', 'SV_SE')) + THEN + v_day := v_regmatch_groups[3]; + v_year := to_char(current_date, 'YYYY')::SMALLINT; + ELSE + v_day := '01'; + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN sys.babelfish_get_full_year(v_regmatch_groups[3])::SMALLINT - 43 + ELSE sys.babelfish_get_full_year(v_regmatch_groups[3], '', 29)::SMALLINT + END; + END IF; + + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[2], v_lang_metadata_json); + v_raw_year := sys.babelfish_get_full_year(substring(v_year::TEXT, 3, 2), '14'); + + ELSIF (v_resmask_cnt = 12) + THEN + v_day := '01'; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[3], v_lang_metadata_json); + v_raw_year := v_regmatch_groups[2]; + + ELSIF (v_resmask_cnt = 13) + THEN + v_day := '01'; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[2], v_lang_metadata_json); + v_raw_year := v_regmatch_groups[3]; + + ELSIF (v_resmask_cnt IN (14, 15, 16)) + THEN + IF (v_resmask_cnt = 14) + THEN + v_left_part := v_regmatch_groups[4]; + v_right_part := v_regmatch_groups[3]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[2], v_lang_metadata_json); + ELSIF (v_resmask_cnt = 15) + THEN + v_left_part := v_regmatch_groups[4]; + v_right_part := v_regmatch_groups[2]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[3], v_lang_metadata_json); + ELSE + v_left_part := v_regmatch_groups[3]; + v_right_part := v_regmatch_groups[2]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[4], v_lang_metadata_json); + END IF; + + IF (char_length(v_left_part) <= 2) + THEN + IF (v_date_format = 'YMD' AND v_culture NOT IN ('LV-LV', 'LV_LV')) + THEN + v_day := v_left_part; + v_raw_year := sys.babelfish_get_full_year(v_right_part, '14'); + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN sys.babelfish_get_full_year(v_right_part)::SMALLINT - 43 + ELSE sys.babelfish_get_full_year(v_right_part, '', 29)::SMALLINT + END; + BEGIN + v_res_date := make_date(v_year, v_month::SMALLINT, v_day::SMALLINT); + EXCEPTION + WHEN OTHERS THEN + v_day := v_right_part; + v_raw_year := sys.babelfish_get_full_year(v_left_part, '14'); + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN sys.babelfish_get_full_year(v_left_part)::SMALLINT - 43 + ELSE sys.babelfish_get_full_year(v_left_part, '', 29)::SMALLINT + END; + END; + END IF; + + IF (v_date_format IN ('MDY', 'DMY') OR v_culture IN ('LV-LV', 'LV_LV')) + THEN + v_day := v_right_part; + v_raw_year := sys.babelfish_get_full_year(v_left_part, '14'); + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN sys.babelfish_get_full_year(v_left_part)::SMALLINT - 43 + ELSE sys.babelfish_get_full_year(v_left_part, '', 29)::SMALLINT + END; + BEGIN + v_res_date := make_date(v_year, v_month::SMALLINT, v_day::SMALLINT); + EXCEPTION + WHEN OTHERS THEN + v_day := v_left_part; + v_raw_year := sys.babelfish_get_full_year(v_right_part, '14'); + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN sys.babelfish_get_full_year(v_right_part)::SMALLINT - 43 + ELSE sys.babelfish_get_full_year(v_right_part, '', 29)::SMALLINT + END; + END; + END IF; + ELSE + v_day := v_right_part; + v_raw_year := v_left_part; + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_left_part::SMALLINT - 543 + ELSE v_left_part::SMALLINT + END; + END IF; + + ELSIF (v_resmask_cnt = 17) + THEN + v_day := v_regmatch_groups[4]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[3], v_lang_metadata_json); + v_raw_year := v_regmatch_groups[2]; + + ELSIF (v_resmask_cnt = 18) + THEN + v_day := v_regmatch_groups[3]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[4], v_lang_metadata_json); + v_raw_year := v_regmatch_groups[2]; + + ELSIF (v_resmask_cnt = 19) + THEN + v_day := v_regmatch_groups[4]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[2], v_lang_metadata_json); + v_raw_year := v_regmatch_groups[3]; + END IF; + + IF (v_resmask_cnt NOT IN (10, 11, 14, 15, 16)) + THEN + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_raw_year::SMALLINT - 543 + ELSE v_raw_year::SMALLINT + END; + END IF; + + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA')) + THEN + IF (v_day::SMALLINT > 30 OR + (v_resmask_cnt NOT IN (10, 11, 14, 15, 16) AND v_year NOT BETWEEN 1318 AND 1501) OR + (v_resmask_cnt IN (14, 15, 16) AND v_raw_year::SMALLINT NOT BETWEEN 1318 AND 1501)) + THEN + RAISE invalid_datetime_format; + END IF; + + v_hijridate := sys.babelfish_conv_hijri_to_greg(v_day, v_month, v_raw_year) - 1; + + v_day := to_char(v_hijridate, 'DD'); + v_month := to_char(v_hijridate, 'MM'); + v_year := to_char(v_hijridate, 'YYYY')::SMALLINT; + END IF; + END IF; + + v_resmask_cnt := v_resmask_cnt + 1; + END LOOP; + + IF (NOT v_found) THEN + RAISE invalid_datetime_format; + END IF; + + v_res_date := make_date(v_year, v_month::SMALLINT, v_day::SMALLINT); + + IF (v_weekdaynames[1] IS NOT NULL) THEN + v_weekdaynum := sys.babelfish_get_weekdaynum_by_name(v_weekdaynames[1], v_lang_metadata_json); + + IF (date_part('dow', v_res_date)::SMALLINT <> v_weekdaynum) THEN + RAISE invalid_datetime_format; + END IF; + END IF; + + IF (char_length(v_timestring) > 0 AND v_timestring NOT IN ('AM', 'ص', 'PM', 'م')) + THEN + IF (v_culture = 'FI') THEN + v_timestring := PG_CATALOG.pg_catalog.translate(v_timestring, '.,', ': '); + + IF (char_length(split_part(v_timestring, ':', 4)) > 0) THEN + v_timestring := regexp_replace(v_timestring, ':(?=\s*\d+\s*:?\s*(?:[AP]M|ص|م)?\s*$)', '.'); + END IF; + END IF; + + v_timestring := pg_catalog.replace(regexp_replace(v_timestring, '\.?[AP]M|ص|م|\s|\,|\.\D|[\.|:]$', '', 'gi'), ':.', ':'); + + BEGIN + v_hours := coalesce(split_part(v_timestring, ':', 1)::SMALLINT, 0); + + IF ((v_dayparts[1] IN ('AM', 'ص') AND v_hours NOT BETWEEN 0 AND 12) OR + (v_dayparts[1] IN ('PM', 'م') AND v_hours NOT BETWEEN 1 AND 23)) + THEN + RAISE invalid_datetime_format; + ELSIF (v_dayparts[1] = 'PM' AND v_hours < 12) THEN + v_hours := v_hours + 12; + ELSIF (v_dayparts[1] = 'AM' AND v_hours = 12) THEN + v_hours := v_hours - 12; + END IF; + + v_minutes := coalesce(nullif(split_part(v_timestring, ':', 2), '')::SMALLINT, 0); + v_seconds := coalesce(nullif(split_part(v_timestring, ':', 3), ''), '0'); + + IF (v_seconds ~ '\.') THEN + v_fseconds := split_part(v_seconds, '.', 2); + v_seconds := split_part(v_seconds, '.', 1); + END IF; + EXCEPTION + WHEN OTHERS THEN + RAISE invalid_datetime_format; + END; + ELSIF (v_dayparts[1] IN ('PM', 'م')) + THEN + v_hours := 12; + END IF; + + v_fseconds := sys.babelfish_get_microsecs_from_fractsecs(rpad(v_fseconds, 9, '0'), v_scale); + v_seconds := concat_ws('.', v_seconds, v_fseconds); + + v_res_time := make_time(v_hours, v_minutes, v_seconds::NUMERIC); + + RETURN v_res_time; +EXCEPTION + WHEN invalid_datetime_format OR datetime_field_overflow THEN + RAISE USING MESSAGE := pg_catalog.format('Error converting string value ''%s'' into data type %s using culture ''%s''.', + p_srctimestring, v_res_datatype, p_culture), + DETAIL := 'Incorrect using of pair of input parameters values during conversion process.', + HINT := 'Check the input parameters values, correct them if needed, and try again.'; + + WHEN datatype_mismatch THEN + RAISE USING MESSAGE := 'Source data type should be ''TIME'' or ''TIME(n)''.', + DETAIL := 'Use of incorrect "datatype" parameter value during conversion process.', + HINT := 'Change "datatype" parameter to the proper value and try again.'; + + WHEN invalid_indicator_parameter_value THEN + RAISE USING MESSAGE := pg_catalog.format('Invalid attributes specified for data type %s.', v_res_datatype), + DETAIL := 'Use of incorrect scale value, which is not corresponding to specified data type.', + HINT := 'Change data type scale component or select different data type and try again.'; + + WHEN interval_field_overflow THEN + RAISE USING MESSAGE := pg_catalog.format('Specified scale %s is invalid.', v_scale), + DETAIL := 'Use of incorrect data type scale value during conversion process.', + HINT := 'Change scale component of data type parameter to be in range [0..7] and try again.'; + + WHEN invalid_parameter_value THEN + RAISE USING MESSAGE := CASE char_length(coalesce(CONVERSION_LANG, '')) + WHEN 0 THEN pg_catalog.format('The culture parameter ''%s'' provided in the function call is not supported.', + p_culture) + ELSE pg_catalog.format('Invalid CONVERSION_LANG constant value - ''%s''. Allowed values are: ''English'', ''Deutsch'', etc.', + CONVERSION_LANG) + END, + DETAIL := 'Passed incorrect value for "p_culture" parameter or compiled incorrect CONVERSION_LANG constant value in function''s body.', + HINT := 'Check "p_culture" input parameter value, correct it if needed, and try again. Also check CONVERSION_LANG constant value.'; + + WHEN invalid_text_representation THEN + GET STACKED DIAGNOSTICS v_err_message = MESSAGE_TEXT; + v_err_message := substring(pg_catalog.lower(v_err_message), 'integer\:\s\"(.*)\"'); + + RAISE USING MESSAGE := pg_catalog.format('Error while trying to convert "%s" value to SMALLINT data type.', + v_err_message), + DETAIL := 'Supplied value contains illegal characters.', + HINT := 'Correct supplied value, remove all illegal characters.'; +END; +$BODY$ +LANGUAGE plpgsql +STABLE +RETURNS NULL ON NULL INPUT; + +CREATE OR REPLACE FUNCTION sys.babelfish_parse_to_date(IN p_datestring TEXT, + IN p_culture TEXT DEFAULT '') +RETURNS DATE +AS +$BODY$ +DECLARE + v_day VARCHAR COLLATE "C"; + v_year SMALLINT; + v_month VARCHAR COLLATE "C"; + v_res_date DATE; + v_hijridate DATE; + v_culture VARCHAR COLLATE "C"; + v_dayparts TEXT[]; + v_resmask VARCHAR COLLATE "C"; + v_raw_year VARCHAR COLLATE "C"; + v_left_part VARCHAR COLLATE "C"; + v_right_part VARCHAR COLLATE "C"; + v_resmask_fi VARCHAR COLLATE "C"; + v_datestring VARCHAR COLLATE "C"; + v_timestring VARCHAR COLLATE "C"; + v_correctnum VARCHAR COLLATE "C"; + v_weekdaynum SMALLINT; + v_err_message VARCHAR COLLATE "C"; + v_date_format VARCHAR COLLATE "C"; + v_weekdaynames TEXT[]; + v_hours SMALLINT := 0; + v_minutes SMALLINT := 0; + v_seconds NUMERIC := 0; + v_found BOOLEAN := TRUE; + v_compday_regexp VARCHAR COLLATE "C"; + v_regmatch_groups TEXT[]; + v_compmonth_regexp VARCHAR COLLATE "C"; + v_lang_metadata_json JSONB; + v_resmask_cnt SMALLINT := 10; + DAYMM_REGEXP CONSTANT VARCHAR COLLATE "C" := '(\d{1,2})'; + FULLYEAR_REGEXP CONSTANT VARCHAR COLLATE "C" := '(\d{3,4})'; + SHORTYEAR_REGEXP CONSTANT VARCHAR COLLATE "C" := '(\d{1,2})'; + COMPYEAR_REGEXP CONSTANT VARCHAR COLLATE "C" := '(\d{1,4})'; + AMPM_REGEXP CONSTANT VARCHAR COLLATE "C" := '(?:[AP]M|ص|م)'; + TIMEUNIT_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*\d{1,2}\s*'; + MASKSEPONE_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*(?:/|-)?'; + MASKSEPTWO_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*(?:\s|/|-|\.|,)'; + MASKSEPTWO_FI_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*(?:\s|/|-|,)'; + MASKSEPTHREE_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*(?:/|-|\.|,)'; + TIME_MASKSEP_REGEXP CONSTANT VARCHAR COLLATE "C" := '(?:\s|\.|,)*'; + TIME_MASKSEP_FI_REGEXP CONSTANT VARCHAR COLLATE "C" := '(?:\s|,)*'; + WEEKDAYAMPM_START_REGEXP CONSTANT VARCHAR COLLATE "C" := '(^|[[:digit:][:space:]\.,])'; + WEEKDAYAMPM_END_REGEXP CONSTANT VARCHAR COLLATE "C" := '([[:digit:][:space:]\.,]|$)(?=[^/-]|$)'; + CORRECTNUM_REGEXP CONSTANT VARCHAR COLLATE "C" := '(?:([+-]\d{1,4})(?:[[:space:]\.,]|[AP]M|ص|م|$))'; + ANNO_DOMINI_REGEXP VARCHAR COLLATE "C" := '(AD|A\.D\.)'; + ANNO_DOMINI_COMPREGEXP VARCHAR COLLATE "C" := concat(WEEKDAYAMPM_START_REGEXP, ANNO_DOMINI_REGEXP, WEEKDAYAMPM_END_REGEXP); + HHMMSSFS_PART_REGEXP CONSTANT VARCHAR COLLATE "C" := + concat(TIMEUNIT_REGEXP, AMPM_REGEXP, '|', + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '\:', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '(?!\d)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?|', + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '\:', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '\:', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '(?!\d)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?|', + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '\:', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '\:', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\s*\d{1,2}\.\d+(?!\d)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?|', + AMPM_REGEXP, '?'); + HHMMSSFS_PART_FI_REGEXP CONSTANT VARCHAR COLLATE "C" := + concat(TIMEUNIT_REGEXP, AMPM_REGEXP, '|', + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '[\:\.]', TIME_MASKSEP_FI_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '(?!\d)', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?\.?|', + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '[\:\.]', TIME_MASKSEP_FI_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '[\:\.]', TIME_MASKSEP_FI_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '(?!\d)', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?|', + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '[\:\.]', TIME_MASKSEP_FI_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '[\:\.]', TIME_MASKSEP_FI_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, '\s*\d{1,2}\.\d+(?!\d)\.?', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?|', + AMPM_REGEXP, '?'); + v_defmask1_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, + '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_REGEXP, '(?:[\.|,]+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)', TIME_MASKSEP_REGEXP, '$'); + v_defmask1_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, + '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_FI_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:', MASKSEPTWO_FI_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[,]+', AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, CORRECTNUM_REGEXP, '?))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_FI_REGEXP, '(?:[\.|,]+', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask2_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, + '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_REGEXP, '(?:(?:[\.|,]+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?)|', + CORRECTNUM_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, '$'); + v_defmask2_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, + '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_FI_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_FI_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, + AMPM_REGEXP, TIME_MASKSEP_FI_REGEXP, CORRECTNUM_REGEXP, '?))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_FI_REGEXP, '(?:(?:[\.|,]+', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, TIME_MASKSEP_FI_REGEXP, CORRECTNUM_REGEXP, '?)|', + CORRECTNUM_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask3_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, ')|', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + TIME_MASKSEP_REGEXP, '(', TIME_MASKSEP_REGEXP, AMPM_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask3_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + TIME_MASKSEP_FI_REGEXP, '[\./]?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)', + FULLYEAR_REGEXP, + TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask4_0_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, '\s*(', AMPM_REGEXP, ')', + TIME_MASKSEP_REGEXP, '$'); + v_defmask4_1_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:\s|,)+', + DAYMM_REGEXP, '\s*(', AMPM_REGEXP, ')', + TIME_MASKSEP_REGEXP, '$'); + v_defmask4_2_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '\s*[\.]+', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, '\s*(', AMPM_REGEXP, ')', + TIME_MASKSEP_REGEXP, '$'); + v_defmask5_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask5_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask6_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|\.|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_REGEXP, '))?', TIME_MASKSEP_REGEXP, '$'); + v_defmask6_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:\s*[\.])?', + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask7_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|\.|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_REGEXP, '))?', TIME_MASKSEP_REGEXP, '$'); + v_defmask7_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask8_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:[\.|,]+', AMPM_REGEXP, ')?', + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask8_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_FI_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[,]+', AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[,]+', AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:[\,]+|\s*/\s*)', AMPM_REGEXP, ')?', + TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask9_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', + HHMMSSFS_PART_REGEXP, + ')', TIME_MASKSEP_REGEXP, '$'); + v_defmask9_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, '(', + HHMMSSFS_PART_FI_REGEXP, + ')', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask10_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)?', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask10_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)?', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask11_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask11_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask12_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask12_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask13_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$'); + v_defmask13_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask14_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + '($comp_month$)' + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)', TIME_MASKSEP_REGEXP, + COMPYEAR_REGEXP, + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask14_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + '($comp_month$)' + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)', TIME_MASKSEP_FI_REGEXP, + COMPYEAR_REGEXP, + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask15_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + COMPYEAR_REGEXP, + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask15_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + COMPYEAR_REGEXP, + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask16_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)', TIME_MASKSEP_REGEXP, + COMPYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask16_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)', TIME_MASKSEP_REGEXP, + COMPYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask17_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask17_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask18_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask18_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask19_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|\.|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_REGEXP, '))?', TIME_MASKSEP_REGEXP, '$'); + v_defmask19_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + CONVERSION_LANG CONSTANT VARCHAR COLLATE "C" := ''; + DATE_FORMAT CONSTANT VARCHAR COLLATE "C" := ''; +BEGIN + v_datestring := pg_catalog.upper(trim(p_datestring)); + v_culture := coalesce(nullif(pg_catalog.upper(trim(p_culture)), ''), 'EN-US'); + + v_dayparts := ARRAY(SELECT pg_catalog.upper(array_to_string(regexp_matches(v_datestring, '[AP]M|ص|م', 'gi'), ''))); + + IF (array_length(v_dayparts, 1) > 1) THEN + RAISE invalid_datetime_format; + END IF; + + BEGIN + v_lang_metadata_json := sys.babelfish_get_lang_metadata_json(coalesce(nullif(CONVERSION_LANG, ''), p_culture)); + EXCEPTION + WHEN OTHERS THEN + RAISE invalid_parameter_value; + END; + + v_compday_regexp := array_to_string(array_cat(array_cat(ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'days_names')), + ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'days_shortnames'))), + ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'days_extrashortnames'))), '|'); + + v_weekdaynames := ARRAY(SELECT array_to_string(regexp_matches(v_datestring, v_compday_regexp, 'gi'), '')); + + IF (array_length(v_weekdaynames, 1) > 1) THEN + RAISE invalid_datetime_format; + END IF; + + IF (v_weekdaynames[1] IS NOT NULL AND + v_datestring ~* concat(WEEKDAYAMPM_START_REGEXP, '(', v_compday_regexp, ')', WEEKDAYAMPM_END_REGEXP)) + THEN + v_datestring := pg_catalog.replace(v_datestring, v_weekdaynames[1], ' '); + END IF; + + IF (v_datestring ~* ANNO_DOMINI_COMPREGEXP) + THEN + IF (v_culture !~ 'EN[-_]US|DA[-_]DK|SV[-_]SE|EN[-_]GB|HI[-_]IS') THEN + RAISE invalid_datetime_format; + END IF; + + v_datestring := regexp_replace(v_datestring, + ANNO_DOMINI_COMPREGEXP, + regexp_replace(array_to_string(regexp_matches(v_datestring, ANNO_DOMINI_COMPREGEXP, 'gi'), ''), + ANNO_DOMINI_REGEXP, ' ', 'gi'), + 'gi'); + END IF; + + v_date_format := coalesce(nullif(pg_catalog.upper(trim(DATE_FORMAT)), ''), v_lang_metadata_json ->> 'date_format'); + + v_compmonth_regexp := + array_to_string(array_cat(array_cat(ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'months_shortnames')), + ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'months_names'))), + array_cat(ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'months_extrashortnames')), + ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'months_extranames'))) + ), '|'); + + IF ((v_datestring ~* v_defmask1_regexp AND v_culture <> 'FI') OR + (v_datestring ~* v_defmask1_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_datestring ~ concat(CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV') + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_datestring, CASE v_culture + WHEN 'FI' THEN v_defmask1_fi_regexp + ELSE v_defmask1_regexp + END, 'gi'); + v_timestring := v_regmatch_groups[2]; + v_correctnum := coalesce(v_regmatch_groups[1], v_regmatch_groups[3], + v_regmatch_groups[5], v_regmatch_groups[6]); + + IF (v_date_format = 'DMY' OR + v_culture IN ('SV-SE', 'SV_SE', 'LV-LV', 'LV_LV')) + THEN + v_day := v_regmatch_groups[4]; + v_month := v_regmatch_groups[7]; + ELSE + v_day := v_regmatch_groups[7]; + v_month := v_regmatch_groups[4]; + END IF; + + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA')) + THEN + IF (v_day::SMALLINT > 30 OR + v_month::SMALLINT > 12) THEN + RAISE invalid_datetime_format; + END IF; + + v_raw_year := to_char(sys.babelfish_conv_greg_to_hijri(current_date + 1), 'YYYY'); + v_hijridate := sys.babelfish_conv_hijri_to_greg(v_day, v_month, v_raw_year) - 1; + + v_day := to_char(v_hijridate, 'DD'); + v_month := to_char(v_hijridate, 'MM'); + v_year := to_char(v_hijridate, 'YYYY')::SMALLINT; + ELSE + v_year := to_char(current_date, 'YYYY')::SMALLINT; + END IF; + + ELSIF ((v_datestring ~* v_defmask6_regexp AND v_culture <> 'FI') OR + (v_datestring ~* v_defmask6_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA') OR + (v_datestring ~ concat('\s*\d{1,2}\.\s*(?:\.|\d+(?!\d)\s*\.)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{3,4}', + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, '\d{1,2}|', + '\d{3,4}', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, + TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}\s*(?:\.)+|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV')) + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_datestring, CASE v_culture + WHEN 'FI' THEN v_defmask6_fi_regexp + ELSE v_defmask6_regexp + END, 'gi'); + v_timestring := concat(v_regmatch_groups[1], v_regmatch_groups[5]); + v_day := v_regmatch_groups[4]; + v_month := v_regmatch_groups[3]; + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_regmatch_groups[2]::SMALLINT - 543 + ELSE v_regmatch_groups[2]::SMALLINT + END; + + ELSIF ((v_datestring ~* v_defmask2_regexp AND v_culture <> 'FI') OR + (v_datestring ~* v_defmask2_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA') OR + (v_datestring ~ concat('\s*\d{1,2}\.\s*(?:\.|\d+(?!\d)\s*\.)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{3,4}', + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?))', TIME_MASKSEP_REGEXP, '\d{1,2}|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV')) + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_datestring, CASE v_culture + WHEN 'FI' THEN v_defmask2_fi_regexp + ELSE v_defmask2_regexp + END, 'gi'); + v_timestring := v_regmatch_groups[2]; + v_correctnum := coalesce(v_regmatch_groups[1], v_regmatch_groups[3], v_regmatch_groups[5], + v_regmatch_groups[6], v_regmatch_groups[8], v_regmatch_groups[9]); + v_day := '01'; + v_month := v_regmatch_groups[7]; + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_regmatch_groups[4]::SMALLINT - 543 + ELSE v_regmatch_groups[4]::SMALLINT + END; + + ELSIF (v_datestring ~* v_defmask4_1_regexp OR + (v_datestring ~* v_defmask4_2_regexp AND v_culture !~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV') OR + (v_datestring ~* v_defmask9_regexp AND v_culture <> 'FI') OR + (v_datestring ~* v_defmask9_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_datestring ~ concat('\d+\s*\.?(?:,+|,*', AMPM_REGEXP, ')', TIME_MASKSEP_FI_REGEXP, '\.+', TIME_MASKSEP_REGEXP, '$|', + '\d+\s*\.', TIME_MASKSEP_FI_REGEXP, '\.', TIME_MASKSEP_FI_REGEXP, '$') AND + v_culture = 'FI') + THEN + RAISE invalid_datetime_format; + END IF; + + IF (v_datestring ~* v_defmask4_0_regexp) THEN + v_timestring := (regexp_matches(v_datestring, v_defmask4_0_regexp, 'gi'))[1]; + ELSE + v_timestring := v_datestring; + END IF; + + v_res_date := current_date; + v_day := to_char(v_res_date, 'DD'); + v_month := to_char(v_res_date, 'MM'); + v_year := to_char(v_res_date, 'YYYY')::SMALLINT; + + ELSIF ((v_datestring ~* v_defmask3_regexp AND v_culture <> 'FI') OR + (v_datestring ~* v_defmask3_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA') OR + (v_datestring ~ concat('\s*\d{1,2}\.\s*(?:\.|\d+(?!\d)\s*\.)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', + TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, '|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV')) + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_datestring, CASE v_culture + WHEN 'FI' THEN v_defmask3_fi_regexp + ELSE v_defmask3_regexp + END, 'gi'); + v_timestring := v_regmatch_groups[1]; + v_day := '01'; + v_month := v_regmatch_groups[2]; + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_regmatch_groups[3]::SMALLINT - 543 + ELSE v_regmatch_groups[3]::SMALLINT + END; + + ELSIF ((v_datestring ~* v_defmask5_regexp AND v_culture <> 'FI') OR + (v_datestring ~* v_defmask5_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA') OR + (v_datestring ~ concat('\s*\d{1,2}\.\s*(?:\.|\d+(?!\d)\s*\.)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, + TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, + TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{3,4}', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$|', + '\d{1,2}', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{3,4}\s*(?:\.)+|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV')) + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_datestring, v_defmask5_regexp, 'gi'); + v_timestring := concat(v_regmatch_groups[1], v_regmatch_groups[5]); + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_regmatch_groups[4]::SMALLINT - 543 + ELSE v_regmatch_groups[4]::SMALLINT + END; + + IF (v_date_format = 'DMY' OR + v_culture IN ('LV-LV', 'LV_LV')) + THEN + v_day := v_regmatch_groups[2]; + v_month := v_regmatch_groups[3]; + ELSE + v_day := v_regmatch_groups[3]; + v_month := v_regmatch_groups[2]; + END IF; + + ELSIF ((v_datestring ~* v_defmask7_regexp AND v_culture <> 'FI') OR + (v_datestring ~* v_defmask7_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA') OR + (v_datestring ~ concat('\s*\d{1,2}\.\s*(?:\.|\d+(?!\d)\s*\.)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', + MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{3,4}|', + '\d{3,4}', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}\s*(?:\.)+|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV')) + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_datestring, CASE v_culture + WHEN 'FI' THEN v_defmask7_fi_regexp + ELSE v_defmask7_regexp + END, 'gi'); + v_timestring := concat(v_regmatch_groups[1], v_regmatch_groups[5]); + v_day := v_regmatch_groups[4]; + v_month := v_regmatch_groups[2]; + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_regmatch_groups[3]::SMALLINT - 543 + ELSE v_regmatch_groups[3]::SMALLINT + END; + + ELSIF ((v_datestring ~* v_defmask8_regexp AND v_culture <> 'FI') OR + (v_datestring ~* v_defmask8_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_datestring ~ concat('\s*\d{1,2}\.\s*(?:\.|\d+(?!\d)\s*\.)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', + MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, + TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}|', + '\d{1,2}', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, + TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}\s*(?:\.)+|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'FI|DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV') + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_datestring, CASE v_culture + WHEN 'FI' THEN v_defmask8_fi_regexp + ELSE v_defmask8_regexp + END, 'gi'); + v_timestring := concat(v_regmatch_groups[1], v_regmatch_groups[5]); + + IF (v_date_format = 'DMY' OR + v_culture IN ('LV-LV', 'LV_LV')) + THEN + v_day := v_regmatch_groups[2]; + v_month := v_regmatch_groups[3]; + v_raw_year := v_regmatch_groups[4]; + ELSIF (v_date_format = 'YMD') + THEN + v_day := v_regmatch_groups[4]; + v_month := v_regmatch_groups[3]; + v_raw_year := v_regmatch_groups[2]; + ELSE + v_day := v_regmatch_groups[3]; + v_month := v_regmatch_groups[2]; + v_raw_year := v_regmatch_groups[4]; + END IF; + + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA')) + THEN + IF (v_day::SMALLINT > 30 OR + v_month::SMALLINT > 12) THEN + RAISE invalid_datetime_format; + END IF; + + v_raw_year := sys.babelfish_get_full_year(v_raw_year, '14'); + v_hijridate := sys.babelfish_conv_hijri_to_greg(v_day, v_month, v_raw_year) - 1; + + v_day := to_char(v_hijridate, 'DD'); + v_month := to_char(v_hijridate, 'MM'); + v_year := to_char(v_hijridate, 'YYYY')::SMALLINT; + + ELSIF (v_culture IN ('TH-TH', 'TH_TH')) THEN + v_year := sys.babelfish_get_full_year(v_raw_year)::SMALLINT - 43; + ELSE + v_year := sys.babelfish_get_full_year(v_raw_year, '', 29)::SMALLINT; + END IF; + ELSE + v_found := FALSE; + END IF; + + WHILE (NOT v_found AND v_resmask_cnt < 20) + LOOP + v_resmask := pg_catalog.replace(CASE v_resmask_cnt + WHEN 10 THEN v_defmask10_regexp + WHEN 11 THEN v_defmask11_regexp + WHEN 12 THEN v_defmask12_regexp + WHEN 13 THEN v_defmask13_regexp + WHEN 14 THEN v_defmask14_regexp + WHEN 15 THEN v_defmask15_regexp + WHEN 16 THEN v_defmask16_regexp + WHEN 17 THEN v_defmask17_regexp + WHEN 18 THEN v_defmask18_regexp + WHEN 19 THEN v_defmask19_regexp + END, + '$comp_month$', v_compmonth_regexp); + + v_resmask_fi := pg_catalog.replace(CASE v_resmask_cnt + WHEN 10 THEN v_defmask10_fi_regexp + WHEN 11 THEN v_defmask11_fi_regexp + WHEN 12 THEN v_defmask12_fi_regexp + WHEN 13 THEN v_defmask13_fi_regexp + WHEN 14 THEN v_defmask14_fi_regexp + WHEN 15 THEN v_defmask15_fi_regexp + WHEN 16 THEN v_defmask16_fi_regexp + WHEN 17 THEN v_defmask17_fi_regexp + WHEN 18 THEN v_defmask18_fi_regexp + WHEN 19 THEN v_defmask19_fi_regexp + END, + '$comp_month$', v_compmonth_regexp); + + IF ((v_datestring ~* v_resmask AND v_culture <> 'FI') OR + (v_datestring ~* v_resmask_fi AND v_culture = 'FI')) + THEN + v_found := TRUE; + v_regmatch_groups := regexp_matches(v_datestring, CASE v_culture + WHEN 'FI' THEN v_resmask_fi + ELSE v_resmask + END, 'gi'); + v_timestring := CASE + WHEN v_resmask_cnt IN (10, 11, 12, 13) THEN concat(v_regmatch_groups[1], v_regmatch_groups[4]) + ELSE concat(v_regmatch_groups[1], v_regmatch_groups[5]) + END; + + IF (v_resmask_cnt = 10) + THEN + IF (v_regmatch_groups[3] = 'MAR' AND + v_culture IN ('IT-IT', 'IT_IT')) + THEN + RAISE invalid_datetime_format; + END IF; + + IF (v_date_format = 'YMD' AND v_culture NOT IN ('SV-SE', 'SV_SE', 'LV-LV', 'LV_LV')) + THEN + v_day := '01'; + v_year := sys.babelfish_get_full_year(v_regmatch_groups[2], '', 29)::SMALLINT; + ELSE + v_day := v_regmatch_groups[2]; + v_year := to_char(current_date, 'YYYY')::SMALLINT; + END IF; + + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[3], v_lang_metadata_json); + v_raw_year := to_char(sys.babelfish_conv_greg_to_hijri(current_date + 1), 'YYYY'); + + ELSIF (v_resmask_cnt = 11) + THEN + IF (v_date_format IN ('YMD', 'MDY') AND v_culture NOT IN ('SV-SE', 'SV_SE')) + THEN + v_day := v_regmatch_groups[3]; + v_year := to_char(current_date, 'YYYY')::SMALLINT; + ELSE + v_day := '01'; + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN sys.babelfish_get_full_year(v_regmatch_groups[3])::SMALLINT - 43 + ELSE sys.babelfish_get_full_year(v_regmatch_groups[3], '', 29)::SMALLINT + END; + END IF; + + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[2], v_lang_metadata_json); + v_raw_year := sys.babelfish_get_full_year(substring(v_year::TEXT, 3, 2), '14'); + + ELSIF (v_resmask_cnt = 12) + THEN + v_day := '01'; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[3], v_lang_metadata_json); + v_raw_year := v_regmatch_groups[2]; + + ELSIF (v_resmask_cnt = 13) + THEN + v_day := '01'; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[2], v_lang_metadata_json); + v_raw_year := v_regmatch_groups[3]; + + ELSIF (v_resmask_cnt IN (14, 15, 16)) + THEN + IF (v_resmask_cnt = 14) + THEN + v_left_part := v_regmatch_groups[4]; + v_right_part := v_regmatch_groups[3]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[2], v_lang_metadata_json); + ELSIF (v_resmask_cnt = 15) + THEN + v_left_part := v_regmatch_groups[4]; + v_right_part := v_regmatch_groups[2]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[3], v_lang_metadata_json); + ELSE + v_left_part := v_regmatch_groups[3]; + v_right_part := v_regmatch_groups[2]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[4], v_lang_metadata_json); + END IF; + + IF (char_length(v_left_part) <= 2) + THEN + IF (v_date_format = 'YMD' AND v_culture NOT IN ('LV-LV', 'LV_LV')) + THEN + v_day := v_left_part; + v_raw_year := sys.babelfish_get_full_year(v_right_part, '14'); + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN sys.babelfish_get_full_year(v_right_part)::SMALLINT - 43 + ELSE sys.babelfish_get_full_year(v_right_part, '', 29)::SMALLINT + END; + BEGIN + v_res_date := make_date(v_year, v_month::SMALLINT, v_day::SMALLINT); + EXCEPTION + WHEN OTHERS THEN + v_day := v_right_part; + v_raw_year := sys.babelfish_get_full_year(v_left_part, '14'); + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN sys.babelfish_get_full_year(v_left_part)::SMALLINT - 43 + ELSE sys.babelfish_get_full_year(v_left_part, '', 29)::SMALLINT + END; + END; + END IF; + + IF (v_date_format IN ('MDY', 'DMY') OR v_culture IN ('LV-LV', 'LV_LV')) + THEN + v_day := v_right_part; + v_raw_year := sys.babelfish_get_full_year(v_left_part, '14'); + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN sys.babelfish_get_full_year(v_left_part)::SMALLINT - 43 + ELSE sys.babelfish_get_full_year(v_left_part, '', 29)::SMALLINT + END; + BEGIN + v_res_date := make_date(v_year, v_month::SMALLINT, v_day::SMALLINT); + EXCEPTION + WHEN OTHERS THEN + v_day := v_left_part; + v_raw_year := sys.babelfish_get_full_year(v_right_part, '14'); + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN sys.babelfish_get_full_year(v_right_part)::SMALLINT - 43 + ELSE sys.babelfish_get_full_year(v_right_part, '', 29)::SMALLINT + END; + END; + END IF; + ELSE + v_day := v_right_part; + v_raw_year := v_left_part; + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_left_part::SMALLINT - 543 + ELSE v_left_part::SMALLINT + END; + END IF; + + ELSIF (v_resmask_cnt = 17) + THEN + v_day := v_regmatch_groups[4]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[3], v_lang_metadata_json); + v_raw_year := v_regmatch_groups[2]; + + ELSIF (v_resmask_cnt = 18) + THEN + v_day := v_regmatch_groups[3]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[4], v_lang_metadata_json); + v_raw_year := v_regmatch_groups[2]; + + ELSIF (v_resmask_cnt = 19) + THEN + v_day := v_regmatch_groups[4]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[2], v_lang_metadata_json); + v_raw_year := v_regmatch_groups[3]; + END IF; + + IF (v_resmask_cnt NOT IN (10, 11, 14, 15, 16)) + THEN + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_raw_year::SMALLINT - 543 + ELSE v_raw_year::SMALLINT + END; + END IF; + + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA')) + THEN + IF (v_day::SMALLINT > 30 OR + (v_resmask_cnt NOT IN (10, 11, 14, 15, 16) AND v_year NOT BETWEEN 1318 AND 1501) OR + (v_resmask_cnt IN (14, 15, 16) AND v_raw_year::SMALLINT NOT BETWEEN 1318 AND 1501)) + THEN + RAISE invalid_datetime_format; + END IF; + + v_hijridate := sys.babelfish_conv_hijri_to_greg(v_day, v_month, v_raw_year) - 1; + + v_day := to_char(v_hijridate, 'DD'); + v_month := to_char(v_hijridate, 'MM'); + v_year := to_char(v_hijridate, 'YYYY')::SMALLINT; + END IF; + END IF; + + v_resmask_cnt := v_resmask_cnt + 1; + END LOOP; + + IF (NOT v_found) THEN + RAISE invalid_datetime_format; + END IF; + + IF (char_length(v_timestring) > 0 AND v_timestring NOT IN ('AM', 'ص', 'PM', 'م')) + THEN + IF (v_culture = 'FI') THEN + v_timestring := PG_CATALOG.translate(v_timestring, '.,', ': '); + + IF (char_length(split_part(v_timestring, ':', 4)) > 0) THEN + v_timestring := regexp_replace(v_timestring, ':(?=\s*\d+\s*:?\s*(?:[AP]M|ص|م)?\s*$)', '.'); + END IF; + END IF; + + v_timestring := pg_catalog.replace(regexp_replace(v_timestring, '\.?[AP]M|ص|م|\s|\,|\.\D|[\.|:]$', '', 'gi'), ':.', ':'); + BEGIN + v_hours := coalesce(split_part(v_timestring, ':', 1)::SMALLINT, 0); + + IF ((v_dayparts[1] IN ('AM', 'ص') AND v_hours NOT BETWEEN 0 AND 12) OR + (v_dayparts[1] IN ('PM', 'م') AND v_hours NOT BETWEEN 1 AND 23)) + THEN + RAISE invalid_datetime_format; + END IF; + + v_minutes := coalesce(nullif(split_part(v_timestring, ':', 2), '')::SMALLINT, 0); + v_seconds := coalesce(nullif(split_part(v_timestring, ':', 3), '')::NUMERIC, 0); + EXCEPTION + WHEN OTHERS THEN + RAISE invalid_datetime_format; + END; + ELSIF (v_dayparts[1] IN ('PM', 'م')) + THEN + v_hours := 12; + END IF; + + v_res_date := make_timestamp(v_year, v_month::SMALLINT, v_day::SMALLINT, + v_hours, v_minutes, v_seconds); + + IF (v_weekdaynames[1] IS NOT NULL) THEN + v_weekdaynum := sys.babelfish_get_weekdaynum_by_name(v_weekdaynames[1], v_lang_metadata_json); + + IF (CASE date_part('dow', v_res_date)::SMALLINT + WHEN 0 THEN 7 + ELSE date_part('dow', v_res_date)::SMALLINT + END <> v_weekdaynum) + THEN + RAISE invalid_datetime_format; + END IF; + END IF; + + RETURN v_res_date; +EXCEPTION + WHEN invalid_datetime_format OR datetime_field_overflow THEN + RAISE USING MESSAGE := pg_catalog.format('Error converting string value ''%s'' into data type DATE using culture ''%s''.', + p_datestring, p_culture), + DETAIL := 'Incorrect using of pair of input parameters values during conversion process.', + HINT := 'Check the input parameters values, correct them if needed, and try again.'; + + WHEN invalid_parameter_value THEN + RAISE USING MESSAGE := CASE char_length(coalesce(CONVERSION_LANG, '')) + WHEN 0 THEN pg_catalog.format('The culture parameter ''%s'' provided in the function call is not supported.', + p_culture) + ELSE pg_catalog.format('Invalid CONVERSION_LANG constant value - ''%s''. Allowed values are: ''English'', ''Deutsch'', etc.', + CONVERSION_LANG) + END, + DETAIL := 'Passed incorrect value for "p_culture" parameter or compiled incorrect CONVERSION_LANG constant value in function''s body.', + HINT := 'Check "p_culture" input parameter value, correct it if needed, and try again. Also check CONVERSION_LANG constant value.'; + + WHEN invalid_text_representation THEN + GET STACKED DIAGNOSTICS v_err_message = MESSAGE_TEXT; + v_err_message := substring(pg_catalog.lower(v_err_message), 'integer\:\s\"(.*)\"'); + + RAISE USING MESSAGE := pg_catalog.format('Error while trying to convert "%s" value to SMALLINT data type.', + v_err_message), + DETAIL := 'Supplied value contains illegal characters.', + HINT := 'Correct supplied value, remove all illegal characters.'; +END; +$BODY$ +LANGUAGE plpgsql +STABLE +RETURNS NULL ON NULL INPUT; + +CREATE OR REPLACE FUNCTION sys.babelfish_parse_to_datetime(IN p_datatype TEXT, + IN p_datetimestring TEXT, + IN p_culture TEXT DEFAULT '') +RETURNS TIMESTAMP WITHOUT TIME ZONE +AS +$BODY$ +DECLARE + v_day VARCHAR COLLATE "C"; + v_year SMALLINT; + v_month VARCHAR COLLATE "C"; + v_res_date DATE; + v_scale SMALLINT; + v_hijridate DATE; + v_culture VARCHAR COLLATE "C"; + v_dayparts TEXT[]; + v_resmask VARCHAR COLLATE "C"; + v_datatype VARCHAR COLLATE "C"; + v_raw_year VARCHAR COLLATE "C"; + v_left_part VARCHAR COLLATE "C"; + v_right_part VARCHAR COLLATE "C"; + v_resmask_fi VARCHAR COLLATE "C"; + v_timestring VARCHAR COLLATE "C"; + v_correctnum VARCHAR COLLATE "C"; + v_weekdaynum SMALLINT; + v_err_message VARCHAR COLLATE "C"; + v_date_format VARCHAR COLLATE "C"; + v_weekdaynames TEXT[]; + v_hours SMALLINT := 0; + v_minutes SMALLINT := 0; + v_res_datatype VARCHAR COLLATE "C"; + v_error_message VARCHAR COLLATE "C"; + v_found BOOLEAN := TRUE; + v_compday_regexp VARCHAR COLLATE "C"; + v_regmatch_groups TEXT[]; + v_datatype_groups TEXT[]; + v_datetimestring VARCHAR COLLATE "C"; + v_seconds VARCHAR COLLATE "C" := '0'; + v_fseconds VARCHAR COLLATE "C" := '0'; + v_compmonth_regexp VARCHAR COLLATE "C"; + v_lang_metadata_json JSONB; + v_resmask_cnt SMALLINT := 10; + v_res_datetime TIMESTAMP(6) WITHOUT TIME ZONE; + DAYMM_REGEXP CONSTANT VARCHAR COLLATE "C" := '(\d{1,2})'; + FULLYEAR_REGEXP CONSTANT VARCHAR COLLATE "C" := '(\d{3,4})'; + SHORTYEAR_REGEXP CONSTANT VARCHAR COLLATE "C" := '(\d{1,2})'; + COMPYEAR_REGEXP CONSTANT VARCHAR COLLATE "C" := '(\d{1,4})'; + AMPM_REGEXP CONSTANT VARCHAR COLLATE "C" := '(?:[AP]M|ص|م)'; + TIMEUNIT_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*\d{1,2}\s*'; + MASKSEPONE_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*(?:/|-)?'; + MASKSEPTWO_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*(?:\s|/|-|\.|,)'; + MASKSEPTWO_FI_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*(?:\s|/|-|,)'; + MASKSEPTHREE_REGEXP CONSTANT VARCHAR COLLATE "C" := '\s*(?:/|-|\.|,)'; + TIME_MASKSEP_REGEXP CONSTANT VARCHAR COLLATE "C" := '(?:\s|\.|,)*'; + TIME_MASKSEP_FI_REGEXP CONSTANT VARCHAR COLLATE "C" := '(?:\s|,)*'; + WEEKDAYAMPM_START_REGEXP CONSTANT VARCHAR COLLATE "C" := '(^|[[:digit:][:space:]\.,])'; + WEEKDAYAMPM_END_REGEXP CONSTANT VARCHAR COLLATE "C" := '([[:digit:][:space:]\.,]|$)(?=[^/-]|$)'; + CORRECTNUM_REGEXP CONSTANT VARCHAR COLLATE "C" := '(?:([+-]\d{1,4})(?:[[:space:]\.,]|[AP]M|ص|م|$))'; + DATATYPE_REGEXP CONSTANT VARCHAR COLLATE "C" := '^(DATETIME|SMALLDATETIME|DATETIME2)\s*(?:\()?\s*((?:-)?\d+)?\s*(?:\))?$'; + ANNO_DOMINI_REGEXP VARCHAR COLLATE "C" := '(AD|A\.D\.)'; + ANNO_DOMINI_COMPREGEXP VARCHAR COLLATE "C" := concat(WEEKDAYAMPM_START_REGEXP, ANNO_DOMINI_REGEXP, WEEKDAYAMPM_END_REGEXP); + HHMMSSFS_PART_REGEXP CONSTANT VARCHAR COLLATE "C" := + concat(TIMEUNIT_REGEXP, AMPM_REGEXP, '|', + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '\:', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '(?!\d)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?|', + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '\:', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '\:', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '(?!\d)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?|', + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '\:', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, TIMEUNIT_REGEXP, '\:', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\s*\d{1,2}\.\d+(?!\d)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?|', + AMPM_REGEXP, '?'); + HHMMSSFS_PART_FI_REGEXP CONSTANT VARCHAR COLLATE "C" := + concat(TIMEUNIT_REGEXP, AMPM_REGEXP, '|', + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '[\:\.]', TIME_MASKSEP_FI_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '(?!\d)', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?\.?|', + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '[\:\.]', TIME_MASKSEP_FI_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '[\:\.]', TIME_MASKSEP_FI_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '(?!\d)', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?|', + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '[\:\.]', TIME_MASKSEP_FI_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, TIMEUNIT_REGEXP, '[\:\.]', TIME_MASKSEP_FI_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, '\s*\d{1,2}\.\d+(?!\d)\.?', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?|', + AMPM_REGEXP, '?'); + v_defmask1_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, + '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_REGEXP, '(?:[\.|,]+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)', TIME_MASKSEP_REGEXP, '$'); + v_defmask1_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, + '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_FI_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:', MASKSEPTWO_FI_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[,]+', AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, CORRECTNUM_REGEXP, '?))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_FI_REGEXP, '(?:[\.|,]+', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask2_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, + '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_REGEXP, '(?:(?:[\.|,]+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?)|', + CORRECTNUM_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, '$'); + v_defmask2_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, + '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_FI_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_FI_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, + AMPM_REGEXP, TIME_MASKSEP_FI_REGEXP, CORRECTNUM_REGEXP, '?))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_FI_REGEXP, '(?:(?:[\.|,]+', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, TIME_MASKSEP_FI_REGEXP, CORRECTNUM_REGEXP, '?)|', + CORRECTNUM_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask3_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, ')|', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + TIME_MASKSEP_REGEXP, '(', TIME_MASKSEP_REGEXP, AMPM_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask3_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + TIME_MASKSEP_FI_REGEXP, '[\./]?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)', + FULLYEAR_REGEXP, + TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask4_0_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, '\s*(', AMPM_REGEXP, ')', + TIME_MASKSEP_REGEXP, '$'); + v_defmask4_1_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:\s|,)+', + DAYMM_REGEXP, '\s*(', AMPM_REGEXP, ')', + TIME_MASKSEP_REGEXP, '$'); + v_defmask4_2_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '\s*[\.]+', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, '\s*(', AMPM_REGEXP, ')', + TIME_MASKSEP_REGEXP, '$'); + v_defmask5_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask5_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask6_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|\.|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_REGEXP, '))?', TIME_MASKSEP_REGEXP, '$'); + v_defmask6_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:\s*[\.])?', + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask7_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|\.|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_REGEXP, '))?', TIME_MASKSEP_REGEXP, '$'); + v_defmask7_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask8_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:[\.|,]+', AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:[\.|,]+', AMPM_REGEXP, ')?', + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask8_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_FI_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[,]+', AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)|', + '(?:[,]+', AMPM_REGEXP, '))', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:[\,]+|\s*/\s*)', AMPM_REGEXP, ')?', + TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask9_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', + HHMMSSFS_PART_REGEXP, + ')', TIME_MASKSEP_REGEXP, '$'); + v_defmask9_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, '(', + HHMMSSFS_PART_FI_REGEXP, + ')', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask10_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)?', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask10_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)?', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask11_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask11_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask12_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask12_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask13_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$'); + v_defmask13_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask14_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + '($comp_month$)' + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)', TIME_MASKSEP_REGEXP, + COMPYEAR_REGEXP, + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask14_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + '($comp_month$)' + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_FI_REGEXP, AMPM_REGEXP, '?)', TIME_MASKSEP_FI_REGEXP, + COMPYEAR_REGEXP, + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask15_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + COMPYEAR_REGEXP, + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask15_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + COMPYEAR_REGEXP, + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask16_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)', TIME_MASKSEP_REGEXP, + COMPYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask16_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + DAYMM_REGEXP, + '(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)', TIME_MASKSEP_REGEXP, + COMPYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask17_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask17_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask18_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, '$'); + v_defmask18_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, '(?:', AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))?)|', + '(?:(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '(?=(?:[[:space:]\.,])+))))', TIME_MASKSEP_REGEXP, + '($comp_month$)', + TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, '$'); + v_defmask19_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_REGEXP, '(', HHMMSSFS_PART_REGEXP, ')?', TIME_MASKSEP_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|\.|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_REGEXP, '))?', TIME_MASKSEP_REGEXP, '$'); + v_defmask19_fi_regexp VARCHAR COLLATE "C" := concat('^', TIME_MASKSEP_FI_REGEXP, '(', HHMMSSFS_PART_FI_REGEXP, ')?', TIME_MASKSEP_FI_REGEXP, + '($comp_month$)', + '(?:', MASKSEPTHREE_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)?', TIME_MASKSEP_REGEXP, + FULLYEAR_REGEXP, + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, + DAYMM_REGEXP, + '((?:(?:\s|,)+|', AMPM_REGEXP, ')(?:', HHMMSSFS_PART_FI_REGEXP, '))?', TIME_MASKSEP_FI_REGEXP, '$'); + CONVERSION_LANG CONSTANT VARCHAR COLLATE "C" := ''; + DATE_FORMAT CONSTANT VARCHAR COLLATE "C" := ''; +BEGIN + v_datatype := trim(p_datatype); + v_datetimestring := pg_catalog.upper(trim(p_datetimestring)); + v_culture := coalesce(nullif(pg_catalog.upper(trim(p_culture)), ''), 'EN-US'); + + v_datatype_groups := regexp_matches(v_datatype, DATATYPE_REGEXP, 'gi'); + + v_res_datatype := pg_catalog.upper(v_datatype_groups[1]); + v_scale := v_datatype_groups[2]::SMALLINT; + + IF (v_res_datatype IS NULL) THEN + RAISE datatype_mismatch; + ELSIF (v_res_datatype <> 'DATETIME2' AND v_scale IS NOT NULL) + THEN + RAISE invalid_indicator_parameter_value; + ELSIF (coalesce(v_scale, 0) NOT BETWEEN 0 AND 7) + THEN + RAISE interval_field_overflow; + ELSIF (v_scale IS NULL) THEN + v_scale := 7; + END IF; + + v_dayparts := ARRAY(SELECT pg_catalog.upper(array_to_string(regexp_matches(v_datetimestring, '[AP]M|ص|م', 'gi'), ''))); + + IF (array_length(v_dayparts, 1) > 1) THEN + RAISE invalid_datetime_format; + END IF; + + BEGIN + v_lang_metadata_json := sys.babelfish_get_lang_metadata_json(coalesce(nullif(CONVERSION_LANG, ''), p_culture)); + EXCEPTION + WHEN OTHERS THEN + RAISE invalid_parameter_value; + END; + + v_compday_regexp := array_to_string(array_cat(array_cat(ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'days_names')), + ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'days_shortnames'))), + ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'days_extrashortnames'))), '|'); + + v_weekdaynames := ARRAY(SELECT array_to_string(regexp_matches(v_datetimestring, v_compday_regexp, 'gi'), '')); + + IF (array_length(v_weekdaynames, 1) > 1) THEN + RAISE invalid_datetime_format; + END IF; + + IF (v_weekdaynames[1] IS NOT NULL AND + v_datetimestring ~* concat(WEEKDAYAMPM_START_REGEXP, '(', v_compday_regexp, ')', WEEKDAYAMPM_END_REGEXP)) + THEN + v_datetimestring := pg_catalog.replace(v_datetimestring, v_weekdaynames[1], ' '); + END IF; + + IF (v_datetimestring ~* ANNO_DOMINI_COMPREGEXP) + THEN + IF (v_culture !~ 'EN[-_]US|DA[-_]DK|SV[-_]SE|EN[-_]GB|HI[-_]IS') THEN + RAISE invalid_datetime_format; + END IF; + + v_datetimestring := regexp_replace(v_datetimestring, + ANNO_DOMINI_COMPREGEXP, + regexp_replace(array_to_string(regexp_matches(v_datetimestring, ANNO_DOMINI_COMPREGEXP, 'gi'), ''), + ANNO_DOMINI_REGEXP, ' ', 'gi'), + 'gi'); + END IF; + + v_date_format := coalesce(nullif(pg_catalog.upper(trim(DATE_FORMAT)), ''), v_lang_metadata_json ->> 'date_format'); + + v_compmonth_regexp := + array_to_string(array_cat(array_cat(ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'months_shortnames')), + ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'months_names'))), + array_cat(ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'months_extrashortnames')), + ARRAY(SELECT jsonb_array_elements_text(v_lang_metadata_json -> 'months_extranames'))) + ), '|'); + + IF ((v_datetimestring ~* v_defmask1_regexp AND v_culture <> 'FI') OR + (v_datetimestring ~* v_defmask1_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_datetimestring ~ concat(CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, + AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, + CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV') + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_datetimestring, CASE v_culture + WHEN 'FI' THEN v_defmask1_fi_regexp + ELSE v_defmask1_regexp + END, 'gi'); + v_timestring := v_regmatch_groups[2]; + v_correctnum := coalesce(v_regmatch_groups[1], v_regmatch_groups[3], + v_regmatch_groups[5], v_regmatch_groups[6]); + + IF (v_date_format = 'DMY' OR + v_culture IN ('SV-SE', 'SV_SE', 'LV-LV', 'LV_LV')) + THEN + v_day := v_regmatch_groups[4]; + v_month := v_regmatch_groups[7]; + ELSE + v_day := v_regmatch_groups[7]; + v_month := v_regmatch_groups[4]; + END IF; + + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA')) + THEN + IF (v_day::SMALLINT > 30 OR + v_month::SMALLINT > 12) THEN + RAISE invalid_datetime_format; + END IF; + + v_raw_year := to_char(sys.babelfish_conv_greg_to_hijri(current_date + 1), 'YYYY'); + v_hijridate := sys.babelfish_conv_hijri_to_greg(v_day, v_month, v_raw_year) - 1; + + v_day := to_char(v_hijridate, 'DD'); + v_month := to_char(v_hijridate, 'MM'); + v_year := to_char(v_hijridate, 'YYYY')::SMALLINT; + ELSE + v_year := to_char(current_date, 'YYYY')::SMALLINT; + END IF; + + ELSIF ((v_datetimestring ~* v_defmask6_regexp AND v_culture <> 'FI') OR + (v_datetimestring ~* v_defmask6_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA') OR + (v_datetimestring ~ concat('\s*\d{1,2}\.\s*(?:\.|\d+(?!\d)\s*\.)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{3,4}', + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '))', TIME_MASKSEP_REGEXP, '\d{1,2}|', + '\d{3,4}', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, + TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}\s*(?:\.)+|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV')) + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_datetimestring, CASE v_culture + WHEN 'FI' THEN v_defmask6_fi_regexp + ELSE v_defmask6_regexp + END, 'gi'); + v_timestring := concat(v_regmatch_groups[1], v_regmatch_groups[5]); + v_day := v_regmatch_groups[4]; + v_month := v_regmatch_groups[3]; + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_regmatch_groups[2]::SMALLINT - 543 + ELSE v_regmatch_groups[2]::SMALLINT + END; + + ELSIF ((v_datetimestring ~* v_defmask2_regexp AND v_culture <> 'FI') OR + (v_datetimestring ~* v_defmask2_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA') OR + (v_datetimestring ~ concat('\s*\d{1,2}\.\s*(?:\.|\d+(?!\d)\s*\.)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{3,4}', + '(?:(?:', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?)|', + '(?:', TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?', TIME_MASKSEP_REGEXP, + AMPM_REGEXP, TIME_MASKSEP_REGEXP, CORRECTNUM_REGEXP, '?))', TIME_MASKSEP_REGEXP, '\d{1,2}|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV')) + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_datetimestring, CASE v_culture + WHEN 'FI' THEN v_defmask2_fi_regexp + ELSE v_defmask2_regexp + END, 'gi'); + v_timestring := v_regmatch_groups[2]; + v_correctnum := coalesce(v_regmatch_groups[1], v_regmatch_groups[3], v_regmatch_groups[5], + v_regmatch_groups[6], v_regmatch_groups[8], v_regmatch_groups[9]); + v_day := '01'; + v_month := v_regmatch_groups[7]; + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_regmatch_groups[4]::SMALLINT - 543 + ELSE v_regmatch_groups[4]::SMALLINT + END; + + ELSIF (v_datetimestring ~* v_defmask4_1_regexp OR + (v_datetimestring ~* v_defmask4_2_regexp AND v_culture !~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV') OR + (v_datetimestring ~* v_defmask9_regexp AND v_culture <> 'FI') OR + (v_datetimestring ~* v_defmask9_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_datetimestring ~ concat('\d+\s*\.?(?:,+|,*', AMPM_REGEXP, ')', TIME_MASKSEP_FI_REGEXP, '\.+', TIME_MASKSEP_REGEXP, '$|', + '\d+\s*\.', TIME_MASKSEP_FI_REGEXP, '\.', TIME_MASKSEP_FI_REGEXP, '$') AND + v_culture = 'FI') + THEN + RAISE invalid_datetime_format; + END IF; + + IF (v_datetimestring ~* v_defmask4_0_regexp) THEN + v_timestring := (regexp_matches(v_datetimestring, v_defmask4_0_regexp, 'gi'))[1]; + ELSE + v_timestring := v_datetimestring; + END IF; + + v_res_date := current_date; + v_day := to_char(v_res_date, 'DD'); + v_month := to_char(v_res_date, 'MM'); + v_year := to_char(v_res_date, 'YYYY')::SMALLINT; + + ELSIF ((v_datetimestring ~* v_defmask3_regexp AND v_culture <> 'FI') OR + (v_datetimestring ~* v_defmask3_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA') OR + (v_datetimestring ~ concat('\s*\d{1,2}\.\s*(?:\.|\d+(?!\d)\s*\.)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', + TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, '|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV')) + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_datetimestring, CASE v_culture + WHEN 'FI' THEN v_defmask3_fi_regexp + ELSE v_defmask3_regexp + END, 'gi'); + v_timestring := v_regmatch_groups[1]; + v_day := '01'; + v_month := v_regmatch_groups[2]; + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_regmatch_groups[3]::SMALLINT - 543 + ELSE v_regmatch_groups[3]::SMALLINT + END; + + ELSIF ((v_datetimestring ~* v_defmask5_regexp AND v_culture <> 'FI') OR + (v_datetimestring ~* v_defmask5_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA') OR + (v_datetimestring ~ concat('\s*\d{1,2}\.\s*(?:\.|\d+(?!\d)\s*\.)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, + TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, + TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{3,4}', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$|', + '\d{1,2}', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{3,4}\s*(?:\.)+|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV')) + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_datetimestring, v_defmask5_regexp, 'gi'); + v_timestring := concat(v_regmatch_groups[1], v_regmatch_groups[5]); + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_regmatch_groups[4]::SMALLINT - 543 + ELSE v_regmatch_groups[4]::SMALLINT + END; + + IF (v_date_format = 'DMY' OR + v_culture IN ('LV-LV', 'LV_LV')) + THEN + v_day := v_regmatch_groups[2]; + v_month := v_regmatch_groups[3]; + ELSE + v_day := v_regmatch_groups[3]; + v_month := v_regmatch_groups[2]; + END IF; + + ELSIF ((v_datetimestring ~* v_defmask7_regexp AND v_culture <> 'FI') OR + (v_datetimestring ~* v_defmask7_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA') OR + (v_datetimestring ~ concat('\s*\d{1,2}\.\s*(?:\.|\d+(?!\d)\s*\.)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', + MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{3,4}|', + '\d{3,4}', MASKSEPTWO_REGEXP, '?', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}\s*(?:\.)+|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV')) + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_datetimestring, CASE v_culture + WHEN 'FI' THEN v_defmask7_fi_regexp + ELSE v_defmask7_regexp + END, 'gi'); + v_timestring := concat(v_regmatch_groups[1], v_regmatch_groups[5]); + v_day := v_regmatch_groups[4]; + v_month := v_regmatch_groups[2]; + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_regmatch_groups[3]::SMALLINT - 543 + ELSE v_regmatch_groups[3]::SMALLINT + END; + + ELSIF ((v_datetimestring ~* v_defmask8_regexp AND v_culture <> 'FI') OR + (v_datetimestring ~* v_defmask8_fi_regexp AND v_culture = 'FI')) + THEN + IF (v_datetimestring ~ concat('\s*\d{1,2}\.\s*(?:\.|\d+(?!\d)\s*\.)', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', + MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, + TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}|', + '\d{1,2}', MASKSEPTWO_REGEXP, TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}', MASKSEPTWO_REGEXP, + TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '\d{1,2}\s*(?:\.)+|', + '\d+\s*(?:\.)+', TIME_MASKSEP_REGEXP, AMPM_REGEXP, '?', TIME_MASKSEP_REGEXP, '$') AND + v_culture ~ 'FI|DE[-_]DE|NN[-_]NO|CS[-_]CZ|PL[-_]PL|RO[-_]RO|SK[-_]SK|SL[-_]SI|BG[-_]BG|RU[-_]RU|TR[-_]TR|ET[-_]EE|LV[-_]LV') + THEN + RAISE invalid_datetime_format; + END IF; + + v_regmatch_groups := regexp_matches(v_datetimestring, CASE v_culture + WHEN 'FI' THEN v_defmask8_fi_regexp + ELSE v_defmask8_regexp + END, 'gi'); + v_timestring := concat(v_regmatch_groups[1], v_regmatch_groups[5]); + + IF (v_date_format = 'DMY' OR + v_culture IN ('LV-LV', 'LV_LV')) + THEN + v_day := v_regmatch_groups[2]; + v_month := v_regmatch_groups[3]; + v_raw_year := v_regmatch_groups[4]; + ELSIF (v_date_format = 'YMD') + THEN + v_day := v_regmatch_groups[4]; + v_month := v_regmatch_groups[3]; + v_raw_year := v_regmatch_groups[2]; + ELSE + v_day := v_regmatch_groups[3]; + v_month := v_regmatch_groups[2]; + v_raw_year := v_regmatch_groups[4]; + END IF; + + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA')) + THEN + IF (v_day::SMALLINT > 30 OR + v_month::SMALLINT > 12) THEN + RAISE invalid_datetime_format; + END IF; + + v_raw_year := sys.babelfish_get_full_year(v_raw_year, '14'); + v_hijridate := sys.babelfish_conv_hijri_to_greg(v_day, v_month, v_raw_year) - 1; + + v_day := to_char(v_hijridate, 'DD'); + v_month := to_char(v_hijridate, 'MM'); + v_year := to_char(v_hijridate, 'YYYY')::SMALLINT; + + ELSIF (v_culture IN ('TH-TH', 'TH_TH')) THEN + v_year := sys.babelfish_get_full_year(v_raw_year)::SMALLINT - 43; + ELSE + v_year := sys.babelfish_get_full_year(v_raw_year, '', 29)::SMALLINT; + END IF; + ELSE + v_found := FALSE; + END IF; + + WHILE (NOT v_found AND v_resmask_cnt < 20) + LOOP + v_resmask := pg_catalog.replace(CASE v_resmask_cnt + WHEN 10 THEN v_defmask10_regexp + WHEN 11 THEN v_defmask11_regexp + WHEN 12 THEN v_defmask12_regexp + WHEN 13 THEN v_defmask13_regexp + WHEN 14 THEN v_defmask14_regexp + WHEN 15 THEN v_defmask15_regexp + WHEN 16 THEN v_defmask16_regexp + WHEN 17 THEN v_defmask17_regexp + WHEN 18 THEN v_defmask18_regexp + WHEN 19 THEN v_defmask19_regexp + END, + '$comp_month$', v_compmonth_regexp); + + v_resmask_fi := pg_catalog.replace(CASE v_resmask_cnt + WHEN 10 THEN v_defmask10_fi_regexp + WHEN 11 THEN v_defmask11_fi_regexp + WHEN 12 THEN v_defmask12_fi_regexp + WHEN 13 THEN v_defmask13_fi_regexp + WHEN 14 THEN v_defmask14_fi_regexp + WHEN 15 THEN v_defmask15_fi_regexp + WHEN 16 THEN v_defmask16_fi_regexp + WHEN 17 THEN v_defmask17_fi_regexp + WHEN 18 THEN v_defmask18_fi_regexp + WHEN 19 THEN v_defmask19_fi_regexp + END, + '$comp_month$', v_compmonth_regexp); + + IF ((v_datetimestring ~* v_resmask AND v_culture <> 'FI') OR + (v_datetimestring ~* v_resmask_fi AND v_culture = 'FI')) + THEN + v_found := TRUE; + v_regmatch_groups := regexp_matches(v_datetimestring, CASE v_culture + WHEN 'FI' THEN v_resmask_fi + ELSE v_resmask + END, 'gi'); + v_timestring := CASE + WHEN v_resmask_cnt IN (10, 11, 12, 13) THEN concat(v_regmatch_groups[1], v_regmatch_groups[4]) + ELSE concat(v_regmatch_groups[1], v_regmatch_groups[5]) + END; + + IF (v_resmask_cnt = 10) + THEN + IF (v_regmatch_groups[3] = 'MAR' AND + v_culture IN ('IT-IT', 'IT_IT')) + THEN + RAISE invalid_datetime_format; + END IF; + + IF (v_date_format = 'YMD' AND v_culture NOT IN ('SV-SE', 'SV_SE', 'LV-LV', 'LV_LV')) + THEN + v_day := '01'; + v_year := sys.babelfish_get_full_year(v_regmatch_groups[2], '', 29)::SMALLINT; + ELSE + v_day := v_regmatch_groups[2]; + v_year := to_char(current_date, 'YYYY')::SMALLINT; + END IF; + + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[3], v_lang_metadata_json); + v_raw_year := to_char(sys.babelfish_conv_greg_to_hijri(current_date + 1), 'YYYY'); + + ELSIF (v_resmask_cnt = 11) + THEN + IF (v_date_format IN ('YMD', 'MDY') AND v_culture NOT IN ('SV-SE', 'SV_SE')) + THEN + v_day := v_regmatch_groups[3]; + v_year := to_char(current_date, 'YYYY')::SMALLINT; + ELSE + v_day := '01'; + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN sys.babelfish_get_full_year(v_regmatch_groups[3])::SMALLINT - 43 + ELSE sys.babelfish_get_full_year(v_regmatch_groups[3], '', 29)::SMALLINT + END; + END IF; + + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[2], v_lang_metadata_json); + v_raw_year := sys.babelfish_get_full_year(substring(v_year::TEXT, 3, 2), '14'); + + ELSIF (v_resmask_cnt = 12) + THEN + v_day := '01'; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[3], v_lang_metadata_json); + v_raw_year := v_regmatch_groups[2]; + + ELSIF (v_resmask_cnt = 13) + THEN + v_day := '01'; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[2], v_lang_metadata_json); + v_raw_year := v_regmatch_groups[3]; + + ELSIF (v_resmask_cnt IN (14, 15, 16)) + THEN + IF (v_resmask_cnt = 14) + THEN + v_left_part := v_regmatch_groups[4]; + v_right_part := v_regmatch_groups[3]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[2], v_lang_metadata_json); + ELSIF (v_resmask_cnt = 15) + THEN + v_left_part := v_regmatch_groups[4]; + v_right_part := v_regmatch_groups[2]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[3], v_lang_metadata_json); + ELSE + v_left_part := v_regmatch_groups[3]; + v_right_part := v_regmatch_groups[2]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[4], v_lang_metadata_json); + END IF; + + IF (char_length(v_left_part) <= 2) + THEN + IF (v_date_format = 'YMD' AND v_culture NOT IN ('LV-LV', 'LV_LV')) + THEN + v_day := v_left_part; + v_raw_year := sys.babelfish_get_full_year(v_right_part, '14'); + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN sys.babelfish_get_full_year(v_right_part)::SMALLINT - 43 + ELSE sys.babelfish_get_full_year(v_right_part, '', 29)::SMALLINT + END; + BEGIN + v_res_date := make_date(v_year, v_month::SMALLINT, v_day::SMALLINT); + EXCEPTION + WHEN OTHERS THEN + v_day := v_right_part; + v_raw_year := sys.babelfish_get_full_year(v_left_part, '14'); + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN sys.babelfish_get_full_year(v_left_part)::SMALLINT - 43 + ELSE sys.babelfish_get_full_year(v_left_part, '', 29)::SMALLINT + END; + END; + END IF; + + IF (v_date_format IN ('MDY', 'DMY') OR v_culture IN ('LV-LV', 'LV_LV')) + THEN + v_day := v_right_part; + v_raw_year := sys.babelfish_get_full_year(v_left_part, '14'); + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN sys.babelfish_get_full_year(v_left_part)::SMALLINT - 43 + ELSE sys.babelfish_get_full_year(v_left_part, '', 29)::SMALLINT + END; + BEGIN + v_res_date := make_date(v_year, v_month::SMALLINT, v_day::SMALLINT); + EXCEPTION + WHEN OTHERS THEN + v_day := v_left_part; + v_raw_year := sys.babelfish_get_full_year(v_right_part, '14'); + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN sys.babelfish_get_full_year(v_right_part)::SMALLINT - 43 + ELSE sys.babelfish_get_full_year(v_right_part, '', 29)::SMALLINT + END; + END; + END IF; + ELSE + v_day := v_right_part; + v_raw_year := v_left_part; + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_left_part::SMALLINT - 543 + ELSE v_left_part::SMALLINT + END; + END IF; + + ELSIF (v_resmask_cnt = 17) + THEN + v_day := v_regmatch_groups[4]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[3], v_lang_metadata_json); + v_raw_year := v_regmatch_groups[2]; + + ELSIF (v_resmask_cnt = 18) + THEN + v_day := v_regmatch_groups[3]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[4], v_lang_metadata_json); + v_raw_year := v_regmatch_groups[2]; + + ELSIF (v_resmask_cnt = 19) + THEN + v_day := v_regmatch_groups[4]; + v_month := sys.babelfish_get_monthnum_by_name(v_regmatch_groups[2], v_lang_metadata_json); + v_raw_year := v_regmatch_groups[3]; + END IF; + + IF (v_resmask_cnt NOT IN (10, 11, 14, 15, 16)) + THEN + v_year := CASE + WHEN v_culture IN ('TH-TH', 'TH_TH') THEN v_raw_year::SMALLINT - 543 + ELSE v_raw_year::SMALLINT + END; + END IF; + + IF (v_culture IN ('AR', 'AR-SA', 'AR_SA')) + THEN + IF (v_day::SMALLINT > 30 OR + (v_resmask_cnt NOT IN (10, 11, 14, 15, 16) AND v_year NOT BETWEEN 1318 AND 1501) OR + (v_resmask_cnt IN (14, 15, 16) AND v_raw_year::SMALLINT NOT BETWEEN 1318 AND 1501)) + THEN + RAISE invalid_datetime_format; + END IF; + + v_hijridate := sys.babelfish_conv_hijri_to_greg(v_day, v_month, v_raw_year) - 1; + + v_day := to_char(v_hijridate, 'DD'); + v_month := to_char(v_hijridate, 'MM'); + v_year := to_char(v_hijridate, 'YYYY')::SMALLINT; + END IF; + END IF; + + v_resmask_cnt := v_resmask_cnt + 1; + END LOOP; + + IF (NOT v_found) THEN + RAISE invalid_datetime_format; + END IF; + + IF (char_length(v_timestring) > 0 AND v_timestring NOT IN ('AM', 'ص', 'PM', 'م')) + THEN + IF (v_culture = 'FI') THEN + v_timestring := PG_CATALOG.translate(v_timestring, '.,', ': '); + + IF (char_length(split_part(v_timestring, ':', 4)) > 0) THEN + v_timestring := regexp_replace(v_timestring, ':(?=\s*\d+\s*:?\s*(?:[AP]M|ص|م)?\s*$)', '.'); + END IF; + END IF; + + v_timestring := pg_catalog.replace(regexp_replace(v_timestring, '\.?[AP]M|ص|م|\s|\,|\.\D|[\.|:]$', '', 'gi'), ':.', ':'); + BEGIN + v_hours := coalesce(split_part(v_timestring, ':', 1)::SMALLINT, 0); + + IF ((v_dayparts[1] IN ('AM', 'ص') AND v_hours NOT BETWEEN 0 AND 12) OR + (v_dayparts[1] IN ('PM', 'م') AND v_hours NOT BETWEEN 1 AND 23)) + THEN + RAISE invalid_datetime_format; + ELSIF (v_dayparts[1] = 'PM' AND v_hours < 12) THEN + v_hours := v_hours + 12; + ELSIF (v_dayparts[1] = 'AM' AND v_hours = 12) THEN + v_hours := v_hours - 12; + END IF; + + v_minutes := coalesce(nullif(split_part(v_timestring, ':', 2), '')::SMALLINT, 0); + v_seconds := coalesce(nullif(split_part(v_timestring, ':', 3), ''), '0'); + + IF (v_seconds ~ '\.') THEN + v_fseconds := split_part(v_seconds, '.', 2); + v_seconds := split_part(v_seconds, '.', 1); + END IF; + EXCEPTION + WHEN OTHERS THEN + RAISE invalid_datetime_format; + END; + ELSIF (v_dayparts[1] IN ('PM', 'م')) + THEN + v_hours := 12; + END IF; + + BEGIN + IF (v_res_datatype IN ('DATETIME', 'SMALLDATETIME')) + THEN + v_res_datetime := sys.datetimefromparts(v_year, v_month::SMALLINT, v_day::SMALLINT, + v_hours, v_minutes, v_seconds::SMALLINT, + rpad(v_fseconds, 3, '0')::NUMERIC); + IF (v_res_datatype = 'SMALLDATETIME' AND + to_char(v_res_datetime, 'SS') <> '00') + THEN + IF (to_char(v_res_datetime, 'SS')::SMALLINT >= 30) THEN + v_res_datetime := v_res_datetime + INTERVAL '1 minute'; + END IF; + + v_res_datetime := to_timestamp(to_char(v_res_datetime, 'DD.MM.YYYY.HH24.MI'), 'DD.MM.YYYY.HH24.MI'); + END IF; + ELSE + v_fseconds := sys.babelfish_get_microsecs_from_fractsecs(rpad(v_fseconds, 9, '0'), v_scale); + v_seconds := concat_ws('.', v_seconds, v_fseconds); + + v_res_datetime := make_timestamp(v_year, v_month::SMALLINT, v_day::SMALLINT, + v_hours, v_minutes, v_seconds::NUMERIC); + END IF; + EXCEPTION + WHEN OTHERS THEN + GET STACKED DIAGNOSTICS v_err_message = MESSAGE_TEXT; + + IF (v_err_message ~* 'Cannot construct data type') THEN + RAISE invalid_datetime_format; + END IF; + END; + + IF (v_weekdaynames[1] IS NOT NULL) THEN + v_weekdaynum := sys.babelfish_get_weekdaynum_by_name(v_weekdaynames[1], v_lang_metadata_json); + + IF (CASE date_part('dow', v_res_date)::SMALLINT + WHEN 0 THEN 7 + ELSE date_part('dow', v_res_date)::SMALLINT + END <> v_weekdaynum) + THEN + RAISE invalid_datetime_format; + END IF; + END IF; + + RETURN v_res_datetime; +EXCEPTION + WHEN invalid_datetime_format OR datetime_field_overflow THEN + RAISE USING MESSAGE := pg_catalog.format('Error converting string value ''%s'' into data type %s using culture ''%s''.', + p_datetimestring, v_res_datatype, p_culture), + DETAIL := 'Incorrect using of pair of input parameters values during conversion process.', + HINT := 'Check the input parameters values, correct them if needed, and try again.'; + + WHEN datatype_mismatch THEN + RAISE USING MESSAGE := 'Data type should be one of these values: ''DATETIME'', ''SMALLDATETIME'', ''DATETIME2''/''DATETIME2(n)''.', + DETAIL := 'Use of incorrect "datatype" parameter value during conversion process.', + HINT := 'Change "datatype" parameter to the proper value and try again.'; + + WHEN invalid_indicator_parameter_value THEN + RAISE USING MESSAGE := pg_catalog.format('Invalid attributes specified for data type %s.', v_res_datatype), + DETAIL := 'Use of incorrect scale value, which is not corresponding to specified data type.', + HINT := 'Change data type scale component or select different data type and try again.'; + + WHEN interval_field_overflow THEN + RAISE USING MESSAGE := pg_catalog.format('Specified scale %s is invalid.', v_scale), + DETAIL := 'Use of incorrect data type scale value during conversion process.', + HINT := 'Change scale component of data type parameter to be in range [0..7] and try again.'; + + WHEN invalid_parameter_value THEN + RAISE USING MESSAGE := CASE char_length(coalesce(CONVERSION_LANG, '')) + WHEN 0 THEN pg_catalog.format('The culture parameter ''%s'' provided in the function call is not supported.', + p_culture) + ELSE pg_catalog.format('Invalid CONVERSION_LANG constant value - ''%s''. Allowed values are: ''English'', ''Deutsch'', etc.', + CONVERSION_LANG) + END, + DETAIL := 'Passed incorrect value for "p_culture" parameter or compiled incorrect CONVERSION_LANG constant value in function''s body.', + HINT := 'Check "p_culture" input parameter value, correct it if needed, and try again. Also check CONVERSION_LANG constant value.'; + + WHEN invalid_text_representation THEN + GET STACKED DIAGNOSTICS v_err_message = MESSAGE_TEXT; + v_err_message := substring(pg_catalog.lower(v_err_message), 'integer\:\s\"(.*)\"'); + + RAISE USING MESSAGE := pg_catalog.format('Error while trying to convert "%s" value to SMALLINT data type.', + v_err_message), + DETAIL := 'Supplied value contains illegal characters.', + HINT := 'Correct supplied value, remove all illegal characters.'; +END; +$BODY$ +LANGUAGE plpgsql +STABLE +RETURNS NULL ON NULL INPUT; + +-- wrapper functions for upper -- +-- Function to handle datatypes which are implicitly convertable to VARCHAR +CREATE OR REPLACE FUNCTION sys.upper(ANYELEMENT) +RETURNS sys.VARCHAR +AS $$ +DECLARE + type_oid oid; + typ_base_oid oid; + typnam text; +BEGIN + typnam := NULL; + type_oid := pg_typeof($1); + typnam := sys.translate_pg_type_to_tsql(type_oid); + IF typnam IS NULL THEN + typ_base_oid := sys.bbf_get_immediate_base_type_of_UDT(type_oid); + typnam := sys.translate_pg_type_to_tsql(typ_base_oid); + END IF; + IF typnam IN ('image', 'sql_variant', 'xml', 'geometry', 'geography') THEN + RAISE EXCEPTION 'Argument data type % is invalid for argument 1 of upper function.', typnam; + END IF; + IF $1 IS NULL THEN + RETURN NULL; + END IF; + -- Call the underlying function after preprocessing + RETURN pg_catalog.upper($1::sys.varchar); +END; +$$ LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +-- Function to handle NCHAR because of return type NVARCHAR +CREATE OR REPLACE FUNCTION sys.upper(sys.NCHAR) +RETURNS sys.NVARCHAR +AS $$ +BEGIN + RETURN pg_catalog.upper($1); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Function to handle NVARCHAR because of return type NVARCHAR +CREATE OR REPLACE FUNCTION sys.upper(sys.NVARCHAR) +RETURNS sys.NVARCHAR +AS $$ +BEGIN + RETURN pg_catalog.upper($1); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Function to handle TEXT because of return type VARCHAR +CREATE OR REPLACE FUNCTION sys.upper(TEXT) +RETURNS sys.VARCHAR +AS $$ +BEGIN + RETURN pg_catalog.upper($1); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Function to handle NTEXT because of return type VARCHAR +CREATE OR REPLACE FUNCTION sys.upper(NTEXT) +RETURNS sys.NVARCHAR +AS $$ +BEGIN + RETURN pg_catalog.upper($1); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- wrapper functions for lower -- +-- Function to handle datatypes which are implicitly convertable to VARCHAR +CREATE OR REPLACE FUNCTION sys.lower(ANYELEMENT) +RETURNS sys.VARCHAR +AS $$ +DECLARE + type_oid oid; + typ_base_oid oid; + typnam text; +BEGIN + typnam := NULL; + type_oid := pg_typeof($1); + typnam := sys.translate_pg_type_to_tsql(type_oid); + IF typnam IS NULL THEN + typ_base_oid := sys.bbf_get_immediate_base_type_of_UDT(type_oid); + typnam := sys.translate_pg_type_to_tsql(typ_base_oid); + END IF; + IF typnam IN ('image', 'sql_variant', 'xml', 'geometry', 'geography') THEN + RAISE EXCEPTION 'Argument data type % is invalid for argument 1 of lower function.', typnam; + END IF; + IF $1 IS NULL THEN + RETURN NULL; + END IF; + -- Call the underlying function after preprocessing + RETURN pg_catalog.lower($1::sys.varchar); +END; +$$ LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +-- Function to handle NCHAR because of return type NVARCHAR +CREATE OR REPLACE FUNCTION sys.lower(sys.NCHAR) +RETURNS sys.NVARCHAR +AS $$ +BEGIN + RETURN pg_catalog.lower($1); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Function to handle NVARCHAR because of return type NVARCHAR +CREATE OR REPLACE FUNCTION sys.lower(sys.NVARCHAR) +RETURNS sys.NVARCHAR +AS $$ +BEGIN + RETURN pg_catalog.lower($1); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Function to handle TEXT because of return type VARCHAR +CREATE OR REPLACE FUNCTION sys.lower(TEXT) +RETURNS sys.VARCHAR +AS $$ +BEGIN + RETURN pg_catalog.lower($1); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +-- Function to handle NTEXT because of return type VARCHAR +CREATE OR REPLACE FUNCTION sys.lower(NTEXT) +RETURNS sys.NVARCHAR +AS $$ +BEGIN + RETURN pg_catalog.lower($1); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.search_partition(IN func_name sys.NVARCHAR(128), IN arg anyelement, IN db_name sys.NVARCHAR(128) DEFAULT NULL) +RETURNS INTEGER AS +'babelfishpg_tsql', 'search_partition' +LANGUAGE C STABLE; + +-- Duplicate function with arg TEXT since ANYELEMNT cannot handle constant NULL and string literal (unknown type). +CREATE OR REPLACE FUNCTION sys.search_partition(IN func_name sys.NVARCHAR(128), IN arg text, IN db_name sys.NVARCHAR(128) DEFAULT NULL) +RETURNS INTEGER AS +'babelfishpg_tsql', 'search_partition' +LANGUAGE C STABLE; + + +CREATE OR REPLACE VIEW sys.destination_data_spaces as +SELECT + ps.scheme_id as partition_scheme_id, + cast(s.n as int) as destination_id, + cast(1 as int) as data_space_id -- primary filegroup +FROM + sys.babelfish_partition_scheme ps +INNER JOIN + sys.partition_functions pf ON pf.name = ps.partition_function_name +CROSS JOIN + generate_series(1, pf.fanout + cast(ps.next_used as int)) s(n) +WHERE + ps.dbid = sys.db_id(); +GRANT SELECT ON sys.destination_data_spaces TO PUBLIC; + + +ALTER VIEW sys.data_spaces RENAME TO sys_data_spaces_deprecated_4_3_0; + +CREATE OR REPLACE VIEW sys.data_spaces +AS +-- entry for [PRIMARY] filegroup +SELECT + CAST('PRIMARY' as sys.NVARCHAR(128)) AS name, + CAST(1 as INT) AS data_space_id, + CAST('FG' as sys.bpchar(2)) AS type, + CAST('ROWS_FILEGROUP' as sys.NVARCHAR(60)) AS type_desc, + CAST(1 as sys.BIT) AS is_default, + CAST(0 as sys.BIT) AS is_system +UNION ALL +-- entries for Partition Schemes +SELECT + name, + data_space_id, + type, + type_desc, + is_default, + is_system +FROM sys.partition_schemes; +GRANT SELECT ON sys.data_spaces TO PUBLIC; + +ALTER VIEW sys.filegroups RENAME TO sys_filegroups_deprecated_4_3_0; + +CREATE OR REPLACE VIEW sys.filegroups +AS +SELECT + CAST(ds.name AS sys.NVARCHAR(128)), + CAST(ds.data_space_id AS INT), + CAST(ds.type AS sys.BPCHAR(2)) COLLATE sys.database_default, + CAST(ds.type_desc AS sys.NVARCHAR(60)), + CAST(ds.is_default AS sys.BIT), + CAST(ds.is_system AS sys.BIT), + CAST(NULL as sys.UNIQUEIDENTIFIER) AS filegroup_guid, + CAST(0 as INT) AS log_filegroup_id, + CAST(0 as sys.BIT) AS is_read_only, + CAST(0 as sys.BIT) AS is_autogrow_all_files +FROM sys.data_spaces ds WHERE type = 'FG'; +GRANT SELECT ON sys.filegroups TO PUBLIC; + +ALTER VIEW sys.partitions RENAME TO sys_partitions_deprecated_4_3_0; + +-- Note that: sys.partitions also list the entries for non-partitioned +-- tables/indexes apart from partitioned tables/indexes +CREATE OR REPLACE VIEW sys.partitions AS +with index_id_map as MATERIALIZED( + select + *, + case + when indisclustered then 1 + else 1+row_number() over(partition by indrelid order by indexrelid) + end as index_id + from pg_index +), +tt_internal as MATERIALIZED +( + select * from sys.table_types_internal +) +-- entries for non-partitioned tables +SELECT + CAST(t.oid as sys.BIGINT) as partition_id, + CAST(t.oid as int) as object_id, + CAST(0 as int) as index_id, + CAST(1 as int) as partition_number, + CAST(0 as sys.bigint) AS hobt_id, + CAST(case when t.reltuples = -1 then 0 else t.reltuples end as sys.bigint) AS rows, + CAST(0 as smallint) as filestream_filegroup_id, + CAST(0 as sys.tinyint) as data_compression, + CAST('NONE' as sys.nvarchar(60)) as data_compression_desc, + CAST(0 as sys.bit) as xml_compression, + CAST('OFF' as sys.varchar(3)) as xml_compression_desc +FROM pg_class t +INNER JOIN pg_namespace nsp on t.relnamespace = nsp.oid +INNER JOIN sys.babelfish_namespace_ext ext on (nsp.nspname = ext.nspname and ext.dbid = sys.db_id()) +LEFT JOIN tt_internal tt on t.oid = tt.typrelid +WHERE tt.typrelid is null +AND t.relkind = 'r' +AND t.relispartition = false +AND has_schema_privilege(t.relnamespace, 'USAGE') +AND has_table_privilege(t.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') + +UNION ALL +-- entries for non-partitioned indexes +SELECT + CAST(idx.indexrelid as sys.BIGINT) as partition_id, + CAST(idx.indrelid as int) as object_id, + CAST(imap.index_id as int) as index_id, + CAST(1 as int) as partition_number, + CAST(0 as sys.bigint) AS hobt_id, + CAST(case when t.reltuples = -1 then 0 else t.reltuples end as sys.bigint) AS rows, + CAST(0 as smallint) as filestream_filegroup_id, + CAST(0 as sys.tinyint) as data_compression, + CAST('NONE' as sys.nvarchar(60)) as data_compression_desc, + CAST(0 as sys.bit) as xml_compression, + CAST('OFF' as sys.varchar(3)) as xml_compression_desc +FROM pg_index idx +INNER JOIN index_id_map imap on imap.indexrelid = idx.indexrelid +INNER JOIN pg_class t on t.oid = idx.indrelid and t.relkind = 'r' and t.relispartition = false +INNER JOIN pg_namespace nsp on t.relnamespace = nsp.oid +INNER JOIN sys.babelfish_namespace_ext ext on (nsp.nspname = ext.nspname and ext.dbid = sys.db_id()) +where idx.indislive +and has_schema_privilege(t.relnamespace, 'USAGE') + +UNION ALL +-- entries for partitions of partitioned tables +SELECT + CAST(pgi.inhrelid as sys.BIGINT) as partition_id, + CAST(pgi.inhparent as int) as object_id, + CAST(0 as int) as index_id, + CAST(row_number() over(partition by pgi.inhparent order by ctbl.relname) as int) as partition_number, + CAST(0 as sys.bigint) AS hobt_id, + CAST(case when ctbl.reltuples = -1 then 0 else ctbl.reltuples end as sys.bigint) AS rows, + CAST(0 as smallint) as filestream_filegroup_id, + CAST(0 as sys.tinyint) as data_compression, + CAST('NONE' as sys.nvarchar(60)) as data_compression_desc, + CAST(0 as sys.bit) as xml_compression, + CAST('OFF' as sys.varchar(3)) as xml_compression_desc +FROM pg_inherits pgi +INNER JOIN pg_class ctbl on (ctbl.oid = pgi.inhrelid and ctbl.relkind = 'r' and ctbl.relispartition) +INNER JOIN pg_namespace nsp on ctbl.relnamespace = nsp.oid +INNER JOIN sys.babelfish_namespace_ext ext on (nsp.nspname = ext.nspname and ext.dbid = sys.db_id()) +WHERE has_schema_privilege(ctbl.relnamespace, 'USAGE') +AND has_table_privilege(ctbl.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') + +UNION ALL +-- entries for partitions of partitioned indexes +SELECT + CAST(pgi.inhrelid as sys.BIGINT) as partition_id, + CAST(pidx.indrelid as int) as object_id, + CAST(cidx.index_id as int) as index_id, + CAST(row_number() over(partition by pgi.inhparent order by ctbl.relname) as int) as partition_number, + CAST(0 as sys.bigint) AS hobt_id, + CAST(case when ctbl.reltuples = -1 then 0 else ctbl.reltuples end as sys.bigint) AS rows, + CAST(0 as smallint) as filestream_filegroup_id, + CAST(0 as sys.tinyint) as data_compression, + CAST('NONE' as sys.nvarchar(60)) as data_compression_desc, + CAST(0 as sys.bit) as xml_compression, + CAST('OFF' as sys.varchar(3)) as xml_compression_desc +FROM pg_inherits pgi +INNER JOIN index_id_map cidx on cidx.indexrelid = pgi.inhrelid +INNER JOIN index_id_map pidx on pidx.indexrelid = pgi.inhparent +INNER JOIN pg_class ctbl on (ctbl.oid = cidx.indrelid and ctbl.relkind = 'r' and ctbl.relispartition) +INNER JOIN pg_namespace nsp on ctbl.relnamespace = nsp.oid +INNER JOIN sys.babelfish_namespace_ext ext on (nsp.nspname = ext.nspname and ext.dbid = sys.db_id()) +WHERE cidx.indislive +AND has_schema_privilege(ctbl.relnamespace, 'USAGE'); +GRANT SELECT ON sys.partitions TO PUBLIC; + +CALL sys.babelfish_drop_deprecated_object('view', 'sys', 'sys_partitions_deprecated_4_3_0'); +CALL sys.babelfish_drop_deprecated_object('view', 'sys', 'sys_filegroups_deprecated_4_3_0'); +CALL sys.babelfish_drop_deprecated_object('view', 'sys', 'sys_data_spaces_deprecated_4_3_0'); + + +CREATE OR REPLACE FUNCTION sys.translate(string sys.VARCHAR, characters sys.VARCHAR, translations sys.VARCHAR) +RETURNS sys.VARCHAR +AS $$ +BEGIN + IF length(characters) != length(translations) THEN + RAISE EXCEPTION 'The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.'; + END IF; + + RETURN PG_CATALOG.TRANSLATE(string, characters, translations); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.translate(string sys.NVARCHAR, characters sys.VARCHAR, translations sys.VARCHAR) +RETURNS sys.NVARCHAR +AS $$ +BEGIN + IF length(characters) != length(translations) THEN + RAISE EXCEPTION 'The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.'; + END IF; + + RETURN PG_CATALOG.TRANSLATE(string, characters, translations); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.substring(string TEXT, i INTEGER, j INTEGER) +RETURNS sys.VARCHAR +AS 'babelfishpg_tsql', 'tsql_varchar_substr' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.substring(string NTEXT, i INTEGER, j INTEGER) +RETURNS sys.NVARCHAR +AS 'babelfishpg_tsql', 'tsql_varchar_substr' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.substring(string sys.VARCHAR, i INTEGER, j INTEGER) +RETURNS sys.VARCHAR +AS 'babelfishpg_tsql', 'tsql_varchar_substr' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.substring(string sys.BPCHAR, i INTEGER, j INTEGER) +RETURNS sys.VARCHAR +AS 'babelfishpg_tsql', 'tsql_varchar_substr' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.substring(string sys.NVARCHAR, i INTEGER, j INTEGER) +RETURNS sys.NVARCHAR +AS 'babelfishpg_tsql', 'tsql_varchar_substr' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.substring(string sys.NCHAR, i INTEGER, j INTEGER) +RETURNS sys.NVARCHAR +AS 'babelfishpg_tsql', 'tsql_varchar_substr' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.substring(string sys.VARBINARY, i INTEGER, j INTEGER) +RETURNS sys.VARBINARY +AS 'babelfishpg_tsql', 'tsql_varbinary_substr' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.substring(string ANYELEMENT, i INTEGER, j INTEGER) +RETURNS sys.VARBINARY +AS +$BODY$ +DECLARE + type_oid oid; + string_arg_datatype text; + string_basetype oid; +BEGIN + type_oid := pg_typeof(string); + string_arg_datatype := sys.translate_pg_type_to_tsql(type_oid); + IF string_arg_datatype IS NULL THEN + -- for User Defined Datatype, use immediate base type to check for argument datatype validation + string_basetype := sys.bbf_get_immediate_base_type_of_UDT(type_oid); + string_arg_datatype := sys.translate_pg_type_to_tsql(string_basetype); + END IF; + -- restricting arguments with invalid datatypes for substring function + IF string_arg_datatype NOT IN ('binary', 'image') THEN + RAISE EXCEPTION 'Argument data type % is invalid for argument 1 of substring function.', string_arg_datatype; + END IF; + RETURN sys.substring(string::sys.VARBINARY, i, j); +END; +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + +CREATE OR REPLACE FUNCTION sys.space(IN number INTEGER, OUT result SYS.VARCHAR) AS $$ +BEGIN + IF number < 0 THEN + result := NULL; + ELSE + -- TSQL has a limitation of 8000 character spaces for space function. + result := PG_CATALOG.repeat(' ',least(number, 8000)); + END IF; +END; +$$ +STRICT +LANGUAGE plpgsql; + +DO $$ +DECLARE + exception_message text; +BEGIN + ALTER FUNCTION sys.stuff(TEXT, INTEGER, INTEGER, TEXT) RENAME TO stuff_deprecated_4_3; + ALTER FUNCTION sys.stuff(ANYELEMENT, INTEGER, INTEGER, ANYELEMENT) RENAME TO stuff_any_deprecated_4_3; + + CREATE OR REPLACE FUNCTION sys.stuff(expr sys.VARBINARY, start INTEGER, length INTEGER, replace_expr sys.VARCHAR) + RETURNS sys.VARBINARY + AS + $BODY$ + BEGIN + IF start IS NULL OR expr IS NULL OR length IS NULL THEN + RETURN NULL; + END IF; + IF start <= 0 OR start > sys.len(expr) OR length < 0 THEN + RETURN NULL; + END IF; + IF replace_expr IS NULL THEN + RETURN (SELECT (overlay (expr::sys.VARCHAR placing '' from start for length))::sys.VARCHAR)::sys.VARBINARY; + END IF; + RETURN (SELECT (overlay (expr::sys.VARCHAR placing replace_expr::sys.VARCHAR from start for length))::sys.VARCHAR)::sys.VARBINARY; + END; + $BODY$ + LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + + CREATE OR REPLACE FUNCTION sys.stuff(expr sys.VARCHAR, start INTEGER, length INTEGER, replace_expr sys.VARCHAR) + RETURNS sys.VARCHAR + AS + $BODY$ + BEGIN + IF start IS NULL OR expr IS NULL OR length IS NULL THEN + RETURN NULL; + END IF; + IF start <= 0 OR start > length(expr) OR length < 0 THEN + RETURN NULL; + END IF; + IF replace_expr IS NULL THEN + RETURN (SELECT overlay (expr placing '' from start for length)); + END IF; + RETURN (SELECT overlay (expr placing replace_expr from start for length)); + END; + $BODY$ + LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + + CREATE OR REPLACE FUNCTION sys.stuff(expr sys.NVARCHAR, start INTEGER, length INTEGER, replace_expr sys.NVARCHAR) + RETURNS sys.NVARCHAR + AS + $BODY$ + BEGIN + IF start IS NULL OR expr IS NULL OR length IS NULL THEN + RETURN NULL; + END IF; + IF start <= 0 OR start > length(expr) OR length < 0 THEN + RETURN NULL; + END IF; + IF replace_expr IS NULL THEN + RETURN (SELECT overlay (expr placing '' from start for length)); + END IF; + RETURN (SELECT overlay (expr placing replace_expr from start for length)); + END; + $BODY$ + LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE; + + CALL sys.babelfish_drop_deprecated_object('function', 'sys', 'stuff_deprecated_4_3'); + CALL sys.babelfish_drop_deprecated_object('function', 'sys', 'stuff_any_deprecated_4_3'); + +EXCEPTION WHEN OTHERS THEN + GET STACKED DIAGNOSTICS + exception_message = MESSAGE_TEXT; + RAISE WARNING '%', exception_message; +END; +$$; + +-- Rename functions for dependencies +DO $$ +DECLARE + exception_message text; +BEGIN + -- Rename replace for dependencies + ALTER FUNCTION sys.replace(TEXT, TEXT, TEXT) RENAME TO replace_deprecated_in_3_7_0_0; + +EXCEPTION WHEN OTHERS THEN + GET STACKED DIAGNOSTICS + exception_message = MESSAGE_TEXT; + RAISE WARNING '%', exception_message; +END; +$$; + +CREATE OR REPLACE FUNCTION sys.replace (input_string sys.VARCHAR, pattern sys.VARCHAR, replacement sys.VARCHAR) +RETURNS sys.VARCHAR AS +$BODY$ +BEGIN + if PG_CATALOG.length(pattern) = 0 then + return input_string; + elsif sys.is_collated_ai(input_string) then + return pg_catalog.replace(input_string, pattern, replacement); + elsif sys.is_collated_ci_as(input_string) then + return regexp_replace(input_string, '***=' || pattern, replacement, 'ig'); + else + return regexp_replace(input_string, '***=' || pattern, replacement, 'g'); + end if; +END +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE STRICT; + +CREATE OR REPLACE FUNCTION sys.replace (input_string sys.NVARCHAR, pattern sys.NVARCHAR, replacement sys.NVARCHAR) +RETURNS sys.NVARCHAR AS +$BODY$ +BEGIN + if PG_CATALOG.length(pattern) = 0 then + return input_string; + elsif sys.is_collated_ai(input_string) then + return pg_catalog.replace(input_string, pattern, replacement); + elsif sys.is_collated_ci_as(input_string) then + return regexp_replace(input_string, '***=' || pattern, replacement, 'ig'); + else + return regexp_replace(input_string, '***=' || pattern, replacement, 'g'); + end if; +END +$BODY$ +LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE STRICT; + +CREATE OR REPLACE PROCEDURE sys.sp_babelfish_autoformat( + IN "@tab" sys.VARCHAR(257) DEFAULT NULL, + IN "@orderby" sys.VARCHAR(1000) DEFAULT '', + IN "@printrc" sys.bit DEFAULT 1, + IN "@hiddencols" sys.VARCHAR(1000) DEFAULT NULL) +LANGUAGE 'pltsql' +AS $$ +BEGIN + SET NOCOUNT ON + DECLARE @rc INT + DECLARE @id INT + DECLARE @objtype sys.VARCHAR(2) + DECLARE @msg sys.VARCHAR(200) + + IF @tab IS NULL + BEGIN + RAISERROR('Must specify table name', 16, 1) + RETURN + END + + IF TRIM(@tab) = '' + BEGIN + RAISERROR('Must specify table name', 16, 1) + RETURN + END + + -- Since we cannot find #tmp tables in the Babelfish catalogs, we cannot check + -- their existence other than by trying to select from them + -- Function sys.babelfish_get_enr_list() could be used to determine if a #tmp table + -- exists but the columns and datatypes can still not be retrieved, it would be of + -- little use here. + -- NB: not handling uncommon but valid T-SQL syntax '.#tmp' for #tmp tables + IF sys.SUBSTRING(@tab,1,1) <> '#' + BEGIN + SET @id = sys.OBJECT_ID(@tab) + IF @id IS NULL + BEGIN + IF sys.SUBSTRING(UPPER(@tab),1,4) = 'DBO.' + BEGIN + SET @id = sys.OBJECT_ID('SYS.' + sys.SUBSTRING(@tab,5)) + END + IF @id IS NULL + BEGIN + SET @msg = 'Table or view '''+@tab+''' not found' + RAISERROR(@msg, 16, 1) + RETURN + END + END + END + + SELECT @objtype = type COLLATE DATABASE_DEFAULT FROM sys.sysobjects WHERE id = @id + IF @objtype NOT IN ('U', 'S', 'V') + BEGIN + SET @msg = ''''+@tab+''' is not a table or view' + RAISERROR(@msg, 16, 1) + RETURN + END + + -- check for 'ORDER BY', if specified + SET @orderby = TRIM(@orderby) + IF @orderby <> '' + BEGIN + IF UPPER(@orderby) NOT LIKE 'ORDER BY%' + BEGIN + RAISERROR('@orderby parameter must start with ''ORDER BY''', 16, 1) + RETURN + END + END + + -- columns to hide in final client output + -- assuming delimited column names do not contain spaces or commas inside the name + -- remove any spaces around the commas: + WHILE (sys.CHARINDEX(' ,', @hiddencols) > 0) or (sys.CHARINDEX(', ', @hiddencols) > 0) + BEGIN + SET @hiddencols = sys.REPLACE(@hiddencols, ' ,', ',') + SET @hiddencols = sys.REPLACE(@hiddencols, ', ', ',') + END + IF sys.LEN(@hiddencols) IS NOT NULL SET @hiddencols = ',' + @hiddencols + ',' + SET @hiddencols = UPPER(@hiddencols) + + -- Need to use a guaranteed-uniquely named table as intermediate step since we cannot + -- access the metadata in case a #tmp table is passed as argument + -- But when we copy the #tmp table into another table, we get all the attributes and metadata + DECLARE @tmptab sys.VARCHAR(63) = 'sp_babelfish_autoformat' + sys.REPLACE(CAST(NEWID() AS sys.NVARCHAR(36)), '-', '') + DECLARE @tmptab2 sys.VARCHAR(63) = 'sp_babelfish_autoformat' + sys.REPLACE(CAST(NEWID() AS sys.NVARCHAR(36)), '-', '') + DECLARE @cmd sys.VARCHAR(1000) = 'SELECT * INTO ' + @tmptab + ' FROM ' + @tab + + BEGIN TRY + -- create the first work table + EXECUTE(@cmd) + + -- Get the columns + SELECT + c.name AS colname, c.colid AS colid, t.name AS basetype, 0 AS maxlen + INTO #sp_bbf_autoformat + FROM sys.syscolumns c left join sys.systypes t + ON c.xusertype = t.xusertype + WHERE c.id = sys.OBJECT_ID(@tmptab) + ORDER BY c.colid + + -- Get max length for each column based on the data + DECLARE @colname sys.VARCHAR(63), @basetype sys.VARCHAR(63), @maxlen int + DECLARE c CURSOR FOR SELECT colname, basetype, maxlen FROM #sp_bbf_autoformat ORDER BY colid + OPEN c + WHILE 1=1 + BEGIN + FETCH c INTO @colname, @basetype, @maxlen + IF @@fetch_status <> 0 BREAK + SET @cmd = 'DECLARE @i INT SELECT @i=ISNULL(MAX(sys.LEN(CAST([' + @colname + '] AS sys.VARCHAR(500)))),4) FROM ' + @tmptab + ' UPDATE #sp_bbf_autoformat SET maxlen = @i WHERE colname = ''' + @colname + '''' + EXECUTE(@cmd) + END + CLOSE c + DEALLOCATE c + + -- Generate the final SELECT + DECLARE @selectlist sys.VARCHAR(8000) = '' + DECLARE @collist sys.VARCHAR(8000) = '' + DECLARE @fmtstart sys.VARCHAR(30) = '' + DECLARE @fmtend sys.VARCHAR(30) = '' + OPEN c + WHILE 1=1 + BEGIN + FETCH c INTO @colname, @basetype, @maxlen + IF @@fetch_status <> 0 BREAK + IF sys.LEN(@colname) > @maxlen SET @maxlen = sys.LEN(@colname) + IF @maxlen <= 0 SET @maxlen = 1 + + IF (sys.CHARINDEX(',' + UPPER(@colname) + ',', @hiddencols) > 0) OR (sys.CHARINDEX(',[' + UPPER(@colname) + '],', @hiddencols) > 0) + BEGIN + SET @selectlist += ' [' + @colname + '],' + END + ELSE + BEGIN + SET @fmtstart = '' + SET @fmtend = '' + IF @basetype IN ('tinyint', 'smallint', 'int', 'bigint', 'decimal', 'numeric', 'real', 'float') + BEGIN + SET @fmtstart = 'CAST(right(space('+CAST(@maxlen AS sys.VARCHAR)+')+' + SET @fmtend = ','+CAST(@maxlen AS sys.VARCHAR)+') AS sys.VARCHAR(' + CAST(@maxlen AS sys.VARCHAR) + '))' + END + + SET @selectlist += ' '+@fmtstart+'CAST([' + @colname + '] AS sys.VARCHAR(' + CAST(@maxlen AS sys.VARCHAR) + '))'+@fmtend+' AS [' + @colname + '],' + SET @collist += '['+@colname + '],' + END + END + CLOSE c + DEALLOCATE c + + -- Remove redundant commas + SET @collist = sys.SUBSTRING(@collist, 1, sys.LEN(@collist)-1) + SET @selectlist = sys.SUBSTRING(@selectlist, 1, sys.LEN(@selectlist)-1) + SET @selectlist = 'SELECT ' + @selectlist + ' INTO ' + @tmptab2 + ' FROM ' + @tmptab + ' ' + @orderby + + -- create the second work table + EXECUTE(@selectlist) + + -- perform the final SELECT to generate the result set for the client + EXECUTE('SELECT ' + @collist + ' FROM ' + @tmptab2) + + -- PRINT rowcount if desired + SET @rc = @@rowcount + IF @printrc = 1 + BEGIN + PRINT ' ' + SET @cmd = '(' + CAST(@rc AS sys.VARCHAR) + ' rows affected)' + PRINT @cmd + END + + -- Cleanup: these work tables are permanent tables after all + EXECUTE('DROP TABLE IF EXISTS ' + @tmptab) + EXECUTE('DROP TABLE IF EXISTS ' + @tmptab2) + END TRY + BEGIN CATCH + -- Cleanup in case of an unexpected error + EXECUTE('DROP TABLE IF EXISTS ' + @tmptab) + EXECUTE('DROP TABLE IF EXISTS ' + @tmptab2) + END CATCH + + RETURN +END +$$; +GRANT EXECUTE ON PROCEDURE sys.sp_babelfish_autoformat(IN sys.VARCHAR(257), IN sys.VARCHAR(1000), sys.bit, sys.VARCHAR(1000)) TO PUBLIC; + +-- DROP deprecated function of replace (if exists) +DO $$ +DECLARE + exception_message text; +BEGIN + -- DROP replace_deprecated_in_3_7_0_0 + CALL sys.babelfish_drop_deprecated_object('function', 'sys', 'replace_deprecated_in_3_7_0_0'); + +EXCEPTION WHEN OTHERS THEN + GET STACKED DIAGNOSTICS + exception_message = MESSAGE_TEXT; + RAISE WARNING '%', exception_message; +END; +$$; + +CREATE OR REPLACE VIEW sys.triggers +AS +SELECT + CAST(p.proname as sys.sysname) as name, + CAST(tr.oid as int) as object_id, + CAST(1 as sys.tinyint) as parent_class, + CAST('OBJECT_OR_COLUMN' as sys.nvarchar(60)) AS parent_class_desc, + CAST(tr.tgrelid as int) AS parent_id, + CAST('TR' as sys.bpchar(2)) AS type, + CAST('SQL_TRIGGER' as sys.nvarchar(60)) AS type_desc, + CAST(f.create_date as sys.datetime) AS create_date, + CAST(f.create_date as sys.datetime) AS modify_date, + CAST(0 as sys.bit) AS is_ms_shipped, + CAST( + CASE WHEN tr.tgenabled = 'D' + THEN 1 + ELSE 0 + END + AS sys.bit + ) AS is_disabled, + CAST(0 as sys.bit) AS is_not_for_replication, + CAST(get_bit(CAST(CAST(tr.tgtype as int) as bit(7)),0) as sys.bit) AS is_instead_of_trigger +FROM pg_proc p +inner join sys.schemas sch on sch.schema_id = p.pronamespace +left join pg_trigger tr on tr.tgfoid = p.oid +left join sys.babelfish_function_ext f on p.proname = f.funcname and sch.schema_id::regnamespace::name = f.nspname +and sys.babelfish_get_pltsql_function_signature(p.oid) = f.funcsignature collate "C" +where has_schema_privilege(sch.schema_id, 'USAGE') +and has_function_privilege(p.oid, 'EXECUTE') +and p.prokind = 'f' +and format_type(p.prorettype, null) = 'trigger'; +GRANT SELECT ON sys.triggers TO PUBLIC; + +create or replace view sys.objects as +select + CAST(t.name as sys.sysname) as name + , CAST(t.object_id as int) as object_id + , CAST(t.principal_id as int) as principal_id + , CAST(t.schema_id as int) as schema_id + , CAST(t.parent_object_id as int) as parent_object_id + , CAST('U' as char(2)) as type + , CAST('USER_TABLE' as sys.nvarchar(60)) as type_desc + , CAST(t.create_date as sys.datetime) as create_date + , CAST(t.modify_date as sys.datetime) as modify_date + , CAST(t.is_ms_shipped as sys.bit) as is_ms_shipped + , CAST(t.is_published as sys.bit) as is_published + , CAST(t.is_schema_published as sys.bit) as is_schema_published +from sys.tables t +union all +select + CAST(v.name as sys.sysname) as name + , CAST(v.object_id as int) as object_id + , CAST(v.principal_id as int) as principal_id + , CAST(v.schema_id as int) as schema_id + , CAST(v.parent_object_id as int) as parent_object_id + , CAST('V' as char(2)) as type + , CAST('VIEW' as sys.nvarchar(60)) as type_desc + , CAST(v.create_date as sys.datetime) as create_date + , CAST(v.modify_date as sys.datetime) as modify_date + , CAST(v.is_ms_shipped as sys.bit) as is_ms_shipped + , CAST(v.is_published as sys.bit) as is_published + , CAST(v.is_schema_published as sys.bit) as is_schema_published +from sys.views v +union all +select + CAST(f.name as sys.sysname) as name + , CAST(f.object_id as int) as object_id + , CAST(f.principal_id as int) as principal_id + , CAST(f.schema_id as int) as schema_id + , CAST(f.parent_object_id as int) as parent_object_id + , CAST('F' as char(2)) as type + , CAST('FOREIGN_KEY_CONSTRAINT' as sys.nvarchar(60)) as type_desc + , CAST(f.create_date as sys.datetime) as create_date + , CAST(f.modify_date as sys.datetime) as modify_date + , CAST(f.is_ms_shipped as sys.bit) as is_ms_shipped + , CAST(f.is_published as sys.bit) as is_published + , CAST(f.is_schema_published as sys.bit) as is_schema_published + from sys.foreign_keys f +union all +select + CAST(p.name as sys.sysname) as name + , CAST(p.object_id as int) as object_id + , CAST(p.principal_id as int) as principal_id + , CAST(p.schema_id as int) as schema_id + , CAST(p.parent_object_id as int) as parent_object_id + , CAST('PK' as char(2)) as type + , CAST('PRIMARY_KEY_CONSTRAINT' as sys.nvarchar(60)) as type_desc + , CAST(p.create_date as sys.datetime) as create_date + , CAST(p.modify_date as sys.datetime) as modify_date + , CAST(p.is_ms_shipped as sys.bit) as is_ms_shipped + , CAST(p.is_published as sys.bit) as is_published + , CAST(p.is_schema_published as sys.bit) as is_schema_published +from sys.key_constraints p +where p.type = 'PK' +union all +select + CAST(pr.name as sys.sysname) as name + , CAST(pr.object_id as int) as object_id + , CAST(pr.principal_id as int) as principal_id + , CAST(pr.schema_id as int) as schema_id + , CAST(pr.parent_object_id as int) as parent_object_id + , CAST(pr.type as char(2)) as type + , CAST(pr.type_desc as sys.nvarchar(60)) as type_desc + , CAST(pr.create_date as sys.datetime) as create_date + , CAST(pr.modify_date as sys.datetime) as modify_date + , CAST(pr.is_ms_shipped as sys.bit) as is_ms_shipped + , CAST(pr.is_published as sys.bit) as is_published + , CAST(pr.is_schema_published as sys.bit) as is_schema_published + from sys.procedures pr +union all +select + CAST(tr.name as sys.sysname) as name + , CAST(tr.object_id as int) as object_id + , CAST(NULL as int) as principal_id + , CAST(p.relnamespace as int) as schema_id + , CAST(tr.parent_id as int) as parent_object_id + , CAST(tr.type as char(2)) as type + , CAST(tr.type_desc as sys.nvarchar(60)) as type_desc + , CAST(tr.create_date as sys.datetime) as create_date + , CAST(tr.modify_date as sys.datetime) as modify_date + , CAST(tr.is_ms_shipped as sys.bit) as is_ms_shipped + , CAST(0 as sys.bit) as is_published + , CAST(0 as sys.bit) as is_schema_published + from sys.triggers tr + inner join pg_class p on p.oid = tr.parent_id +union all +select + CAST(def.name as sys.sysname) as name + , CAST(def.object_id as int) as object_id + , CAST(def.principal_id as int) as principal_id + , CAST(def.schema_id as int) as schema_id + , CAST(def.parent_object_id as int) as parent_object_id + , CAST(def.type as char(2)) as type + , CAST(def.type_desc as sys.nvarchar(60)) as type_desc + , CAST(def.create_date as sys.datetime) as create_date + , CAST(def.modified_date as sys.datetime) as modify_date + , CAST(def.is_ms_shipped as sys.bit) as is_ms_shipped + , CAST(def.is_published as sys.bit) as is_published + , CAST(def.is_schema_published as sys.bit) as is_schema_published + from sys.default_constraints def +union all +select + CAST(chk.name as sys.sysname) as name + , CAST(chk.object_id as int) as object_id + , CAST(chk.principal_id as int) as principal_id + , CAST(chk.schema_id as int) as schema_id + , CAST(chk.parent_object_id as int) as parent_object_id + , CAST(chk.type as char(2)) as type + , CAST(chk.type_desc as sys.nvarchar(60)) as type_desc + , CAST(chk.create_date as sys.datetime) as create_date + , CAST(chk.modify_date as sys.datetime) as modify_date + , CAST(chk.is_ms_shipped as sys.bit) as is_ms_shipped + , CAST(chk.is_published as sys.bit) as is_published + , CAST(chk.is_schema_published as sys.bit) as is_schema_published + from sys.check_constraints chk +union all +select + CAST(p.relname as sys.sysname) as name + , CAST(p.oid as int) as object_id + , CAST(null as int) as principal_id + , CAST(s.schema_id as int) as schema_id + , CAST(0 as int) as parent_object_id + , CAST('SO' as char(2)) as type + , CAST('SEQUENCE_OBJECT' as sys.nvarchar(60)) as type_desc + , CAST(null as sys.datetime) as create_date + , CAST(null as sys.datetime) as modify_date + , CAST(0 as sys.bit) as is_ms_shipped + , CAST(0 as sys.bit) as is_published + , CAST(0 as sys.bit) as is_schema_published +from pg_class p +inner join sys.schemas s on s.schema_id = p.relnamespace +and p.relkind = 'S' +and has_schema_privilege(s.schema_id, 'USAGE') +union all +select + CAST(('TT_' || tt.name collate "C" || '_' || tt.type_table_object_id) as sys.sysname) as name + , CAST(tt.type_table_object_id as int) as object_id + , CAST(tt.principal_id as int) as principal_id + , CAST(tt.schema_id as int) as schema_id + , CAST(0 as int) as parent_object_id + , CAST('TT' as char(2)) as type + , CAST('TABLE_TYPE' as sys.nvarchar(60)) as type_desc + , CAST((select string_agg( + case + when option like 'bbf_rel_create_date=%%' then substring(option, 21) + else NULL + end, ',') + from unnest(c.reloptions) as option) + as sys.datetime) as create_date + , CAST((select string_agg( + case + when option like 'bbf_rel_create_date=%%' then substring(option, 21) + else NULL + end, ',') + from unnest(c.reloptions) as option) + as sys.datetime) as modify_date + , CAST(1 as sys.bit) as is_ms_shipped + , CAST(0 as sys.bit) as is_published + , CAST(0 as sys.bit) as is_schema_published +from sys.table_types tt +inner join pg_class c on tt.type_table_object_id = c.oid; +GRANT SELECT ON sys.objects TO PUBLIC; + +CREATE OR REPLACE VIEW sys.all_sql_modules_internal AS +SELECT + ao.object_id AS object_id + , CAST( + CASE WHEN ao.type in ('P', 'FN', 'IN', 'TF', 'RF', 'IF') THEN COALESCE(f.definition, '') + WHEN ao.type = 'V' THEN COALESCE(bvd.definition, '') + ELSE NULL + END + AS sys.nvarchar) AS definition + , CAST(1 as sys.bit) AS uses_ansi_nulls + , CAST(1 as sys.bit) AS uses_quoted_identifier + , CAST(0 as sys.bit) AS is_schema_bound + , CAST(0 as sys.bit) AS uses_database_collation + , CAST(0 as sys.bit) AS is_recompiled + , CAST( + CASE WHEN ao.type IN ('P', 'FN', 'IN', 'TF', 'RF', 'IF') THEN + CASE WHEN p.proisstrict THEN 1 + ELSE 0 + END + ELSE 0 + END + AS sys.bit) as null_on_null_input + , null::integer as execute_as_principal_id + , CAST(0 as sys.bit) as uses_native_compilation + , CAST(ao.is_ms_shipped as INT) as is_ms_shipped +FROM sys.all_objects ao +LEFT OUTER JOIN sys.pg_namespace_ext nmext on ao.schema_id = nmext.oid +LEFT OUTER JOIN sys.babelfish_namespace_ext ext ON nmext.nspname = ext.nspname +LEFT OUTER JOIN sys.babelfish_view_def bvd + on ( + ext.orig_name = bvd.schema_name AND + ext.dbid = bvd.dbid AND + ao.name = bvd.object_name + ) +LEFT JOIN pg_proc p ON ao.object_id = CAST(p.oid AS INT) +LEFT JOIN sys.babelfish_function_ext f ON ao.name = f.funcname COLLATE "C" AND ao.schema_id::regnamespace::name = f.nspname +AND sys.babelfish_get_pltsql_function_signature(ao.object_id) = f.funcsignature COLLATE "C" +WHERE ao.type in ('P', 'RF', 'V', 'FN', 'IF', 'TF', 'R') +UNION ALL +SELECT + ao.object_id AS object_id + , CAST(COALESCE(f.definition, '') AS sys.nvarchar) AS definition + , CAST(1 as sys.bit) AS uses_ansi_nulls + , CAST(1 as sys.bit) AS uses_quoted_identifier + , CAST(0 as sys.bit) AS is_schema_bound + , CAST(0 as sys.bit) AS uses_database_collation + , CAST(0 as sys.bit) AS is_recompiled + , CAST(0 AS sys.bit) as null_on_null_input + , null::integer as execute_as_principal_id + , CAST(0 as sys.bit) as uses_native_compilation + , CAST(ao.is_ms_shipped as INT) as is_ms_shipped +FROM sys.all_objects ao +LEFT OUTER JOIN sys.pg_namespace_ext nmext on ao.schema_id = nmext.oid +LEFT JOIN pg_trigger tr ON ao.object_id = CAST(tr.oid AS INT) +LEFT JOIN sys.babelfish_function_ext f ON ao.name = f.funcname COLLATE "C" AND ao.schema_id::regnamespace::name = f.nspname +AND sys.babelfish_get_pltsql_function_signature(tr.tgfoid) = f.funcsignature COLLATE "C" +WHERE ao.type = 'TR'; +GRANT SELECT ON sys.all_sql_modules_internal TO PUBLIC; + +CREATE OR REPLACE VIEW sys.events +AS +SELECT + CAST(pt.oid as int) AS object_id + , CAST( + CASE + WHEN tr.event_manipulation='INSERT' THEN 1 + WHEN tr.event_manipulation='UPDATE' THEN 2 + WHEN tr.event_manipulation='DELETE' THEN 3 + ELSE 1 + END as int + ) AS type + , CAST(tr.event_manipulation as sys.nvarchar(60)) AS type_desc + , CAST(1 as sys.bit) AS is_trigger_event + , CAST(null as int) AS event_group_type + , CAST(null as sys.nvarchar(60)) AS event_group_type_desc +FROM information_schema.triggers tr +JOIN pg_catalog.pg_namespace np ON tr.event_object_schema = np.nspname COLLATE sys.database_default +JOIN pg_class pc ON pc.relname = tr.event_object_table COLLATE sys.database_default AND pc.relnamespace = np.oid +JOIN pg_trigger pt ON pt.tgrelid = pc.oid AND tr.trigger_name = pt.tgname COLLATE sys.database_default +AND has_schema_privilege(pc.relnamespace, 'USAGE') +AND has_table_privilege(pc.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER'); +GRANT SELECT ON sys.events TO PUBLIC; -- Drops the temporary procedure used by the upgrade script. -- Please have this be one of the last statements executed in this upgrade script. diff --git a/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--4.3.0--4.4.0.sql b/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--4.3.0--4.4.0.sql new file mode 100644 index 00000000000..1f6442ae198 --- /dev/null +++ b/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--4.3.0--4.4.0.sql @@ -0,0 +1,19 @@ +-- complain if script is sourced in psql, rather than via ALTER EXTENSION +\echo Use "ALTER EXTENSION ""babelfishpg_tsql"" UPDATE TO '4.4.0'" to load this file. \quit + +-- add 'sys' to search path for the convenience +SELECT set_config('search_path', 'sys, '||current_setting('search_path'), false); + +-- Please add your SQLs here +/* + * Note: These SQL statements may get executed multiple times specially when some features get backpatched. + * So make sure that any SQL statement (DDL/DML) being added here can be executed multiple times without affecting + * final behaviour. + */ + + +-- After upgrade, always run analyze for all babelfish catalogs. +CALL sys.analyze_babelfish_catalogs(); + +-- Reset search_path to not affect any subsequent scripts +SELECT set_config('search_path', trim(leading 'sys, ' from current_setting('search_path')), false); diff --git a/contrib/babelfishpg_tsql/src/babelfish_version.h b/contrib/babelfishpg_tsql/src/babelfish_version.h index 5fee6e64295..25179b91c64 100644 --- a/contrib/babelfishpg_tsql/src/babelfish_version.h +++ b/contrib/babelfishpg_tsql/src/babelfish_version.h @@ -8,7 +8,7 @@ *------------------------------------------------------------------------- */ -#define BABELFISH_VERSION_STR "4.3.0" -#define BABELFISH_INTERNAL_VERSION_STR "Babelfish 16.4.0.0" +#define BABELFISH_VERSION_STR "4.4.0" +#define BABELFISH_INTERNAL_VERSION_STR "Babelfish 16.5.0.0" #define BABEL_COMPATIBILITY_VERSION "12.0.2000.8" #define BABEL_COMPATIBILITY_MAJOR_VERSION "12" diff --git a/contrib/babelfishpg_tsql/src/backend_parser/gram-tsql-decl.y b/contrib/babelfishpg_tsql/src/backend_parser/gram-tsql-decl.y index 3192df37de8..0ba8f48be4b 100644 --- a/contrib/babelfishpg_tsql/src/backend_parser/gram-tsql-decl.y +++ b/contrib/babelfishpg_tsql/src/backend_parser/gram-tsql-decl.y @@ -14,8 +14,9 @@ %type tsql_stmt -%type tsql_AlterFunctionStmt +%type tsql_AlterFunctionStmt tsql_CreatePartitionStmt %type tsql_CreateFunctionStmt tsql_VariableSetStmt tsql_CreateTrigStmt tsql_TransactionStmt tsql_UpdateStmt tsql_DeleteStmt tsql_IndexStmt +%type tsql_PartitionSpec %type tsql_DropIndexStmt tsql_InsertStmt %type tsql_DropIndexStmtSchema %type tsql_CreateLoginStmt tsql_AlterLoginStmt tsql_DropLoginStmt @@ -47,6 +48,7 @@ %type tsql_ExecStmt tsql_output_ExecStmt %type tsql_actual_args +%type tsql_opt_partition_scheme_or_filegroup %type tsql_actual_arg %type tsql_opt_output tsql_opt_readonly @@ -71,7 +73,7 @@ %type TSQL_Typename TSQL_SimpleTypename TSQL_GenericType -%type datepart_arg datediff_arg dateadd_arg +%type datepart_arg datediff_arg dateadd_arg tsql_untruncated_IDENT %type tsql_type_function_name %type tsql_createproc_args tsql_createfunc_args %type tsql_triggername tsql_trigger_list diff --git a/contrib/babelfishpg_tsql/src/backend_parser/gram-tsql-rule.y b/contrib/babelfishpg_tsql/src/backend_parser/gram-tsql-rule.y index 6a6fc64bf4e..cfdf11893f8 100644 --- a/contrib/babelfishpg_tsql/src/backend_parser/gram-tsql-rule.y +++ b/contrib/babelfishpg_tsql/src/backend_parser/gram-tsql-rule.y @@ -2505,6 +2505,7 @@ tsql_stmt : | CreatePLangStmt | CreateSchemaStmt | CreateSeqStmt + | tsql_CreatePartitionStmt | CreateStmt | CreateSubscriptionStmt | CreateStatsStmt @@ -2574,6 +2575,75 @@ tsql_stmt : { $$ = NULL; } ; +/* + * The Opt clauses are included in the tsql_CreatePartitionStmt rule + * to resolve a shift-reduce conflict with the CreateStmt rule. + * Although semantically it is not required for TSQL partitioned table creation, + * its inclusion ensures that the parser can unambiguously distinguish + * between regular table creation and TSQL partitioned table creation statements. + */ +tsql_CreatePartitionStmt: + CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')' + OptInherit OptPartitionSpec table_access_method_clause OptWith + tsql_PartitionSpec + { + CreateStmt *n = makeNode(CreateStmt); + n->relation = $4; + n->tableElts = $6; + n->inhRelations = NIL; + n->partspec = $12; + n->ofTypename = NULL; + n->constraints = NIL; + n->accessMethod = NULL; + n->options = NIL; + n->oncommit = ONCOMMIT_NOOP; + n->tablespacename = NULL; + n->if_not_exists = false; + $$ = (Node *) n; + } + ; + +tsql_PartitionSpec: + ON tsql_untruncated_IDENT '(' part_params ')' + { + PartitionSpec *n = makeNode(PartitionSpec); + n->tsql_partition_scheme = $2; + n->strategy = PARTITION_STRATEGY_RANGE; + n->partParams = $4; + n->location = @1; + $$ = n; + } + ; + + + /* + * TSQL untruncated identfiers: + * This rule handles the parsing of untruncated identifiers in TSQL. + * Unlike PostgreSQL, which truncates identifier when they exceeds the + * maximum allowed length (NAMEDATALEN), while in TSQL, for certain cases we + * want to parse identifiers with lengths exceeding such limit. + * + * This rule extract the entire identifier string from the input buffer, + * regardless of its length. + */ +tsql_untruncated_IDENT: + IDENT + { + /* + * Retrieve the "extra" information attached to the scanner + * to access the input string (the string being parsed). + */ + base_yy_extra_type *yyextra = pg_yyget_extra(yyscanner); + + /* + * Extract the original, untruncated identifier from the input buffer. + * Here, @1 represents the start location of the identifier token. + */ + $$ = extract_identifier(yyextra->core_yy_extra.scanbuf + @1, NULL); + + } + ; + tsql_opt_INTO: INTO | /* empty */ @@ -3245,7 +3315,7 @@ tsql_IndexStmt: INDEX opt_concurrently opt_single_name ON relation_expr access_method_clause '(' index_params ')' opt_include where_clause opt_reloptions - tsql_opt_on_filegroup + tsql_opt_partition_scheme_or_filegroup { IndexStmt *n = makeNode(IndexStmt); n->unique = $2; @@ -3258,7 +3328,7 @@ tsql_IndexStmt: n->nulls_not_distinct = $2; n->whereClause = $15; n->options = $16; - n->excludeOpNames = NIL; + n->excludeOpNames = $17; n->idxcomment = NULL; n->indexOid = InvalidOid; n->oldNumber = InvalidOid; @@ -3313,6 +3383,25 @@ tsql_opt_on_filegroup: | /*EMPTY*/ {} ; +/* + * TSQL support for partition scheme and filegroup + */ + +tsql_opt_partition_scheme_or_filegroup: + ON tsql_untruncated_IDENT '(' ColId ')' + { + $$ = list_make2(makeString($2), makeString($4)); + } + | tsql_on_filegroup + { + $$ = NIL; + } + | /*EMPTY*/ + { + $$ = NIL; + } + ; + /* * TSQL support for DATA_COMPRESSION in and : * DATA_COMPRESSION = {NONE | ROW | PAGE} [ON PARTITIONS ( [,...n])] diff --git a/contrib/babelfishpg_tsql/src/catalog.c b/contrib/babelfishpg_tsql/src/catalog.c index b9c0a1567fb..7d0ea8e0e0e 100644 --- a/contrib/babelfishpg_tsql/src/catalog.c +++ b/contrib/babelfishpg_tsql/src/catalog.c @@ -21,12 +21,15 @@ #include "parser/scansup.h" #include "tcop/utility.h" #include "utils/builtins.h" +#include "utils/catcache.h" #include "utils/fmgroids.h" #include "utils/formatting.h" #include "utils/lsyscache.h" #include "utils/syscache.h" #include "utils/tuplestore.h" #include "utils/rel.h" +#include "utils/regproc.h" +#include "utils/array.h" #include "utils/timestamp.h" #include "nodes/execnodes.h" #include "catalog.h" @@ -107,6 +110,29 @@ Oid bbf_domain_mapping_idx_oid = InvalidOid; Oid bbf_extended_properties_oid = InvalidOid; Oid bbf_extended_properties_idx_oid = InvalidOid; +/***************************************** + * PARTITION_FUNCTION + *****************************************/ +Oid bbf_partition_function_oid = InvalidOid; +Oid bbf_partition_function_pk_idx_oid = InvalidOid; +Oid bbf_partition_function_id_idx_oid = InvalidOid; +Oid bbf_partition_function_seq_oid = InvalidOid; + +/***************************************** + * PARTITION_SCHEME + *****************************************/ +Oid bbf_partition_scheme_oid = InvalidOid; +Oid bbf_partition_scheme_pk_idx_oid = InvalidOid; +Oid bbf_partition_scheme_id_idx_oid = InvalidOid; +Oid bbf_partition_scheme_seq_oid = InvalidOid; + +/***************************************** + * PARTITION_DEPEND + *****************************************/ +Oid bbf_partition_depend_oid = InvalidOid; +Oid bbf_partition_depend_idx_oid = InvalidOid; + + /***************************************** * Catalog General *****************************************/ @@ -146,13 +172,13 @@ static struct cachedesc my_cacheinfo[] = { }, 16 }, - {-1, /* PROCNSPSIGNATURE */ + {-1, /* PROCNAMENSPSIGNATURE */ -1, - 2, + 3, { + Anum_bbf_function_ext_funcname, Anum_bbf_function_ext_nspname, Anum_bbf_function_ext_funcsignature, - 0, 0 }, 16 @@ -230,6 +256,22 @@ init_catalog(PG_FUNCTION_ARGS) spt_datatype_info_table_oid = get_relname_relid(SPT_DATATYPE_INFO_TABLE_NAME, sys_schema_oid); bbf_versions_oid = get_relname_relid(BBF_VERSIONS_TABLE_NAME, sys_schema_oid); + /* bbf_partition_function */ + bbf_partition_function_oid = get_bbf_partition_function_oid(); + bbf_partition_function_pk_idx_oid = get_bbf_partition_function_pk_idx_oid(); + bbf_partition_function_id_idx_oid = get_bbf_partition_function_id_idx_oid(); + bbf_partition_function_seq_oid = get_bbf_partition_function_seq_oid(); + + /* bbf_partition_scheme */ + bbf_partition_scheme_oid = get_bbf_partition_scheme_oid(); + bbf_partition_scheme_pk_idx_oid = get_bbf_partition_scheme_pk_idx_oid(); + bbf_partition_scheme_id_idx_oid = get_bbf_partition_scheme_id_idx_oid(); + bbf_partition_scheme_seq_oid = get_bbf_partition_scheme_seq_oid(); + + /* bbf_partition_depend */ + bbf_partition_depend_oid = get_bbf_partition_depend_oid(); + bbf_partition_depend_idx_oid = get_bbf_partition_depend_idx_oid(); + if (sysdatabases_oid != InvalidOid) initTsqlSyscache(); @@ -267,7 +309,9 @@ IsPLtsqlExtendedCatalog(Oid relationId) relationId == bbf_extended_properties_oid || relationId == bbf_assemblies_oid || relationId == bbf_configurations_oid || relationId == bbf_helpcollation_oid || relationId == bbf_syslanguages_oid || relationId == bbf_service_settings_oid || - relationId == spt_datatype_info_table_oid || relationId == bbf_versions_oid)) + relationId == spt_datatype_info_table_oid || relationId == bbf_versions_oid || + relationId == bbf_partition_function_oid || relationId == bbf_partition_scheme_oid || + relationId == bbf_partition_depend_oid)) return true; if (PrevIsExtendedCatalogHook) return (*PrevIsExtendedCatalogHook) (relationId); @@ -1367,10 +1411,13 @@ get_bbf_function_ext_idx_oid() HeapTuple get_bbf_function_tuple_from_proctuple(HeapTuple proctuple) { - HeapTuple bbffunctuple; - Form_pg_proc form; - char *physical_schemaname; - const char *func_signature; + CatCList *catlist; + HeapTuple newtup = NULL; + HeapTuple bbffunctuple; + Form_pg_proc form; + char *physical_schemaname; + NameData nsp_name; + char *func_signature; /* Disallow extended catalog lookup during restore */ if (!HeapTupleIsValid(proctuple) || babelfish_dump_restore) @@ -1394,24 +1441,49 @@ get_bbf_function_tuple_from_proctuple(HeapTuple proctuple) return NULL; } + namestrcpy(&nsp_name, physical_schemaname); + pfree(physical_schemaname); + + /* First search just using function name and schema name */ + catlist = SearchSysCacheList2(PROCNAMENSPSIGNATURE, + NameGetDatum(&form->proname), + NameGetDatum(&nsp_name)); + + if (catlist->n_members == 0) + { + ReleaseSysCacheList(catlist); + return NULL; + } + + /* Done, found a unique function */ + if (catlist->n_members == 1) + { + bbffunctuple = heap_copytuple(&catlist->members[0]->tuple); + ReleaseSysCacheList(catlist); + return bbffunctuple; + } + + /* Now search using function name, schema name and signature */ func_signature = get_pltsql_function_signature_internal(NameStr(form->proname), form->pronargs, form->proargtypes.values); if (func_signature == NULL) - { - pfree(physical_schemaname); return NULL; - } - bbffunctuple = SearchSysCache2(PROCNSPSIGNATURE, - CStringGetDatum(physical_schemaname), + bbffunctuple = SearchSysCache3(PROCNAMENSPSIGNATURE, + NameGetDatum(&form->proname), + NameGetDatum(&nsp_name), CStringGetTextDatum(func_signature)); - pfree(physical_schemaname); - pfree((char *) func_signature); + if (HeapTupleIsValid(bbffunctuple)) + { + newtup = heap_copytuple(bbffunctuple); + ReleaseSysCache(bbffunctuple); + } + pfree(func_signature); - return bbffunctuple; + return newtup; } void @@ -1512,13 +1584,13 @@ is_created_with_recompile(Oid objectId) bool isnull = false; Datum flag_validity; Datum flag_values; - flag_validity = SysCacheGetAttr(PROCNSPSIGNATURE, + flag_validity = SysCacheGetAttr(PROCNAMENSPSIGNATURE, bbffunctuple, Anum_bbf_function_ext_flag_validity, &isnull); Assert(isnull == false); - flag_values = SysCacheGetAttr(PROCNSPSIGNATURE, + flag_values = SysCacheGetAttr(PROCNAMENSPSIGNATURE, bbffunctuple, Anum_bbf_function_ext_flag_values, &isnull); @@ -1528,7 +1600,7 @@ is_created_with_recompile(Oid objectId) if ((DatumGetUInt64(flag_values) & DatumGetUInt64(flag_validity)) & FLAG_CREATED_WITH_RECOMPILE) recompile = true; - ReleaseSysCache(bbffunctuple); + heap_freetuple(bbffunctuple); } ReleaseSysCache(proctuple); @@ -1536,6 +1608,89 @@ is_created_with_recompile(Oid objectId) return recompile; } +/* + * Check if a catalog name is a classic T-SQL catalog starting with 'sys' (e.g. sysobjects). + * Historically (dating back to the Sybase era) these catalogs were located in the + * 'dbo' schema but have since been relocated to the 'sys' schema. + * They can however still be referenced in the 'dbo' schema which is equivalent to using 'sys'. + * Note: newer catalogs do not normally start with 'sys', but some exceptions exist, such as + * 'system_sql_modules'. These newer cases are however not referencable via 'dbo'. + * + * The input parameter is a table/view name, from which enclosing double quotes or square brackets + * have been stripped. + */ +bool +is_classic_catalog(const char *name) +{ + size_t len; + Assert(name); + len = strlen(name); + if (len <= 7) // sysusers,systypes,syslocks,sysfiles are shortest + return false; + + if ((len == 3) && pg_strncasecmp(name, "sys", 3) != 0) + return false; + + return ( + // Currently supported catalogs: + + // Instance-wide classic catalogs + // NB: sysdatabases does not need its schema mapped from 'dbo' to 'sys', + // but it is included here for completeness. + ((len == 12) && (pg_strncasecmp(name, "sysdatabases", len) == 0)) || + ((len == 11) && (pg_strncasecmp(name, "syscharsets", len) == 0)) || + ((len == 13) && (pg_strncasecmp(name, "sysconfigures", len) == 0)) || + ((len == 13) && (pg_strncasecmp(name, "syscurconfigs", len) == 0)) || + ((len == 12) && (pg_strncasecmp(name, "syslanguages", len) == 0)) || + ((len == 9) && (pg_strncasecmp(name, "syslogins", len) == 0)) || + ((len == 12) && (pg_strncasecmp(name, "sysprocesses", len) == 0)) || + + // DB-specific classic catalogs + ((len == 10) && (pg_strncasecmp(name, "syscolumns", len) == 0)) || + ((len == 14) && (pg_strncasecmp(name, "sysforeignkeys", len) == 0)) || + ((len == 10) && (pg_strncasecmp(name, "sysindexes", len) == 0)) || + ((len == 10) && (pg_strncasecmp(name, "sysobjects", len) == 0)) || + ((len == 8) && (pg_strncasecmp(name, "systypes", len) == 0)) || + ((len == 8) && (pg_strncasecmp(name, "sysusers", len) == 0)) + ); + +/* + * Additional T-SQL catalogs, not currently supported in Babelfish. + * + * When adding support for such a catalog, add it to the list above. + * We could include all of these in the list above, but that might + * impact performance. + * + * Instance-wide catalogs: + sysaltfiles + syscacheobjects + sysdevices + sysfilegroups + sysfiles + syslockinfo + syslocks + sysoledbusers + sysopentapes + sysperfinfo + sysremotelogins + sysservers + + * DB-specific catalogs: + syscomments + sysconstraints + sysdepends + sysforeignkeys + sysfulltextcatalogs + sysindexkeys + sysmembers + sysmessages + syspermissions + sysprotects + sysreferences + * + */ +} + /***************************************** * SCHEMA *****************************************/ @@ -1606,6 +1761,120 @@ get_bbf_extended_properties_idx_oid() return bbf_extended_properties_idx_oid; } +/***************************************** + * PARTITION_FUNCTION + *****************************************/ +Oid +get_bbf_partition_function_oid() +{ + if (!OidIsValid(bbf_partition_function_oid)) + bbf_partition_function_oid = get_relname_relid(BBF_PARTITION_FUNCTION_TABLE_NAME, + get_namespace_oid("sys", false)); + + return bbf_partition_function_oid; +} + +Oid +get_bbf_partition_function_seq_oid() +{ + if (!OidIsValid(bbf_partition_function_seq_oid)) + { + bbf_partition_function_seq_oid = get_relname_relid(BBF_PARTITION_FUNCTION_SEQ_NAME, + get_namespace_oid("sys", false)); + } + + return bbf_partition_function_seq_oid; +} + +Oid +get_bbf_partition_function_pk_idx_oid() +{ + if (!OidIsValid(bbf_partition_function_pk_idx_oid)) + bbf_partition_function_pk_idx_oid = get_relname_relid(BBF_PARTITION_FUNCTION_PK_IDX_NAME, + get_namespace_oid("sys", false)); + + return bbf_partition_function_pk_idx_oid; +} + +Oid +get_bbf_partition_function_id_idx_oid() +{ + if (!OidIsValid(bbf_partition_function_id_idx_oid)) + bbf_partition_function_id_idx_oid = get_relname_relid(BBF_PARTITION_FUNCTION_ID_IDX_NAME, + get_namespace_oid("sys", false)); + + return bbf_partition_function_id_idx_oid; +} + +/***************************************** + * PARTITION_SCHEME + *****************************************/ +Oid +get_bbf_partition_scheme_oid() +{ + if (!OidIsValid(bbf_partition_scheme_oid)) + bbf_partition_scheme_oid = get_relname_relid(BBF_PARTITION_SCHEME_TABLE_NAME, + get_namespace_oid("sys", false)); + + return bbf_partition_scheme_oid; +} + +Oid +get_bbf_partition_scheme_pk_idx_oid() +{ + if (!OidIsValid(bbf_partition_scheme_pk_idx_oid)) + bbf_partition_scheme_pk_idx_oid = get_relname_relid(BBF_PARTITION_SCHEME_PK_IDX_NAME, + get_namespace_oid("sys", false)); + + return bbf_partition_scheme_pk_idx_oid; +} + +Oid +get_bbf_partition_scheme_id_idx_oid() +{ + if (!OidIsValid(bbf_partition_scheme_id_idx_oid)) + bbf_partition_scheme_id_idx_oid = get_relname_relid(BBF_PARTITION_SCHEME_ID_IDX_NAME, + get_namespace_oid("sys", false)); + + return bbf_partition_scheme_id_idx_oid; +} + +Oid +get_bbf_partition_scheme_seq_oid() +{ + if (!OidIsValid(bbf_partition_scheme_seq_oid)) + { + bbf_partition_scheme_seq_oid = get_relname_relid(BBF_PARTITION_SCHEME_SEQ_NAME, + get_namespace_oid("sys", false)); + } + + return bbf_partition_scheme_seq_oid; +} + + +/***************************************** + * PARTITION_DEPEND + *****************************************/ +Oid +get_bbf_partition_depend_oid() +{ + if (!OidIsValid(bbf_partition_depend_oid)) + bbf_partition_depend_oid = get_relname_relid(BBF_PARTITION_DEPEND_TABLE_NAME, + get_namespace_oid("sys", false)); + + return bbf_partition_depend_oid; +} + +Oid +get_bbf_partition_depend_idx_oid() +{ + if (!OidIsValid(bbf_partition_depend_idx_oid)) + bbf_partition_depend_idx_oid = get_relname_relid(BBF_PARTITION_DEPEND_IDX_NAME, + get_namespace_oid("sys", false)); + + return bbf_partition_depend_idx_oid; +} + /***************************************** * Metadata Check * --------------------------------------- @@ -1656,6 +1925,11 @@ static Datum get_function_name(HeapTuple tuple, TupleDesc dsc); static Datum get_perms_schema_name(HeapTuple tuple, TupleDesc dsc); static Datum get_perms_grantee_name(HeapTuple tuple, TupleDesc dsc); static Datum get_server_name(HeapTuple tuple, TupleDesc dsc); +static Datum get_partition_function_dbname(HeapTuple tuple, TupleDesc dsc); +static Datum get_partition_scheme_dbname(HeapTuple tuple, TupleDesc dsc); +static Datum get_partition_depend_dbname(HeapTuple tuple, TupleDesc dsc); +static Datum get_partition_depend_schema_name(HeapTuple tuple, TupleDesc dsc); +static Datum get_partition_depend_table_oid(HeapTuple tuple, TupleDesc dsc); /* Condition function declaration */ static bool is_multidb(void); @@ -1698,7 +1972,8 @@ RelData catalog_data[] = {"pg_namespace", InvalidOid, InvalidOid, true, InvalidOid, Anum_pg_namespace_nspname, F_NAMEEQ}, {"pg_authid", InvalidOid, InvalidOid, true, InvalidOid, Anum_pg_authid_rolname, F_NAMEEQ}, {"pg_proc", InvalidOid, InvalidOid, false, InvalidOid, Anum_pg_proc_proname, F_NAMEEQ}, - {"pg_foreign_server", InvalidOid, InvalidOid, true, InvalidOid, Anum_pg_foreign_server_srvname, F_NAMEEQ} + {"pg_foreign_server", InvalidOid, InvalidOid, true, InvalidOid, Anum_pg_foreign_server_srvname, F_NAMEEQ}, + {"pg_class", InvalidOid, InvalidOid, true, InvalidOid, Anum_pg_class_oid, F_OIDEQ} }; /***************************************** @@ -1816,6 +2091,41 @@ Rule must_match_rules_srv_options[] = "pg_foreign_server", "srvname", NULL, get_server_name, NULL, check_exist, NULL} }; +/* + * For consistency of the "dbid" column in partition catalogs, we search on the "name" column + * in babelfish_sysdatabases instead of "dbid". The metadata consistency framework does not + * support defining multiple rules for the same catalog column, and a rule already exists + * for the "name" column in babelfish_sysdatabases. + * + * Additionally, since there are no explicit indexes on the "partition_function_name" and + * "partition_scheme_name" columns, consistency checks cannot be added to validate those. + */ + +/* babelfish_partition_function */ +Rule must_match_rules_partition_function[] = +{ + {" in babelfish_partition_function must also exist in babelfish_sysdatabases", + "babelfish_sysdatabases", "name", NULL, get_partition_function_dbname, NULL, check_exist, NULL} +}; + +/* babelfish_partition_scheme */ +Rule must_match_rules_partition_scheme[] = +{ + {" in babelfish_partition_scheme must also exist in babelfish_sysdatabases", + "babelfish_sysdatabases", "name", NULL, get_partition_scheme_dbname, NULL, check_exist, NULL} +}; + +/* babelfish_partition_depend */ +Rule must_match_rules_partition_depend[] = +{ + {" in babelfish_partition_depend must also exist in babelfish_sysdatabases", + "babelfish_sysdatabases", "name", NULL, get_partition_depend_dbname, NULL, check_exist, NULL}, + {" in babelfish_partition_depend must also exist in babelfish_namespace_ext", + "babelfish_namespace_ext", "nspname", NULL, get_partition_depend_schema_name, NULL, check_exist, NULL}, + {" in babelfish_partition_depend must also exist in pg_class", + "pg_class", "oid", NULL, get_partition_depend_table_oid, NULL, check_exist, NULL} +}; + /***************************************** * Core function *****************************************/ @@ -1907,6 +2217,9 @@ metadata_inconsistency_check(Tuplestorestate *res_tupstore, TupleDesc res_tupdes size_t num_must_match_rules_function = sizeof(must_match_rules_function) / sizeof(must_match_rules_function[0]); size_t num_must_match_rules_schema_permission = sizeof(must_match_rules_schema_permission) / sizeof(must_match_rules_schema_permission[0]); size_t num_must_match_rules_srv_options = sizeof(must_match_rules_srv_options) / sizeof(must_match_rules_srv_options[0]); + size_t num_must_match_rules_partition_function = sizeof(must_match_rules_partition_function) / sizeof(must_match_rules_partition_function[0]); + size_t num_must_match_rules_partition_scheme = sizeof(must_match_rules_partition_scheme) / sizeof(must_match_rules_partition_scheme[0]); + size_t num_must_match_rules_partition_depend = sizeof(must_match_rules_partition_depend) / sizeof(must_match_rules_partition_depend[0]); /* Initialize the catalog_data array to fetch catalog info */ init_catalog_data(); @@ -1941,6 +2254,15 @@ metadata_inconsistency_check(Tuplestorestate *res_tupstore, TupleDesc res_tupdes || !(check_must_match_rules(must_match_rules_srv_options, num_must_match_rules_srv_options, bbf_servers_def_oid, res_tupstore, res_tupdesc)) + || + !(check_must_match_rules(must_match_rules_partition_function, num_must_match_rules_partition_function, + bbf_partition_function_oid, res_tupstore, res_tupdesc)) + || + !(check_must_match_rules(must_match_rules_partition_scheme, num_must_match_rules_partition_scheme, + bbf_partition_scheme_oid, res_tupstore, res_tupdesc)) + || + !(check_must_match_rules(must_match_rules_partition_depend, num_must_match_rules_partition_depend, + bbf_partition_depend_oid, res_tupstore, res_tupdesc)) ) return; } @@ -2270,6 +2592,165 @@ get_server_name(HeapTuple tuple, TupleDesc dsc) return CStringGetDatum(servername); } +static Datum +get_partition_function_dbname(HeapTuple tuple, TupleDesc dsc) +{ + bool is_null; + char *dbname; + Datum dbid = heap_getattr(tuple, Anum_bbf_partition_function_dbid, dsc, &is_null); + + if (is_null) /* Sanity check. */ + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("dbid should not be null in babelfish_partition_function catalog"))); + + /* Another way to check for existence of dbid in babelfish_sysdatabases catalog. */ + dbname = get_db_name(DatumGetInt16(dbid)); + + if (!dbname) /* Sanity check. */ + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("dbid in babelfish_partition_function catalog doesn't exists in babelfish_sysdatabases catalog"))); + + return CStringGetTextDatum(dbname); +} + +static Datum +get_partition_scheme_dbname(HeapTuple tuple, TupleDesc dsc) +{ + bool is_null; + char *dbname; + Datum dbid = heap_getattr(tuple, Anum_bbf_partition_scheme_dbid, dsc, &is_null); + + if (is_null) /* Sanity check. */ + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("dbid should not be null in babelfish_partition_scheme catalog"))); + + /* Another way to check for existence of dbid in babelfish_sysdatabases catalog.*/ + dbname = get_db_name(DatumGetInt16(dbid)); + + if (!dbname) /* Sanity check. */ + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("dbid in babelfish_partition_scheme catalog doesn't exists in babelfish_sysdatabases catalog"))); + + return CStringGetTextDatum(dbname); +} + +static Datum +get_partition_depend_dbname(HeapTuple tuple, TupleDesc dsc) +{ + bool is_null; + Datum dbid = heap_getattr(tuple, Anum_bbf_partition_depend_dbid, dsc, &is_null); + char *dbname; + + if (is_null) /* Sanity check. */ + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("dbid should not be null in babelfish_partition_depend catalog"))); + + /* Another way to check for existence of dbid in babelfish_sysdatabases catalog */ + dbname = get_db_name(DatumGetInt16(dbid)); + + if (!dbname) /* Sanity check. */ + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("dbid in babelfish_partition_depend catalog doesn't exists in babelfish_sysdatabases catalog"))); + + return CStringGetTextDatum(dbname); +} + +static Datum +get_partition_depend_schema_name(HeapTuple tuple, TupleDesc dsc) +{ + bool schema_is_null, dbid_is_null; + char *physical_schema_name, *schema_name, *org_schema_name; + Datum dbid = heap_getattr(tuple, Anum_bbf_partition_depend_dbid, dsc, &dbid_is_null); + Datum schema_name_datum = heap_getattr(tuple, Anum_bbf_partition_depend_table_schema_name, dsc, &schema_is_null); + + if (dbid_is_null) /* Sanity check. */ + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("dbid should not be null in babelfish_partition_depend catalog"))); + + if (schema_is_null) /* Sanity check. */ + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("schema_name should not be null in babelfish_partition_depend catalog"))); + + org_schema_name = TextDatumGetCString(schema_name_datum); + /* + * Downcase the orginal schema name and don't truncate it since + * truncation will be handled inside get_physical_schema_name(). + */ + schema_name = downcase_identifier(org_schema_name, strlen(org_schema_name), false, false); + physical_schema_name = get_physical_schema_name(get_db_name(DatumGetInt16(dbid)), schema_name); + + pfree(schema_name); + pfree(org_schema_name); + return CStringGetDatum(physical_schema_name); +} + +static Datum +get_partition_depend_table_oid(HeapTuple tuple, TupleDesc dsc) +{ + bool schema_is_null, dbid_is_null, table_is_null; + char *physical_schema_name, *db_name, *schema_name, *table_name, *org_schema_name; + Oid schema_oid, table_oid; + Datum dbid = heap_getattr(tuple, Anum_bbf_partition_depend_dbid, dsc, &dbid_is_null); + Datum schema_name_datum = heap_getattr(tuple, Anum_bbf_partition_depend_table_schema_name, dsc, &schema_is_null); + Datum table_name_datum = heap_getattr(tuple, Anum_bbf_partition_depend_table_name, dsc, &table_is_null); + + /* Sanity checks. */ + if (dbid_is_null) + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("dbid should not be null in babelfish_partition_depend catalog"))); + if (schema_is_null) + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("schema_name should not be null in babelfish_partition_depend catalog"))); + if (table_is_null) + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("table_name should not be null in babelfish_partition_depend catalog"))); + + org_schema_name = TextDatumGetCString(schema_name_datum); + table_name = TextDatumGetCString(table_name_datum); + + db_name = get_db_name(DatumGetInt16(dbid)); + + if (!db_name) /* Sanity check. */ + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("dbid in babelfish_partition_depend should also exists babelfish_sysdatabases catalog"))); + + /* + * Downcase the orginal schema name and don't truncate it since + * truncation will be handled inside get_physical_schema_name(). + */ + schema_name = downcase_identifier(org_schema_name, strlen(org_schema_name), false, false); + physical_schema_name = get_physical_schema_name(db_name, schema_name); + + schema_oid = get_namespace_oid(physical_schema_name, true); + + if (!OidIsValid(schema_oid)) /* Sanity check. */ + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("schema_name in babelfish_partition_depend should also exists in babelfish_namespace_ext"))); + + table_oid = get_relname_relid(table_name, schema_oid); + + pfree(physical_schema_name); + pfree(db_name); + pfree(org_schema_name); + pfree(schema_name); + pfree(table_name); + + return ObjectIdGetDatum(table_oid); +} + /***************************************** * Condition check funcs *****************************************/ @@ -2426,6 +2907,12 @@ init_catalog_data(void) catalog_data[i].idx_oid = ForeignServerNameIndexId; catalog_data[i].atttype = get_atttype(ForeignServerRelationId, Anum_pg_foreign_server_srvname); } + else if (strcmp(catalog_data[i].tblname, "pg_class") == 0) + { + catalog_data[i].tbl_oid = RelationRelationId; + catalog_data[i].idx_oid = ClassOidIndexId; + catalog_data[i].atttype = get_atttype(RelationRelationId, Anum_pg_class_oid); + } else ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), @@ -2926,8 +3413,6 @@ rename_object_update_bbf_schema_permission_catalog(RenameStmt *stmt, int rename_ pfree(physical_schema_name); if (logical_schema_name != NULL) pfree(logical_schema_name); - if (object_name != NULL) - pfree(object_name); systable_endscan(scan); table_close(bbf_schema_rel, RowExclusiveLock); @@ -4507,3 +4992,922 @@ rename_tsql_db(char *old_db_name, char *new_db_name) if (!xactStarted) CommitTransactionCommand(); } + +/* + * partition_function_id_exists + * Returns true if provided function id is in use, false otherwise. + * + * This is helper function to find new id for partition function, it checks if provided + * id is already in use by looking up in sys.babelfish_partition_function catalog. + */ +static bool +partition_function_id_exists(int32 id) +{ + Relation rel; + HeapTuple tuple; + SysScanDesc scan; + ScanKeyData scanKey; + bool exists = false; + /* open the relation */ + rel = table_open(get_bbf_partition_function_oid(), AccessShareLock); + + ScanKeyInit(&scanKey, + Anum_bbf_partition_function_id, + BTEqualStrategyNumber, F_INT4EQ, + Int32GetDatum(id)); + + /* scan using index */ + scan = systable_beginscan(rel, + get_bbf_partition_function_id_idx_oid(), + false, NULL, 1, &scanKey); + + tuple = systable_getnext(scan); + if (HeapTupleIsValid(tuple)) + exists = true; + + systable_endscan(scan); + table_close(rel, AccessShareLock); + return exists; +} + +/* + * get_available_partition_function_id + * Returns available id for partition function. + * + * 1. To guard against race conditions for IDs, we check if the + * ID generated by sequence is used by an existing partition function. + * 2. To guard rare case where all possible sequence values have been exhausted + * and the sequence wraps around, we will loop through the entire range of + * sequence values and on loop completion, we should bail out. + */ +int32 +get_available_partition_function_id(void) +{ + int32 id; + int32 start = 0; + + do + { + id = nextval_internal(get_bbf_partition_function_seq_oid(), false); + if (start == 0) + start = id; + else if (start == id) /* loop completed */ + { + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("Cannot find an available ID for new partition function."))); + + } + } while (partition_function_id_exists(id)); + + return id; +} + +/* + * partition_scheme_id_exists + * Returns true if provided scheme id is in use, false otherwise. + * + * This is helper function to find new id for partition scheme, it checks + * if provided id is already in use by looking up in sys.babelfish_partition_scheme catalog. + */ +static bool +partition_scheme_id_exists(int32 id) +{ + Relation rel; + HeapTuple tuple; + SysScanDesc scan; + ScanKeyData scanKey; + bool exists = false; + + /* open the relation */ + rel = table_open(get_bbf_partition_scheme_oid(), AccessShareLock); + + ScanKeyInit(&scanKey, + Anum_bbf_partition_scheme_id, + BTEqualStrategyNumber, F_INT4EQ, + Int32GetDatum(id)); + + /* scan using index */ + scan = systable_beginscan(rel, + get_bbf_partition_scheme_id_idx_oid(), + false, NULL, 1, &scanKey); + + tuple = systable_getnext(scan); + if (HeapTupleIsValid(tuple)) + exists = true; + + systable_endscan(scan); + table_close(rel, AccessShareLock); + return exists; +} + +/* + * get_available_partition_scheme_id + * Returns available id for partition scheme. + * 1. To guard against race conditions for IDs, we check if the + * ID generated by sequence is used by an existing partition scheme. + * 2. To guard rare case where all possible sequence values have been exhausted + * and the sequence wraps around, we will loop through the entire range of + * sequence values and on loop completion, we should bail out. + */ +int32 +get_available_partition_scheme_id(void) +{ + int32 id; + int32 start = 0; + + do + { + id = nextval_internal(get_bbf_partition_scheme_seq_oid(), false); + if (start == 0) + start = id; + else if (start == id) /* loop completed */ + { + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("Cannot find an available ID for new partition scheme."))); + + } + } while (partition_scheme_id_exists(id)); + + return id; +} + +/* + * is_partition_function_used + * Returns true if provided function name is in use, false otherwise. + * + * This function checks if provided function name is used by any partition scheme, + * by looking up in sys.babelfish_partition_scheme catalog. + */ +static bool +is_partition_function_used(int16 dbid, const char *partition_function_name) +{ + Relation rel; + HeapTuple tuple; + SysScanDesc scan; + ScanKeyData scanKey[2]; + bool is_used = false; + + rel = table_open(get_bbf_partition_scheme_oid(), AccessShareLock); + + ScanKeyInit(&scanKey[0], + Anum_bbf_partition_scheme_dbid, + BTEqualStrategyNumber, F_INT2EQ, + Int16GetDatum(dbid)); + + ScanKeyEntryInitialize(&scanKey[1], 0, + Anum_bbf_partition_scheme_func_name, + BTEqualStrategyNumber, InvalidOid, + tsql_get_server_collation_oid_internal(false), + F_TEXTEQ, CStringGetTextDatum(partition_function_name)); + + scan = systable_beginscan(rel, + get_bbf_partition_scheme_pk_idx_oid(), + false, NULL, 2, scanKey); + + tuple = systable_getnext(scan); + if (HeapTupleIsValid(tuple)) + is_used = true; + + systable_endscan(scan); + table_close(rel, AccessShareLock); + return is_used; +} + +/* + * add_entry_to_bbf_partition_function + * Add a new entry to the sys.babelfish_partition_function catalog table. + */ +void +add_entry_to_bbf_partition_function(int16 dbid, const char *partition_function_name, char *typname, + bool partition_option, ArrayType *values) +{ + Relation rel; + TupleDesc dsc; + HeapTuple tuple; + Datum new_record[BBF_PARTITION_FUNCTION_NUM_COLS]; + bool new_record_nulls[BBF_PARTITION_FUNCTION_NUM_COLS]; + int32 partition_function_id = get_available_partition_function_id(); + + MemSet(new_record, 0, sizeof(new_record)); + MemSet(new_record_nulls, false, sizeof(new_record_nulls)); + + /* open the relation */ + rel = table_open(get_bbf_partition_function_oid(), RowExclusiveLock); + dsc = RelationGetDescr(rel); + + /* Build a tuple to insert */ + new_record[Anum_bbf_partition_function_dbid - 1] = Int16GetDatum(dbid); + new_record[Anum_bbf_partition_function_id - 1] = Int32GetDatum(partition_function_id); + new_record[Anum_bbf_partition_function_name - 1] = CStringGetTextDatum(partition_function_name); + new_record[Anum_bbf_partition_function_input_parameter_type - 1] = CStringGetTextDatum(typname); + new_record[Anum_bbf_partition_function_partition_option - 1] = BoolGetDatum(partition_option); + new_record[Anum_bbf_partition_function_range_values - 1] = PointerGetDatum(values); + new_record[6] = new_record[7] = TimestampGetDatum(GetSQLLocalTimestamp(3)); + + tuple = heap_form_tuple(dsc, new_record, new_record_nulls); + + /* insert new record in the bbf_partition_function table */ + CatalogTupleInsert(rel, tuple); + + heap_freetuple(tuple); + /* close the relation */ + table_close(rel, RowExclusiveLock); +} + +/* + * remove_entry_from_bbf_partition_function + * Tries to remove an entry from the sys.babelfish_partition_function catalog table. + * + * It raises errors for following cases: + * 1. If partition function doesn't exists in database. + * 2. If there are any dependent partition schemes on this partition function. + */ +void +remove_entry_from_bbf_partition_function(int16 dbid, const char *partition_function_name) +{ + Relation rel; + HeapTuple tuple; + ScanKeyData scanKey[2]; + SysScanDesc scan; + int32 function_exists = false; + bool has_dependent_objects = true; + + /* Fetch the relation */ + rel = table_open(get_bbf_partition_function_oid(), RowExclusiveLock); + + ScanKeyInit(&scanKey[0], + Anum_bbf_partition_function_dbid, + BTEqualStrategyNumber, F_INT2EQ, + Int16GetDatum(dbid)); + + ScanKeyEntryInitialize(&scanKey[1], 0, + Anum_bbf_partition_function_name, + BTEqualStrategyNumber, InvalidOid, + tsql_get_server_collation_oid_internal(false), + F_TEXTEQ, CStringGetTextDatum(partition_function_name)); + /* scan using index */ + scan = systable_beginscan(rel, get_bbf_partition_function_pk_idx_oid(), + false, NULL, 2, scanKey); + + tuple = systable_getnext(scan); + if (HeapTupleIsValid(tuple)) + { + function_exists = true; + /* remove the entry only if there is no dependent partition scheme on it */ + if (!is_partition_function_used(dbid, partition_function_name)) + { + has_dependent_objects = false; + CatalogTupleDelete(rel, &tuple->t_self); + } + } + + systable_endscan(scan); + table_close(rel, RowExclusiveLock); + + /* raise error if it doesn't exists in database */ + if (!function_exists) + { + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("Cannot drop the partition function '%s', because it does not exist or you do not have permission.", partition_function_name))); + } + + /* raise error if there are dependent partition scheme on it */ + if (has_dependent_objects) + { + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("Partition function '%s' is being used by one or more partition schemes.", partition_function_name))); + } +} + +/* + * partition_function_exists + * Returns true if provided partition function name exists in database, false otherwise. + */ +bool +partition_function_exists(int16 dbid, const char *partition_function_name) +{ + Relation rel; + HeapTuple tuple; + SysScanDesc scan; + ScanKeyData scanKey[2]; + bool exists = false; + + /* open the relation */ + rel = table_open(get_bbf_partition_function_oid(), AccessShareLock); + + ScanKeyInit(&scanKey[0], + Anum_bbf_partition_function_dbid, + BTEqualStrategyNumber, F_INT2EQ, + Int16GetDatum(dbid)); + + ScanKeyEntryInitialize(&scanKey[1], 0, + Anum_bbf_partition_function_name, + BTEqualStrategyNumber, InvalidOid, + tsql_get_server_collation_oid_internal(false), + F_TEXTEQ, CStringGetTextDatum(partition_function_name)); + + /* scan using index */ + scan = systable_beginscan(rel, get_bbf_partition_function_pk_idx_oid(), + false, NULL, 2, scanKey); + + tuple = systable_getnext(scan); + if (HeapTupleIsValid(tuple)) + exists = true; + + systable_endscan(scan); + table_close(rel, AccessShareLock); + return exists; +} + +/* + * get_partition_count + * Returns the number of partitions that will be generated using the given partition function name. + */ +int +get_partition_count(int16 dbid, const char *partition_function_name) +{ + Relation rel; + HeapTuple tuple; + SysScanDesc scan; + ScanKeyData scanKey[2]; + int count = 0; + /* Fetch the relation */ + rel = table_open(get_bbf_partition_function_oid(), AccessShareLock); + + ScanKeyInit(&scanKey[0], + Anum_bbf_partition_function_dbid, + BTEqualStrategyNumber, F_INT2EQ, + Int16GetDatum(dbid)); + ScanKeyEntryInitialize(&scanKey[1], 0, + Anum_bbf_partition_function_name, + BTEqualStrategyNumber, InvalidOid, + tsql_get_server_collation_oid_internal(false), + F_TEXTEQ, CStringGetTextDatum(partition_function_name)); + /* scan using index */ + scan = systable_beginscan(rel, get_bbf_partition_function_pk_idx_oid(), + false, NULL, 2, scanKey); + + tuple = systable_getnext(scan); + if (HeapTupleIsValid(tuple)) + { + bool isnull; + ArrayType *values; + values = DatumGetArrayTypeP(heap_getattr(tuple, Anum_bbf_partition_function_range_values, RelationGetDescr(rel), &isnull)); + count = ArrayGetNItems(ARR_NDIM(values), ARR_DIMS(values)) + 1; + } + systable_endscan(scan); + table_close(rel, AccessShareLock); + return count; +} + +/* + * is_partition_scheme_used + * Returns true if provided scheme name is in use, false otherwise. + * + * This function checks if provided scheme name is used by any partition scheme, + * by looking up in sys.babelfish_partition_depend catalog. + */ +static bool +is_partition_scheme_used(int16 dbid, const char *partition_scheme_name) +{ + Relation rel; + HeapTuple tuple; + ScanKeyData scanKey[2]; + SysScanDesc scan; + bool is_used = false; + + rel = table_open(get_bbf_partition_depend_oid(), AccessShareLock); + + ScanKeyInit(&scanKey[0], + Anum_bbf_partition_depend_dbid, + BTEqualStrategyNumber, F_INT2EQ, + Int16GetDatum(dbid)); + + ScanKeyEntryInitialize(&scanKey[1], 0, + Anum_bbf_partition_depend_scheme_name, + BTEqualStrategyNumber, InvalidOid, + tsql_get_server_collation_oid_internal(false), + F_TEXTEQ, CStringGetTextDatum(partition_scheme_name)); + + + scan = systable_beginscan(rel, + get_bbf_partition_depend_idx_oid(), + false, NULL, 2, scanKey); + + tuple = systable_getnext(scan); + if (HeapTupleIsValid(tuple)) + is_used = true; + + systable_endscan(scan); + table_close(rel, AccessShareLock); + return is_used; +} + +/* + * add_entry_to_bbf_partition_scheme + * Add a new entry to the sys.babelfish_partition_scheme catalog table. + */ +void +add_entry_to_bbf_partition_scheme(int16 dbid, const char *partition_scheme_name, const char *partition_function_name, bool next_used) +{ + Relation rel; + TupleDesc dsc; + HeapTuple tuple; + Datum new_record[BBF_PARTITION_SCHEME_NUM_COLS]; + bool new_record_nulls[BBF_PARTITION_SCHEME_NUM_COLS]; + int32 partition_scheme_id = get_available_partition_scheme_id(); + + /* Fetch the relation */ + rel = table_open(get_bbf_partition_scheme_oid(), RowExclusiveLock); + dsc = RelationGetDescr(rel); + + /* Build a tuple to insert */ + MemSet(new_record, 0, sizeof(new_record)); + MemSet(new_record_nulls, false, sizeof(new_record_nulls)); + + new_record[Anum_bbf_partition_scheme_dbid - 1] = Int16GetDatum(dbid); + new_record[Anum_bbf_partition_scheme_id - 1] = Int32GetDatum(partition_scheme_id); + new_record[Anum_bbf_partition_scheme_name - 1] = CStringGetTextDatum(partition_scheme_name); + new_record[Anum_bbf_partition_scheme_func_name - 1] = CStringGetTextDatum(partition_function_name); + new_record[Anum_bbf_partition_scheme_next_used - 1] = BoolGetDatum(next_used); + + tuple = heap_form_tuple(dsc, new_record, new_record_nulls); + + /* Insert new record in the bbf_partition_scheme table */ + CatalogTupleInsert(rel, tuple); + + heap_freetuple(tuple); + /* Close bbf_partition_scheme */ + table_close(rel, RowExclusiveLock); +} + +/* + * remove_entry_from_bbf_partition_scheme + * Tries to remove an entry from the sys.babelfish_partition_scheme catalog table. + * + * It raises errors for following cases: + * 1. If partition scheme doesn't exists in database. + * 2. If there are any dependent tables on this partition scheme. + */ +void +remove_entry_from_bbf_partition_scheme(int16 dbid, const char *partition_scheme_name) +{ + Relation rel; + HeapTuple tuple; + ScanKeyData scanKey[2]; + SysScanDesc scan; + bool scheme_exists = false; + bool has_dependent_objects = true; + + /* open the relation */ + rel = table_open(get_bbf_partition_scheme_oid(), RowExclusiveLock); + + ScanKeyInit(&scanKey[0], + Anum_bbf_partition_scheme_dbid, + BTEqualStrategyNumber, F_INT2EQ, + Int16GetDatum(dbid)); + + ScanKeyEntryInitialize(&scanKey[1], 0, + Anum_bbf_partition_scheme_name, + BTEqualStrategyNumber, InvalidOid, + tsql_get_server_collation_oid_internal(false), + F_TEXTEQ, CStringGetTextDatum(partition_scheme_name)); + /* scan using index */ + scan = systable_beginscan(rel, get_bbf_partition_scheme_pk_idx_oid(), + false, NULL, 2, scanKey); + + tuple = systable_getnext(scan); + if (HeapTupleIsValid(tuple)) + { + scheme_exists = true; + /* remove the entry only if there is no dependent tables on it */ + if (!is_partition_scheme_used(dbid, partition_scheme_name)) + { + has_dependent_objects = false; + CatalogTupleDelete(rel, &tuple->t_self); + } + } + + systable_endscan(scan); + /* close the relation */ + table_close(rel, RowExclusiveLock); + + /* raise error if it doesn't exists in database */ + if (!scheme_exists) + { + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("Cannot drop the partition scheme '%s', because it does not exist or you do not have permission.", partition_scheme_name))); + } + + /* raise error if there are dependent tables on it */ + if (has_dependent_objects) + { + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("The partition scheme \"%s\" is currently being used to partition one or more tables.", partition_scheme_name))); + } +} + +/* + * partition_scheme_exists + * Returns true if provided scheme name exists in database, false otherwise. + */ +bool +partition_scheme_exists(int16 dbid, const char *partition_scheme_name) +{ + Relation rel; + HeapTuple tuple; + SysScanDesc scan; + ScanKeyData scanKey[2]; + bool exists = false; + + rel = table_open(get_bbf_partition_scheme_oid(), AccessShareLock); + + ScanKeyInit(&scanKey[0], + Anum_bbf_partition_scheme_dbid, + BTEqualStrategyNumber, F_INT2EQ, + Int16GetDatum(dbid)); + + ScanKeyEntryInitialize(&scanKey[1], 0, + Anum_bbf_partition_scheme_name, + BTEqualStrategyNumber, InvalidOid, + tsql_get_server_collation_oid_internal(false), + F_TEXTEQ, CStringGetTextDatum(partition_scheme_name)); + + scan = systable_beginscan(rel, get_bbf_partition_scheme_pk_idx_oid(), + false, NULL, 2, scanKey); + + tuple = systable_getnext(scan); + if (HeapTupleIsValid(tuple)) + exists = true; + + systable_endscan(scan); + table_close(rel, AccessShareLock); + return exists; +} + +/* + * get_partition_function_name + * Returns the partition function name for the given partition scheme name. + */ +char* +get_partition_function_name(int16 dbid, const char *partition_scheme_name) +{ + Relation rel; + HeapTuple tuple; + SysScanDesc scan; + ScanKeyData scanKey[2]; + char *partition_function_name = NULL; + + rel = table_open(get_bbf_partition_scheme_oid(), AccessShareLock); + + ScanKeyInit(&scanKey[0], + Anum_bbf_partition_scheme_dbid, + BTEqualStrategyNumber, F_INT2EQ, + Int16GetDatum(dbid)); + + ScanKeyEntryInitialize(&scanKey[1], 0, + Anum_bbf_partition_scheme_name, + BTEqualStrategyNumber, InvalidOid, + tsql_get_server_collation_oid_internal(false), + F_TEXTEQ, CStringGetTextDatum(partition_scheme_name)); + + scan = systable_beginscan(rel, get_bbf_partition_scheme_pk_idx_oid(), + false, NULL, 2, scanKey); + + tuple = systable_getnext(scan); + if (HeapTupleIsValid(tuple)) + { + bool isnull; + partition_function_name = TextDatumGetCString(heap_getattr(tuple, Anum_bbf_partition_scheme_func_name, RelationGetDescr(rel), &isnull)); + } + + systable_endscan(scan); + table_close(rel, AccessShareLock); + return partition_function_name; +} +/* + * add_entry_to_bbf_partition_depend + * Inserts a new entry into the sys.babelfish_partition_depend catalog + * to track the dependecy between partition scheme and partitioned tables + * created using that. + */ +void +add_entry_to_bbf_partition_depend(int16 dbid, char* partition_scheme_name, char *schema_name, char *table_name) +{ + Relation rel; + TupleDesc dsc; + HeapTuple tuple; + Datum new_record[BBF_PARTITION_DEPEND_NUM_COLS]; + bool new_record_nulls[BBF_PARTITION_DEPEND_NUM_COLS]; + + MemSet(new_record, 0, sizeof(new_record)); + MemSet(new_record_nulls, false, sizeof(new_record_nulls)); + + rel = table_open(get_bbf_partition_depend_oid(), RowExclusiveLock); + dsc = RelationGetDescr(rel); + + /* Build a tuple to insert. */ + new_record[Anum_bbf_partition_depend_dbid - 1] = Int16GetDatum(dbid); + new_record[Anum_bbf_partition_depend_scheme_name - 1] = CStringGetTextDatum(partition_scheme_name); + new_record[Anum_bbf_partition_depend_table_schema_name - 1] = CStringGetTextDatum(schema_name); + new_record[Anum_bbf_partition_depend_table_name - 1] = CStringGetTextDatum(table_name); + + tuple = heap_form_tuple(dsc, new_record, new_record_nulls); + + /* Insert new record in the table. */ + CatalogTupleInsert(rel, tuple); + + heap_freetuple(tuple); + table_close(rel, RowExclusiveLock); +} + +/* + * remove_entry_from_bbf_partition_depend + * Removes an entry from the sys.babelfish_partition_depend catalog. + */ +void +remove_entry_from_bbf_partition_depend(int16 dbid, char *schema_name, char *table_name) +{ + Relation rel; + HeapTuple tuple; + ScanKeyData scanKey[3]; + SysScanDesc scan; + + rel = table_open(get_bbf_partition_depend_oid(), RowExclusiveLock); + + ScanKeyInit(&scanKey[0], + Anum_bbf_partition_depend_dbid, + BTEqualStrategyNumber, F_INT2EQ, + Int16GetDatum(dbid)); + + ScanKeyEntryInitialize(&scanKey[1], 0, + Anum_bbf_partition_depend_table_schema_name, + BTEqualStrategyNumber, InvalidOid, + tsql_get_server_collation_oid_internal(false), + F_TEXTEQ, CStringGetTextDatum(schema_name)); + + ScanKeyEntryInitialize(&scanKey[2], 0, + Anum_bbf_partition_depend_table_name, + BTEqualStrategyNumber, InvalidOid, + tsql_get_server_collation_oid_internal(false), + F_TEXTEQ, CStringGetTextDatum(table_name)); + + scan = systable_beginscan(rel, get_bbf_partition_depend_idx_oid(), + false, NULL, 3, scanKey); + + tuple = systable_getnext(scan); + if (HeapTupleIsValid(tuple)) + { + CatalogTupleDelete(rel, &tuple->t_self); + } + + systable_endscan(scan); + table_close(rel, RowExclusiveLock); +} + +/* + * rename_table_update_bbf_partition_depend_catalog + * Updates table_name in sys.babelfish_partition_depend catalog for + * RENAME TABLE command to have consistency with the new names. + */ +void +rename_table_update_bbf_partition_depend_catalog(RenameStmt *stmt, char *logical_schema_name, int16 dbid) +{ + Relation rel; + HeapTuple tuple, new_tuple; + TupleDesc dsc; + ScanKeyData scanKey[3]; + SysScanDesc scan; + Datum new_record[BBF_PARTITION_DEPEND_NUM_COLS]; + bool new_record_nulls[BBF_PARTITION_DEPEND_NUM_COLS]; + bool new_record_replace[BBF_PARTITION_DEPEND_NUM_COLS]; + char *table_name = stmt->relation->relname; + + /* Open the catalog table. */ + rel = table_open(get_bbf_partition_depend_oid(), RowExclusiveLock); + + /* Search for the row which needs to be updated. */ + ScanKeyInit(&scanKey[0], + Anum_bbf_partition_depend_dbid, + BTEqualStrategyNumber, F_INT2EQ, + Int16GetDatum(dbid)); + + ScanKeyEntryInitialize(&scanKey[1], 0, + Anum_bbf_partition_depend_table_schema_name, + BTEqualStrategyNumber, InvalidOid, + tsql_get_server_collation_oid_internal(false), + F_TEXTEQ, CStringGetTextDatum(logical_schema_name)); + + ScanKeyEntryInitialize(&scanKey[2], 0, + Anum_bbf_partition_depend_table_name, + BTEqualStrategyNumber, InvalidOid, + tsql_get_server_collation_oid_internal(false), + F_TEXTEQ, CStringGetTextDatum(table_name)); + + scan = systable_beginscan(rel, get_bbf_partition_depend_idx_oid(), + false, NULL, 3, scanKey); + + tuple = systable_getnext(scan); + + /* Update the table name of the found row. */ + if (HeapTupleIsValid(tuple)) + { + /* Get the descriptor of the table. */ + dsc = RelationGetDescr(rel); + + /* Build a tuple to insert. */ + MemSet(new_record, 0, sizeof(new_record)); + MemSet(new_record_nulls, false, sizeof(new_record_nulls)); + MemSet(new_record_replace, false, sizeof(new_record_replace)); + + new_record[Anum_bbf_partition_depend_table_name - 1] = CStringGetTextDatum(stmt->newname); + new_record_replace[Anum_bbf_partition_depend_table_name - 1] = true; + new_tuple = heap_modify_tuple(tuple, dsc, new_record, new_record_nulls, new_record_replace); + + /* Perform the actual catalog update. */ + CatalogTupleUpdate(rel, &new_tuple->t_self, new_tuple); + + /* Free the allocated tuple. */ + heap_freetuple(new_tuple); + } + + systable_endscan(scan); + /* Close the catalog table. */ + table_close(rel, RowExclusiveLock); +} + +/* + * is_bbf_partitioned_table + * Returns true if provided table is babelfish partitioned table, false otherwise. + * + * This function checks if provided table is babelfish partitioned table + * by looking up in sys.babelfish_partition_depend catalog. + */ +bool +is_bbf_partitioned_table(int16 dbid, char *schema_name, char *table_name) +{ + Relation rel; + HeapTuple tuple; + ScanKeyData scanKey[3]; + SysScanDesc scan; + bool sucess = false; + + rel = table_open(get_bbf_partition_depend_oid(), AccessShareLock); + + ScanKeyInit(&scanKey[0], + Anum_bbf_partition_depend_dbid, + BTEqualStrategyNumber, F_INT2EQ, + Int16GetDatum(dbid)); + + ScanKeyEntryInitialize(&scanKey[1], 0, + Anum_bbf_partition_depend_table_schema_name, + BTEqualStrategyNumber, InvalidOid, + tsql_get_server_collation_oid_internal(false), + F_TEXTEQ, CStringGetTextDatum(schema_name)); + + ScanKeyEntryInitialize(&scanKey[2], 0, + Anum_bbf_partition_depend_table_name, + BTEqualStrategyNumber, InvalidOid, + tsql_get_server_collation_oid_internal(false), + F_TEXTEQ, CStringGetTextDatum(table_name)); + + scan = systable_beginscan(rel, get_bbf_partition_depend_idx_oid(), + false, NULL, 3, scanKey); + + tuple = systable_getnext(scan); + if (HeapTupleIsValid(tuple)) + sucess = true; + + systable_endscan(scan); + table_close(rel, AccessShareLock); + + return sucess; +} + +/* + * get_partition_scheme_for_partitioned_table + * Returns the name of partition scheme used to create the partitioned table. + */ +char* +get_partition_scheme_for_partitioned_table(int16 dbid, char *schema_name, char *table_name) +{ + Relation rel; + HeapTuple tuple; + ScanKeyData scanKey[3]; + SysScanDesc scan; + char *partition_scheme_name = NULL; + + rel = table_open(get_bbf_partition_depend_oid(), AccessShareLock); + + ScanKeyInit(&scanKey[0], + Anum_bbf_partition_depend_dbid, + BTEqualStrategyNumber, F_INT2EQ, + Int16GetDatum(dbid)); + + ScanKeyEntryInitialize(&scanKey[1], 0, + Anum_bbf_partition_depend_table_schema_name, + BTEqualStrategyNumber, InvalidOid, + tsql_get_server_collation_oid_internal(false), + F_TEXTEQ, CStringGetTextDatum(schema_name)); + + ScanKeyEntryInitialize(&scanKey[2], 0, + Anum_bbf_partition_depend_table_name, + BTEqualStrategyNumber, InvalidOid, + tsql_get_server_collation_oid_internal(false), + F_TEXTEQ, CStringGetTextDatum(table_name)); + + scan = systable_beginscan(rel, get_bbf_partition_depend_idx_oid(), + false, NULL, 3, scanKey); + + tuple = systable_getnext(scan); + if (HeapTupleIsValid(tuple)) + { + bool isnull; + partition_scheme_name = TextDatumGetCString(heap_getattr(tuple, Anum_bbf_partition_depend_scheme_name, RelationGetDescr(rel), &isnull)); + } + + systable_endscan(scan); + table_close(rel, AccessShareLock); + + return partition_scheme_name; +} + +/* + * clean_up_bbf_partition_metadata + * clean up all the maintained metadata related to partition for + * provided database + */ +void +clean_up_bbf_partition_metadata(int16 dbid) +{ + Relation rel; + HeapTuple tuple; + SysScanDesc scan; + ScanKeyData scanKey; + + /* clean up sys.babelfish_partition_depend catalog */ + rel = table_open(get_bbf_partition_depend_oid(), RowExclusiveLock); + + ScanKeyInit(&scanKey, + Anum_bbf_partition_function_dbid, + BTEqualStrategyNumber, F_INT2EQ, + Int16GetDatum(dbid)); + + scan = systable_beginscan(rel, get_bbf_partition_depend_idx_oid(), + true, NULL, 1, &scanKey); + + while ((tuple = systable_getnext(scan)) != NULL) + { + if (HeapTupleIsValid(tuple)) + CatalogTupleDelete(rel, &tuple->t_self); + } + + systable_endscan(scan); + table_close(rel, RowExclusiveLock); + + /* clean up sys.babelfish_partition_scheme catalog */ + rel = table_open(get_bbf_partition_scheme_oid(), RowExclusiveLock); + + ScanKeyInit(&scanKey, + Anum_bbf_partition_scheme_dbid, + BTEqualStrategyNumber, F_INT2EQ, + Int16GetDatum(dbid)); + + scan = systable_beginscan(rel, get_bbf_partition_scheme_pk_idx_oid(), + true, NULL, 1, &scanKey); + + while ((tuple = systable_getnext(scan)) != NULL) + { + if (HeapTupleIsValid(tuple)) + CatalogTupleDelete(rel, &tuple->t_self); + } + + systable_endscan(scan); + table_close(rel, RowExclusiveLock); + + /* clean up sys.babelfish_partition_function catalog */ + rel = table_open(get_bbf_partition_function_oid(), RowExclusiveLock); + + ScanKeyInit(&scanKey, + Anum_bbf_partition_function_dbid, + BTEqualStrategyNumber, F_INT2EQ, + Int16GetDatum(dbid)); + + scan = systable_beginscan(rel, get_bbf_partition_function_pk_idx_oid(), + true, NULL, 1, &scanKey); + + while ((tuple = systable_getnext(scan)) != NULL) + { + if (HeapTupleIsValid(tuple)) + CatalogTupleDelete(rel, &tuple->t_self); + } + + systable_endscan(scan); + table_close(rel, RowExclusiveLock); +} \ No newline at end of file diff --git a/contrib/babelfishpg_tsql/src/catalog.h b/contrib/babelfishpg_tsql/src/catalog.h index 9396ad34a9d..430edd0812c 100644 --- a/contrib/babelfishpg_tsql/src/catalog.h +++ b/contrib/babelfishpg_tsql/src/catalog.h @@ -277,6 +277,7 @@ extern Oid get_bbf_function_ext_idx_oid(void); extern HeapTuple get_bbf_function_tuple_from_proctuple(HeapTuple proctuple); extern void clean_up_bbf_function_ext(int16 dbid); extern bool is_created_with_recompile(Oid objectId); +extern bool is_classic_catalog(const char *name); typedef struct FormData_bbf_function_ext { @@ -386,6 +387,95 @@ extern Oid bbf_extended_properties_idx_oid; extern Oid get_bbf_extended_properties_oid(void); extern Oid get_bbf_extended_properties_idx_oid(void); +/***************************************** + * PARTITION_FUNCTION + *****************************************/ +#define BBF_PARTITION_FUNCTION_TABLE_NAME "babelfish_partition_function" +#define BBF_PARTITION_FUNCTION_PK_IDX_NAME "babelfish_partition_function_pkey" +#define BBF_PARTITION_FUNCTION_ID_IDX_NAME "babelfish_partition_function_function_id_key" +#define BBF_PARTITION_FUNCTION_SEQ_NAME "babelfish_partition_function_seq" + +#define Anum_bbf_partition_function_dbid 1 +#define Anum_bbf_partition_function_id 2 +#define Anum_bbf_partition_function_name 3 +#define Anum_bbf_partition_function_input_parameter_type 4 +#define Anum_bbf_partition_function_partition_option 5 +#define Anum_bbf_partition_function_range_values 6 + +#define BBF_PARTITION_FUNCTION_NUM_COLS 8 + +extern Oid bbf_partition_function_oid; +extern Oid bbf_partition_function_pk_idx_oid; +extern Oid bbf_partition_function_id_idx_oid; +extern Oid bbf_partition_function_seq_oid; + +extern Oid get_bbf_partition_function_oid(void); +extern Oid get_bbf_partition_function_pk_idx_oid(void); +extern Oid get_bbf_partition_function_id_idx_oid(void); +extern Oid get_bbf_partition_function_seq_oid(void); +extern int32 get_available_partition_function_id(void); +extern void add_entry_to_bbf_partition_function(int16 dbid, const char *partition_function_name, + char *typname, bool partition_option, ArrayType *values); +extern void remove_entry_from_bbf_partition_function(int16 dbid, const char *partition_function_name); +extern bool partition_function_exists(int16 dbid, const char *partition_function_name); +extern int get_partition_count(int16 dbid, const char *partition_function_name); +extern void clean_up_bbf_partition_metadata(int16 dbid); + + +/***************************************** + * PARTITION_SCHEME + *****************************************/ +#define BBF_PARTITION_SCHEME_TABLE_NAME "babelfish_partition_scheme" +#define BBF_PARTITION_SCHEME_PK_IDX_NAME "babelfish_partition_scheme_pkey" +#define BBF_PARTITION_SCHEME_ID_IDX_NAME "babelfish_partition_scheme_scheme_id_key" +#define BBF_PARTITION_SCHEME_SEQ_NAME "babelfish_partition_scheme_seq" + +#define Anum_bbf_partition_scheme_dbid 1 +#define Anum_bbf_partition_scheme_id 2 +#define Anum_bbf_partition_scheme_name 3 +#define Anum_bbf_partition_scheme_func_name 4 +#define Anum_bbf_partition_scheme_next_used 5 +#define BBF_PARTITION_SCHEME_NUM_COLS 5 + +extern Oid bbf_partition_scheme_oid; +extern Oid bbf_partition_scheme_pk_idx_oid; +extern Oid bbf_partition_scheme_id_idx_oid; +extern Oid bbf_partition_scheme_seq_oid; + +extern Oid get_bbf_partition_scheme_oid(void); +extern Oid get_bbf_partition_scheme_pk_idx_oid(void); +extern Oid get_bbf_partition_scheme_id_idx_oid(void); +extern Oid get_bbf_partition_scheme_seq_oid(void); +extern int32 get_available_partition_scheme_id(void); +extern void add_entry_to_bbf_partition_scheme(int16 dbid, const char *partition_scheme_name, const char *partition_function_name, bool next_used); +extern void remove_entry_from_bbf_partition_scheme(int16 dbid, const char *partition_scheme_name); +extern bool partition_scheme_exists(int16 dbid, const char *partition_scheme_name); +extern char *get_partition_function_name(int16 dbid, const char *partition_scheme_name); + +/***************************************** + * PARTITION_DEPEND + *****************************************/ +#define BBF_PARTITION_DEPEND_TABLE_NAME "babelfish_partition_depend" +#define BBF_PARTITION_DEPEND_IDX_NAME "babelfish_partition_depend_pkey" + +#define Anum_bbf_partition_depend_dbid 1 +#define Anum_bbf_partition_depend_scheme_name 2 +#define Anum_bbf_partition_depend_table_schema_name 3 +#define Anum_bbf_partition_depend_table_name 4 +#define BBF_PARTITION_DEPEND_NUM_COLS 4 + +extern Oid bbf_partition_depend_oid; +extern Oid bbf_partition_depend_idx_oid; + +extern Oid get_bbf_partition_depend_oid(void); +extern Oid get_bbf_partition_depend_idx_oid(void); +extern void add_entry_to_bbf_partition_depend(int16 dbid, char* partition_scheme_name, char *schema_name, char *table_name); +extern void remove_entry_from_bbf_partition_depend(int16 dbid, char *schema_name, char *table_name); +extern bool is_bbf_partitioned_table(int16 dbid, char *schema_name, char *table_name); +extern char *get_partition_scheme_for_partitioned_table(int16 dbid, char *schema_name, char *table_name); +extern void rename_table_update_bbf_partition_depend_catalog(RenameStmt *stmt, char *logical_schema_name, int16 dbid); + + typedef struct FormData_bbf_extended_properties { int16 dbid; diff --git a/contrib/babelfishpg_tsql/src/codegen.c b/contrib/babelfishpg_tsql/src/codegen.c index 4da9382cb99..a0d4f1e37ee 100644 --- a/contrib/babelfishpg_tsql/src/codegen.c +++ b/contrib/babelfishpg_tsql/src/codegen.c @@ -303,6 +303,8 @@ stmt_default_act(Walker_context *ctx, PLtsql_stmt *stmt) case PLTSQL_STMT_CHANGE_DBOWNER: case PLTSQL_STMT_FULLTEXTINDEX: case PLTSQL_STMT_GRANTSCHEMA: + case PLTSQL_STMT_PARTITION_FUNCTION: + case PLTSQL_STMT_PARTITION_SCHEME: case PLTSQL_STMT_INSERT_BULK: case PLTSQL_STMT_DBCC: case PLTSQL_STMT_SET_EXPLAIN_MODE: diff --git a/contrib/babelfishpg_tsql/src/collation.c b/contrib/babelfishpg_tsql/src/collation.c index ab8d7e07adc..26bb0d818ae 100644 --- a/contrib/babelfishpg_tsql/src/collation.c +++ b/contrib/babelfishpg_tsql/src/collation.c @@ -18,7 +18,12 @@ #include "parser/parse_oper.h" #include "nodes/makefuncs.h" #include "nodes/nodes.h" +#ifdef USE_ICU #include +#include "utils/removeaccent.map" +#include +#include +#endif #include "pltsql.h" #include "src/collation.h" @@ -40,6 +45,15 @@ #define MAX_BYTES_PER_CHAR 4 #define MAX_INPUT_LENGTH_TO_REMOVE_ACCENTS 250 * 1024 * 1024 +/* + * Check if Uchar is lead surrogate pair, If Uchar is in + * the range D800 - DBFF then it is a lead surrogate pair + */ +#define UCHAR_IS_SURROGATE(c) ((c & 0xF800) == 0xD800) + +/* Find length of given Uchar */ +#define UCHAR_LENGTH(c) (UCHAR_IS_SURROGATE(c) ? 2 : 1) + Oid server_collation_oid = InvalidOid; collation_callbacks *collation_callbacks_ptr = NULL; extern bool babelfish_dump_restore; @@ -48,6 +62,7 @@ static UTransliterator *cached_transliterator = NULL; static Node *pgtsql_expression_tree_mutator(Node *node, void *context); static void init_and_check_collation_callbacks(void); +static int patindex_ai_match_text(pg_locale_t mylocale, char *input_str, char *pattern, Oid cid, bool is_cs_ai); extern int pattern_fixed_prefix_wrapper(Const *patt, int ptype, @@ -69,6 +84,7 @@ PG_FUNCTION_INFO_V1(init_collid_trans_tab); PG_FUNCTION_INFO_V1(init_like_ilike_table); PG_FUNCTION_INFO_V1(get_server_collation_oid); PG_FUNCTION_INFO_V1(is_collated_ci_as_internal); +PG_FUNCTION_INFO_V1(is_collated_ai_internal); /* this function is no longer needed and is only a placeholder for upgrade script */ PG_FUNCTION_INFO_V1(init_server_collation); @@ -119,6 +135,12 @@ is_collated_ci_as_internal(PG_FUNCTION_ARGS) PG_RETURN_DATUM(tsql_is_collated_ci_as_internal(fcinfo)); } +Datum +is_collated_ai_internal(PG_FUNCTION_ARGS) +{ + PG_RETURN_DATUM(tsql_is_collated_ai_internal(fcinfo)); +} + /* init_like_ilike_table - this function is no longer needed and is only a placeholder for upgrade script */ Datum init_like_ilike_table(PG_FUNCTION_ARGS) @@ -450,6 +472,11 @@ transform_from_ci_as_for_likenode(Node *node, OpExpr *op, like_ilike_info_t like return ret; } +/* + * Only use cached mappings for removing accents when the + * current ICU version matches to the one used to generate + * the cache. Otherwise we fallback on the ICU function + */ static void get_remove_accents_internal_oid() { @@ -457,9 +484,156 @@ get_remove_accents_internal_oid() if (OidIsValid(remove_accents_internal_oid)) return; +#ifdef USE_ICU + if (U_ICU_VERSION_MAJOR_NUM == pltsql_remove_accent_map_icu_major_version && U_ICU_VERSION_MINOR_NUM == pltsql_remove_accent_map_icu_min_version) + { + elog(LOG, "Using cached mappings to remove accents"); + remove_accents_internal_oid = LookupFuncName(list_make2(makeString("sys"), makeString("remove_accents_internal_using_cache")), -1, funcargtypes, true); + return; + } +#endif + elog(LOG, "Using ICU function to remove accents"); remove_accents_internal_oid = LookupFuncName(list_make2(makeString("sys"), makeString("remove_accents_internal")), -1, funcargtypes, true); } +/* + * store 32bit character representation into multibyte stream + */ +static inline void +store_coded_char(unsigned char *dest, uint32 code) +{ + if (code & 0xff000000) + { + *dest++ = code >> 24; + } + if (code & 0x00ff0000) + { + *dest++ = code >> 16; + } + if (code & 0x0000ff00) + { + *dest++ = code >> 8; + } + if (code & 0x000000ff) + { + *dest++ = code; + } + *dest = '\0'; + return; +} + +static int +compare_remove_accent_map_pair(const void *p1, const void *p2) +{ + uint32 v1, + v2; + + v1 = *(const uint32 *) p1; + v2 = ((const remove_accent_map_pair *) p2)->original_char; + return (v1 > v2) ? 1 : ((v1 == v2) ? 0 : -1); +} + +PG_FUNCTION_INFO_V1(remove_accents_internal_using_cache); +Datum remove_accents_internal_using_cache(PG_FUNCTION_ARGS) +{ + unsigned char *input_str, + *input_str_start, + *normalized_char; + int len, + char_len; + text *return_result; + StringInfoData result; + + if (PG_ARGISNULL(0)) + PG_RETURN_NULL(); + + input_str = (unsigned char *) text_to_cstring(PG_GETARG_TEXT_PP(0)); + input_str_start = input_str; + len = strlen((char *) input_str); + initStringInfo(&result); + normalized_char = (unsigned char *) palloc(sizeof(uint32) + 1); + + for (; len > 0; len -= char_len) + { + unsigned char b1 = 0; + unsigned char b2 = 0; + unsigned char b3 = 0; + unsigned char b4 = 0; + uint32 utf8_char; + uint32 utf8_normalized_str; + remove_accent_map_pair *pr; + + /* "break" cases all represent errors */ + if (*input_str == '\0') + break; + + char_len = pg_utf_mblen(input_str); + + if (len < char_len) + break; + + if (!pg_utf8_islegal(input_str, char_len)) + break; + + if (char_len == 1) + { + appendBinaryStringInfo(&result, input_str++, 1); + continue; + } + + /* collect coded char of length l */ + if (char_len == 2) + { + b3 = *input_str++; + b4 = *input_str++; + } + else if (char_len == 3) + { + b2 = *input_str++; + b3 = *input_str++; + b4 = *input_str++; + } + else if (char_len == 4) + { + b1 = *input_str++; + b2 = *input_str++; + b3 = *input_str++; + b4 = *input_str++; + } + else + { + elog(ERROR, "unsupported character length %d", char_len); + } + + utf8_char = (b1 << 24 | b2 << 16 | b3 << 8 | b4); + + pr = bsearch(&utf8_char, pltsql_remove_accent_map, lengthof(pltsql_remove_accent_map), + sizeof(remove_accent_map_pair), compare_remove_accent_map_pair); + + /* Use the mapping if availaible or else the character */ + if (pr && pr->normalized_char) + utf8_normalized_str = pr->normalized_char; + else + utf8_normalized_str = utf8_char; + + store_coded_char(normalized_char, utf8_normalized_str); + + appendBinaryStringInfo(&result, normalized_char, strlen((const char *) normalized_char)); + } + + if (len > 0) + ereport(ERROR, + (errcode(ERRCODE_CHARACTER_NOT_IN_REPERTOIRE), + errmsg("invalid byte sequence for encoding UTF-8 while removing accents"))); + + return_result = cstring_to_text_with_len(result.data, result.len); + pfree(result.data); + pfree(input_str_start); + pfree(normalized_char); + + PG_RETURN_VARCHAR_P(return_result); +} + /* * Function responsible for obtaining unaccented version of input * string with the help of ICU provided APIs. @@ -552,13 +726,6 @@ Datum remove_accents_internal(PG_FUNCTION_ARGS) &status); /* Allocated capacity may not be enough to hold un-accented string. This shouldn't occur ideally but still defensive code. */ - if (status == U_BUFFER_OVERFLOW_ERROR) - { - ereport(ERROR, - (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("Buffer overflow occurred while normalising the string. Error: %s", u_errorName(status)))); - } - if (U_FAILURE(status)) { ereport(ERROR, @@ -1031,6 +1198,15 @@ tsql_is_collated_ci_as_internal(PG_FUNCTION_ARGS) return (*collation_callbacks_ptr->is_collated_ci_as_internal) (fcinfo); } +Datum +tsql_is_collated_ai_internal(PG_FUNCTION_ARGS) +{ + /* Initialise collation callbacks */ + init_and_check_collation_callbacks(); + + return (*collation_callbacks_ptr->is_collated_ai_internal) (fcinfo); +} + bytea * tsql_tdscollationproperty_helper(const char *collationaname, const char *property) { @@ -1166,3 +1342,703 @@ has_ilike_node_and_ci_as_coll(Node *expr) } return false; } + +static void +check_collation_set(Oid collid) +{ + if (!OidIsValid(collid)) + { + /* + * This typically means that the parser could not resolve a conflict + * of implicit collations, so report it that way. + */ + ereport(ERROR, + (errcode(ERRCODE_INDETERMINATE_COLLATION), + errmsg("could not determine which collation to use for string comparison"), + errhint("Use the COLLATE clause to set the collation explicitly."))); + } +} + +PG_FUNCTION_INFO_V1(get_icu_major_version); +Datum +get_icu_major_version(PG_FUNCTION_ARGS) +{ +#ifdef USE_ICU + PG_RETURN_INT32(U_ICU_VERSION_MAJOR_NUM); +#else + ereport(ERROR, + (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), + errmsg("ICU library is not found"))); + PG_RETURN_NULL(); +#endif +} + +PG_FUNCTION_INFO_V1(get_icu_minor_version); +Datum +get_icu_minor_version(PG_FUNCTION_ARGS) +{ +#ifdef USE_ICU + PG_RETURN_INT32(U_ICU_VERSION_MINOR_NUM); +#else + ereport(ERROR, + (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), + errmsg("ICU library is not found"))); + PG_RETURN_NULL(); +#endif +} +/* + * For a given string and position in UTF-16 and return + * the corresponding position in UTF-8 string. UTF-16 + * string considers surrogate pairs as two chars while + * in UTF-8 they are 1, which is why we need to translate + */ + +static int32_t +translate_char_pos(const char* str, /* UTF-8 string */ + int32_t str_len, /* length of UTF-8 string */ + const UChar* str_utf16, /* UTF-16 string */ + int32_t u16_len, /* length of UTF-16 string */ + int32_t u16_pos, /* position to translare in UTF-16 string */ + const char **p_str) /* character at same position in UTF-8 string */ +{ + UChar32 c; + int32_t u16_idx = 0; + int32_t out_pos = 0; + int32_t u8_offset = 0; + + Assert (GetDatabaseEncoding() == PG_UTF8); + + /* for UTF-8, use ICU macros instead of calling pg_mblen() */ + while (u16_idx < u16_pos) + { +#ifdef USE_ICU + U16_NEXT(str_utf16, u16_idx, u16_len, c); + U8_NEXT(str, u8_offset, str_len, c); + out_pos++; +#else + ereport(ERROR, + (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), + errmsg("translate_char_pos requires ICU library, which is not available"))); +#endif + } + if (p_str != NULL) + *p_str = str + u8_offset; + + return out_pos; +} + +static int +icu_compare_utf8_coll(UCollator *coll, UChar *uchar1, int32_t ulen1, + UChar *uchar2, int32_t ulen2, bool is_cs_ai_range_cmp) +{ + UErrorCode status = U_ZERO_ERROR; + UCollator *collator; + int i; + + if (is_cs_ai_range_cmp) + { + collator = ucol_safeClone(coll, NULL, NULL, &status); + + if (U_FAILURE(status)) + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("failed to clone collator in icu compare: %s", u_errorName(status)))); + + ucol_setAttribute(collator, UCOL_CASE_FIRST, UCOL_OFF, &status); + + if (U_FAILURE(status)) + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("failed to set attribute for ucollator: %s", u_errorName(status)))); + } + else + { + collator = coll; + } + + i = ucol_strcoll(collator, + uchar1, ulen1, + uchar2, ulen2); + + if (is_cs_ai_range_cmp) + ucol_close(collator); + + return i; +} + +bool +pltsql_strpos_non_determinstic(text *src_text, text *substr_text, Oid collid, int *r) +{ + pg_locale_t mylocale = 0; + + check_collation_set(collid); + + if (!lc_collate_is_c(collid)) + mylocale = pg_newlocale_from_collation(collid); + else + return false; + + if (!pg_locale_deterministic(mylocale) && mylocale->provider == 'i') + { +#ifdef USE_ICU + int32_t src_len_utf8 = VARSIZE_ANY_EXHDR(src_text); + int32_t substr_len_utf8 = VARSIZE_ANY_EXHDR(substr_text); + int32_t src_ulen, substr_ulen; + int32_t u8_pos = -1, pos_prev_loop = -1; + UErrorCode status = U_ZERO_ERROR; + UStringSearch *usearch; + UChar *src_uchar, *substr_uchar; + coll_info_t coll_info_of_inputcollid = tsql_lookup_collation_table_internal(collid); + bool is_CS_AI = false; + bool is_substr_starts_with_surrogate; + + if (OidIsValid(coll_info_of_inputcollid.oid) && + coll_info_of_inputcollid.collateflags == 0x000e /* CS_AI */ ) + { + is_CS_AI = true; + } + + src_ulen = icu_to_uchar(&src_uchar, VARDATA_ANY(src_text), src_len_utf8); + substr_ulen = icu_to_uchar(&substr_uchar, VARDATA_ANY(substr_text), substr_len_utf8); + + is_substr_starts_with_surrogate = UCHAR_IS_SURROGATE(substr_uchar[0]); + + usearch = usearch_openFromCollator(substr_uchar, + substr_ulen, + src_uchar, + src_ulen, + mylocale->info.icu.ucol, + NULL, + &status); + + usearch_setAttribute(usearch, USEARCH_OVERLAP, USEARCH_ON, &status); + + if (U_FAILURE(status)) + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("failed to perform ICU search: %s", + u_errorName(status)))); + + for (int32_t u16_pos = usearch_first(usearch, &status); + u16_pos != USEARCH_DONE; + u16_pos = usearch_next(usearch, &status)) + { + if (U_FAILURE(status)) + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("failed to perform ICU search: %s", + u_errorName(status)))); + + /* ICU bug, When pattern start with a surrogate pair ICU usearch_next stops moving forward entering an infinite loop */ + if (u16_pos == pos_prev_loop) + { + int32_t next_char_idx = u16_pos + UCHAR_LENGTH(src_uchar[u16_pos]); + + if (is_substr_starts_with_surrogate && next_char_idx < src_ulen) + { + usearch_setOffset(usearch, next_char_idx, &status); + + if (U_FAILURE(status)) + ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("failed to set offset in ICU search: %s", u_errorName(status)))); + + continue; + } + else + break; + } + + pos_prev_loop = u16_pos; + + /* for CS_AI collations usearch can give false positives so we double check the results here */ + if (!(is_CS_AI && icu_compare_utf8_coll(mylocale->info.icu.ucol, &src_uchar[usearch_getMatchedStart(usearch)], usearch_getMatchedLength(usearch), substr_uchar, substr_ulen, false) != 0)) + { + u8_pos = translate_char_pos(VARDATA_ANY(src_text), src_len_utf8, + src_uchar, src_ulen, u16_pos, + NULL); + break; + } + } + + pfree(src_uchar); + pfree(substr_uchar); + usearch_close(usearch); + + /* return 0 if not found or the 1-based position of substr_text inside src_text */ + *r = u8_pos + 1; + return true; +#else + ereport(ERROR, + (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), + errmsg("pltsql strpos requires ICU library, which is not available"))); +#endif + } + + return false; +} + +bool +pltsql_replace_non_determinstic(text *src_text, text *from_text, text *to_text, Oid collid, text **r) +{ + pg_locale_t mylocale = 0; + + check_collation_set(collid); + + if (!lc_collate_is_c(collid)) + mylocale = pg_newlocale_from_collation(collid); + else + return false; + + if (!pg_locale_deterministic(mylocale) && mylocale->provider == 'i') + { +#ifdef USE_ICU + const char *src_text_currptr = VARDATA_ANY(src_text); + const char* src_text_startptr = VARDATA_ANY(src_text); + int32_t src_len = VARSIZE_ANY_EXHDR(src_text); + int32_t from_str_len = VARSIZE_ANY_EXHDR(from_text); + int32_t to_str_len = VARSIZE_ANY_EXHDR(to_text); + int32_t previous_pos, pos_prev_loop = -1; + int32_t src_ulen, from_ulen; /* in utf-16 units */ + UErrorCode status = U_ZERO_ERROR; + UStringSearch *usearch; + UChar *src_uchar, *from_uchar; + text *result; + StringInfoData resbuf; + coll_info_t coll_info_of_inputcollid = tsql_lookup_collation_table_internal(collid); + bool is_CS_AI = false; + bool is_substr_starts_with_surrogate; + + if (OidIsValid(coll_info_of_inputcollid.oid) && + coll_info_of_inputcollid.collateflags == 0x000e /* CS_AI */ ) + { + is_CS_AI = true; + } + + src_ulen = icu_to_uchar(&src_uchar, VARDATA_ANY(src_text), src_len); + from_ulen = icu_to_uchar(&from_uchar, VARDATA_ANY(from_text), from_str_len); + + is_substr_starts_with_surrogate = UCHAR_IS_SURROGATE(from_uchar[0]); + + usearch = usearch_openFromCollator(from_uchar, /* needle */ + from_ulen, + src_uchar, /* haystack */ + src_ulen, + mylocale->info.icu.ucol, + NULL, + &status); + + usearch_setAttribute(usearch, USEARCH_OVERLAP, USEARCH_ON, &status); + + initStringInfo(&resbuf); + previous_pos = 0; + + for (int32_t pos = usearch_first(usearch, &status); + pos != USEARCH_DONE; + pos = usearch_next(usearch, &status)) + { + const char *src_text_nextptr; + int32_t matched_length; + + if (U_FAILURE(status)) + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("failed to perform ICU search: %s", + u_errorName(status)))); + + /* ICU bug, When pattern start with a surrogate pair ICU usearch_next stops moving forward entering an infinite loop */ + if (pos == pos_prev_loop) + { + int32_t next_char_idx = pos + UCHAR_LENGTH(src_uchar[pos]); + + if (is_substr_starts_with_surrogate && next_char_idx < src_ulen) + { + usearch_setOffset(usearch, next_char_idx, &status); + + if (U_FAILURE(status)) + ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("failed to set offset in ICU search: %s", u_errorName(status)))); + + continue; + } + else + break; + } + + pos_prev_loop = pos; + + /* for CS_AI collations usearch can give false positives so we double check the results here */ + if (is_CS_AI && icu_compare_utf8_coll(mylocale->info.icu.ucol, &src_uchar[usearch_getMatchedStart(usearch)], usearch_getMatchedLength(usearch), from_uchar, from_ulen, false) != 0) + continue; + + /* reject if overlaps with the last successful match */ + if (pos < previous_pos) + continue; + + /* copy the segment before the match */ + translate_char_pos( + src_text_currptr, + src_len - (src_text_currptr - src_text_startptr), + src_uchar + previous_pos, + src_ulen - previous_pos, + pos - previous_pos, + &src_text_nextptr); + + appendBinaryStringInfo(&resbuf, + src_text_currptr, + src_text_nextptr - src_text_currptr); + + + matched_length = usearch_getMatchedLength(usearch); + + /* compute the length of the replaced text in txt1 */ + translate_char_pos( + src_text_nextptr, + src_len - (src_text_nextptr - src_text_startptr), + src_uchar + pos, + matched_length, + matched_length, + &src_text_currptr); + + /* append the replacement text */ + appendBinaryStringInfo(&resbuf, VARDATA_ANY(to_text), to_str_len); + + previous_pos = pos + matched_length; + } + + /* copy the segment after the last match */ + if (previous_pos) + { + if (src_len - (src_text_currptr - src_text_startptr) > 0) + { + appendBinaryStringInfo(&resbuf, + src_text_currptr, + src_len - (src_text_currptr - src_text_startptr)); + } + result = cstring_to_text_with_len(resbuf.data, resbuf.len); + pfree(resbuf.data); + } + else + { + /* + * The substring is not found: return the original string + */ + result = src_text; + } + + pfree(src_uchar); + pfree(from_uchar); + + if (usearch != NULL) + usearch_close(usearch); + + if (U_FAILURE(status)) + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("failed to perform ICU search: %s", + u_errorName(status)))); + + *r = result; + return true; +#else + ereport(ERROR, + (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), + errmsg("pltsql replace requires ICU library, which is not available"))); +#endif + } + return false; +} + +/* + * Find the matched length for substr in src_text + * Only matches if substr is prefix of src_text + */ +static bool +icu_find_matched_length(char *src_text, int src_len, char *substr_text, int substr_len, Oid collid, int *matched_len, bool is_cs_ai) +{ + pg_locale_t mylocale = 0; + + if (!lc_collate_is_c(collid)) + mylocale = pg_newlocale_from_collation(collid); + + if (!pg_locale_deterministic(mylocale) && mylocale->provider == 'i') + { +#ifdef USE_ICU + int32_t src_len_utf8 = src_len; + int32_t substr_len_utf8 = substr_len; + int32_t src_ulen, substr_ulen; + int32_t u16_pos, u8_pos = 0; + UErrorCode status = U_ZERO_ERROR; + UStringSearch *usearch; + UChar *src_uchar, *substr_uchar; + int32 matched_length_u16, u8_endpos; + + src_ulen = icu_to_uchar(&src_uchar, src_text, src_len_utf8); + substr_ulen = icu_to_uchar(&substr_uchar, substr_text, substr_len_utf8); + + usearch = usearch_openFromCollator(substr_uchar, + substr_ulen, + src_uchar, + src_ulen, + mylocale->info.icu.ucol, + NULL, + &status); + if (U_FAILURE(status)) + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("failed to perform ICU search: %s", + u_errorName(status)))); + + /* substr should start matching from the first position in src string */ + u16_pos = usearch_first(usearch, &status); + if (!U_FAILURE(status) && u16_pos != USEARCH_DONE && u16_pos == 0 && (!is_cs_ai || + icu_compare_utf8_coll(mylocale->info.icu.ucol, src_uchar, usearch_getMatchedLength(usearch), substr_uchar, substr_len_utf8, false) == 0)) + { + /* u16 position will only be zero */ + matched_length_u16 = usearch_getMatchedLength(usearch); + u8_endpos = translate_char_pos(src_text, src_len_utf8, + src_uchar, src_ulen, + matched_length_u16, NULL); + *matched_len = u8_endpos; + } + else + u8_pos = -1; + + pfree(src_uchar); + pfree(substr_uchar); + usearch_close(usearch); + + return u8_pos < 0 ? false : true; +#else + ereport(ERROR, + (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), + errmsg("ICU find matched length requires ICU library"))); +#endif + } + + return false; +} + +static void +next_char(char **p, int *plen) +{ + int l = pg_mblen(*p); + + if (l > *plen) + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("malformed string"))); + + (*p) += l; + *plen -= l; +} + +static int +patindex_ai_match_text(pg_locale_t mylocale, char *input_str, char *pattern, Oid cid, bool is_cs_ai) +{ + bool start_offset = false; + int itr = 0; + + if (pattern == NULL || strlen(pattern) == 0) + return 0; + + while (pattern != NULL && *pattern != '\0' && *pattern == '%') + { + pattern++; + start_offset = true; + } + + /* pattern only contained % wildcard */ + if (pattern == NULL || *pattern == '\0') + return 1; + + while (*input_str != '\0') + { + char *t = input_str; + char *p = pattern; + int tlen = strlen(t), + plen = strlen(pattern); + bool match_failed = false; + + itr++; + + while (tlen > 0 && plen > 0) + { + if (*p == '%') + { + if (patindex_ai_match_text(mylocale, t, p, cid, is_cs_ai)) + return itr; + else + return 0; + } + else if (*p == '_') + { + /* _ matches any single character, and we know there is one */ + next_char(&t, &tlen); + next_char(&p, &plen); + continue; + } + else if (*p == '[') + { + /* Tsql deal with [ and ] wild character */ + bool find_match = false, reverse_mode = false, close_bracket = false; + const char *prev = NULL; + + next_char(&p, &plen); + if (plen > 0 && *p == '^') + { + reverse_mode = true; + next_char(&p, &plen); + } + while (plen > 0) + { + if (*p == ']') + { + close_bracket = true; + next_char(&p, &plen); + break; + } + if (find_match) + { + next_char(&p, &plen); + continue; + } + if (*p == '-' && prev && plen > 1 && *(p+1) != ']') + { + UChar *t_uchar, *p_uchar, *prev_uchar; + int32_t t_ulen, prev_ulen, p_ulen; + next_char(&p, &plen); + Assert(cid != InvalidOid); + t_ulen = icu_to_uchar(&t_uchar, t, pg_mblen(t)); + prev_ulen = icu_to_uchar(&prev_uchar, prev, pg_mblen(prev)); + p_ulen = icu_to_uchar(&p_uchar, p, pg_mblen(p)); + + if (icu_compare_utf8_coll(mylocale->info.icu.ucol, t_uchar, t_ulen, prev_uchar, prev_ulen, is_cs_ai) >= 0 && + icu_compare_utf8_coll(mylocale->info.icu.ucol, t_uchar, t_ulen, p_uchar, p_ulen, is_cs_ai) <= 0) + { + find_match = true; + } + prev = NULL; + next_char(&p, &plen); + } + else + { + int p_start_len = plen, matched_idx = 0; + char *p_start = p; + text *src_text, *substr_text; + prev = NULL; + + /* find the string till the next special character, '-' is a special char only if prev and next exists */ + while (plen > 0 && *p != ']' && !(prev && *p == '-')) + { + prev = p; + next_char(&p, &plen); + } + + src_text = cstring_to_text_with_len(p_start, p_start_len - plen); + substr_text = cstring_to_text_with_len(t, pg_mblen(t)); + + if (pltsql_strpos_non_determinstic(src_text, substr_text, cid, &matched_idx) && matched_idx != 0) + { + find_match = true; + } + pfree(src_text); + pfree(substr_text); + } + } + + if (close_bracket && (find_match ^ reverse_mode)) /* found a match */ + next_char(&t, &tlen); + else + { + match_failed = true; + break; + } + } + else + { + char *p_start = p; + int len = plen, matched_len = 0; + + while (plen > 0 && *p != '[' && *p != '_' && *p != '%') + { + next_char(&p, &plen); + } + if (icu_find_matched_length(t, strlen(t), p_start, len-plen, cid, &matched_len, is_cs_ai)) + { + while (matched_len--) + next_char(&t, &tlen); + } + else + { + match_failed = true; + break; + } + } + } + + if (tlen > 0 && !match_failed) + { + while (tlen > 0 && *t == ' ') + next_char(&t, &tlen); + if (tlen <= 0 && plen <=0) + return itr; + } + + /* + * End of text, but perhaps not of pattern. Match if the remaining + * pattern can match a zero-length string, ie, it's zero or more %'s. + */ + while (plen > 0 && *p == '%') + next_char(&p, &plen); + if (plen <= 0 && !match_failed) + return itr; + + if (start_offset) + input_str += pg_mblen(input_str); + else + break; + } + + return 0; +} + +PG_FUNCTION_INFO_V1(patindex_ai_collations); +Datum +patindex_ai_collations(PG_FUNCTION_ARGS) +{ + pg_locale_t mylocale = 0; + char *pattern = text_to_cstring(PG_GETARG_TEXT_PP(0)); + char *input_str = text_to_cstring(PG_GETARG_TEXT_PP(1)); + Oid cid = PG_GET_COLLATION(); + int result = 0; + bool is_CS_AI = false; + coll_info_t coll_info_of_inputcollid; + + check_collation_set(cid); + + coll_info_of_inputcollid = tsql_lookup_collation_table_internal(cid); + + if (OidIsValid(coll_info_of_inputcollid.oid)) + { + is_CS_AI = coll_info_of_inputcollid.collateflags == 0x000e; /* CS_AI ? */ + } + else + { + ereport(ERROR, + (errcode(ERRCODE_INDETERMINATE_COLLATION), + errmsg("patindex is not supported with non babelfish non deterministic collations"))); + } + + if (!lc_collate_is_c(cid)) + { + mylocale = pg_newlocale_from_collation(cid); + + if (!pg_locale_deterministic(mylocale) && mylocale->provider == 'i') + result = patindex_ai_match_text(mylocale, input_str, pattern, cid, is_CS_AI); + } + + pfree(input_str); + pfree(pattern); + + PG_RETURN_INT32(result); +} diff --git a/contrib/babelfishpg_tsql/src/collation.h b/contrib/babelfishpg_tsql/src/collation.h index de332cf412c..95f4c9448f9 100644 --- a/contrib/babelfishpg_tsql/src/collation.h +++ b/contrib/babelfishpg_tsql/src/collation.h @@ -40,6 +40,12 @@ typedef struct like_ilike_info Oid ilike_opfuncid; /* oid for corresponding ILIKE func */ } like_ilike_info_t; +typedef struct remove_accent_map_pair +{ + uint32 original_char; + uint32 normalized_char; +} remove_accent_map_pair; + /* match definition in babelfishpg_common:collation.h */ typedef struct collation_callbacks { @@ -56,6 +62,8 @@ typedef struct collation_callbacks Datum (*is_collated_ci_as_internal) (PG_FUNCTION_ARGS); + Datum (*is_collated_ai_internal) (PG_FUNCTION_ARGS); + int (*collationproperty_helper) (const char *collationaname, const char *property); bytea *(*tdscollationproperty_helper) (const char *collationaname, const char *property); @@ -84,6 +92,7 @@ extern collation_callbacks *collation_callbacks_ptr; extern Oid tsql_get_server_collation_oid_internal(bool missingOk); extern Datum tsql_collation_list_internal(PG_FUNCTION_ARGS); extern Datum tsql_is_collated_ci_as_internal(PG_FUNCTION_ARGS); +extern Datum tsql_is_collated_ai_internal(PG_FUNCTION_ARGS); extern int tsql_collationproperty_helper(const char *collationaname, const char *property); extern bytea *tsql_tdscollationproperty_helper(const char *collationaname, const char *property); extern bool tsql_is_server_collation_CI_AS(void); @@ -95,6 +104,8 @@ like_ilike_info_t tsql_lookup_like_ilike_table_internal(Oid opno); int tsql_find_cs_as_collation_internal(int collidx); int tsql_find_collation_internal(const char *collation_name); extern const char *tsql_translate_bbf_collation_to_tsql_collation(const char *collname); +extern bool pltsql_strpos_non_determinstic(text *t1, text *t2, Oid collid, int *r); +extern bool pltsql_replace_non_determinstic(text *t1, text *t2, text *t3, Oid collid, text **result); /* Utility functions */ extern bool has_ilike_node_and_ci_as_coll(Node *expr); diff --git a/contrib/babelfishpg_tsql/src/dbcmds.c b/contrib/babelfishpg_tsql/src/dbcmds.c index ce843abef32..cbd67ee8096 100644 --- a/contrib/babelfishpg_tsql/src/dbcmds.c +++ b/contrib/babelfishpg_tsql/src/dbcmds.c @@ -751,6 +751,8 @@ drop_bbf_db(const char *dbname, bool missing_ok, bool force_drop) } /* clean up bbf view def catalog */ clean_up_bbf_view_def(dbid); + /* clean up bbf partition metadata */ + clean_up_bbf_partition_metadata(dbid); /* clean up bbf function catalog */ clean_up_bbf_function_ext(dbid); /* clean up bbf namespace catalog accordingly */ diff --git a/contrib/babelfishpg_tsql/src/hooks.c b/contrib/babelfishpg_tsql/src/hooks.c index b641a985e8f..4ab732bd17a 100644 --- a/contrib/babelfishpg_tsql/src/hooks.c +++ b/contrib/babelfishpg_tsql/src/hooks.c @@ -11,6 +11,7 @@ #include "utils/pg_locale.h" #include "access/xact.h" #include "access/relation.h" +#include "access/reloptions.h" #include "catalog/namespace.h" #include "catalog/objectaccess.h" #include "catalog/pg_aggregate.h" @@ -148,7 +149,7 @@ static void fill_missing_values_in_copyfrom(Relation rel, Datum *values, bool *n /***************************************** * Utility Hooks *****************************************/ -static void pltsql_report_proc_not_found_error(List *names, List *argnames, int nargs, ParseState *pstate, int location, bool proc_call); +static void pltsql_report_proc_not_found_error(List *names, List *fargs, List *argnames, Oid *input_typeids, int nargs, ParseState *pstate, int location, bool proc_call); extern PLtsql_execstate *get_outermost_tsql_estate(int *nestlevel); extern PLtsql_execstate *get_current_tsql_estate(); static void pltsql_store_view_definition(const char *queryString, ObjectAddress address); @@ -184,9 +185,7 @@ static bool bbf_check_rowcount_hook(int es_processed); static char *get_local_schema_for_bbf_functions(Oid proc_nsp_oid); extern bool called_from_tsql_insert_exec(); -extern Datum pltsql_exec_tsql_cast_value(Datum value, bool *isnull, - Oid valtype, int32 valtypmod, - Oid reqtype, int32 reqtypmod); +extern bool called_for_tsql_itvf_func(); static void is_function_pg_stat_valid(FunctionCallInfo fcinfo, PgStat_FunctionCallUsage *fcu, char prokind, bool finalize); @@ -203,6 +202,7 @@ static void logicalrep_modify_slot(Relation rel, EState *estate, TupleTableSlot static object_access_hook_type prev_object_access_hook = NULL; static void bbf_object_access_hook(ObjectAccessType access, Oid classId, Oid objectId, int subId, void *arg); static void revoke_func_permission_from_public(Oid objectId); +static bool is_partitioned_table_reloptions_allowed(Datum reloptions); /***************************************** * Planner Hook @@ -261,9 +261,13 @@ static get_bbf_admin_oid_hook_type prev_get_bbf_admin_oid_hook = NULL; static transform_pivot_clause_hook_type pre_transform_pivot_clause_hook = NULL; static pass_pivot_data_to_fcinfo_hook_type pre_pass_pivot_data_to_fcinfo_hook = NULL; static called_from_tsql_insert_exec_hook_type pre_called_from_tsql_insert_exec_hook = NULL; +static called_for_tsql_itvf_func_hook_type prev_called_for_tsql_itvf_func_hook = NULL; static exec_tsql_cast_value_hook_type pre_exec_tsql_cast_value_hook = NULL; static pltsql_pgstat_end_function_usage_hook_type prev_pltsql_pgstat_end_function_usage_hook = NULL; static pltsql_unique_constraint_nulls_ordering_hook_type prev_pltsql_unique_constraint_nulls_ordering_hook = NULL; +static pltsql_strpos_non_determinstic_hook_type prev_pltsql_strpos_non_determinstic_hook = NULL; +static pltsql_replace_non_determinstic_hook_type prev_pltsql_replace_non_determinstic_hook = NULL; +static pltsql_is_partitioned_table_reloptions_allowed_hook_type prev_pltsql_is_partitioned_table_reloptions_allowed_hook = NULL; /***************************************** * Install / Uninstall @@ -444,6 +448,9 @@ InstallExtendedHooks(void) pre_called_from_tsql_insert_exec_hook = called_from_tsql_insert_exec_hook; called_from_tsql_insert_exec_hook = called_from_tsql_insert_exec; + prev_called_for_tsql_itvf_func_hook = called_for_tsql_itvf_func_hook; + called_for_tsql_itvf_func_hook = called_for_tsql_itvf_func; + pre_exec_tsql_cast_value_hook = exec_tsql_cast_value_hook; exec_tsql_cast_value_hook = pltsql_exec_tsql_cast_value; @@ -455,6 +462,16 @@ InstallExtendedHooks(void) prev_pltsql_unique_constraint_nulls_ordering_hook = pltsql_unique_constraint_nulls_ordering_hook; pltsql_unique_constraint_nulls_ordering_hook = unique_constraint_nulls_ordering; + + prev_pltsql_strpos_non_determinstic_hook = pltsql_strpos_non_determinstic_hook; + pltsql_strpos_non_determinstic_hook = pltsql_strpos_non_determinstic; + + prev_pltsql_replace_non_determinstic_hook = pltsql_replace_non_determinstic_hook; + pltsql_replace_non_determinstic_hook = pltsql_replace_non_determinstic; + + prev_pltsql_is_partitioned_table_reloptions_allowed_hook = pltsql_is_partitioned_table_reloptions_allowed_hook; + pltsql_is_partitioned_table_reloptions_allowed_hook = is_partitioned_table_reloptions_allowed; + } void @@ -516,8 +533,12 @@ UninstallExtendedHooks(void) transform_pivot_clause_hook = pre_transform_pivot_clause_hook; optimize_explicit_cast_hook = prev_optimize_explicit_cast_hook; called_from_tsql_insert_exec_hook = pre_called_from_tsql_insert_exec_hook; + called_for_tsql_itvf_func_hook = prev_called_for_tsql_itvf_func_hook; pltsql_pgstat_end_function_usage_hook = prev_pltsql_pgstat_end_function_usage_hook; pltsql_unique_constraint_nulls_ordering_hook = prev_pltsql_unique_constraint_nulls_ordering_hook; + pltsql_strpos_non_determinstic_hook = prev_pltsql_strpos_non_determinstic_hook; + pltsql_replace_non_determinstic_hook = prev_pltsql_replace_non_determinstic_hook; + pltsql_is_partitioned_table_reloptions_allowed_hook = prev_pltsql_is_partitioned_table_reloptions_allowed_hook; bbf_InitializeParallelDSM_hook = NULL; bbf_ParallelWorkerMain_hook = NULL; @@ -1438,7 +1459,7 @@ check_insert_row(List *icolumns, List *exprList, Oid relid) } char * -extract_identifier(const char *start) +extract_identifier(const char *start, int *last_pos) { /* * We will extract original identifier from source query string. 'start' @@ -1491,6 +1512,8 @@ extract_identifier(const char *start) original_name = palloc(i + 1); memcpy(original_name, start, i); original_name[i] = '\0'; + if (last_pos) + *last_pos = i; return original_name; } } @@ -1508,6 +1531,8 @@ extract_identifier(const char *start) if (!valid) { + if (last_pos) + *last_pos = i + 1; if (!found_escaped_in_dq) { /* no escaped character. copy whole string at once */ @@ -1553,6 +1578,8 @@ extract_identifier(const char *start) if (!valid) { + if (last_pos) + *last_pos = i + 1; if (!found_escaped_in_sq) { /* no escaped character. copy whole string at once */ @@ -1594,6 +1621,8 @@ extract_identifier(const char *start) * bracket */ memcpy(original_name, start + 1, i - 1); original_name[i - 1] = '\0'; + if (last_pos) + *last_pos = i + 1; return original_name; } } @@ -1604,6 +1633,42 @@ extract_identifier(const char *start) return NULL; } +/* + * extract_multipart_identifier_name + * Return name of a multipart SQL identifier, whose starting position + * is given as 'start'. This helper function basically returns the + * last part of the multipart identifier. + */ +static char * +extract_multipart_identifier_name(const char *start) +{ + int identifier_len = strlen(start); + int last_pos = 0; + char *name = extract_identifier(start, &last_pos); + + /* Loop until we find the last part of the identifier */ + while (last_pos < identifier_len) + { + int cur_pos = 0; + if (isspace(start[last_pos])) + { + last_pos++; + continue; + } + if (start[last_pos] != '.') + break; + + last_pos++; + while (isspace(start[last_pos])) + last_pos++; + pfree(name); + name = extract_identifier(start + last_pos, &cur_pos); + last_pos += cur_pos; + } + + return name; +} + extern const char *ATTOPTION_BBF_ORIGINAL_NAME; static void @@ -1623,7 +1688,7 @@ pltsql_post_transform_column_definition(ParseState *pstate, RangeVar *relation, * string. */ const char *column_name_start = pstate->p_sourcetext + column->location; - char *original_name = extract_identifier(column_name_start); + char *original_name = extract_identifier(column_name_start, NULL); if (original_name == NULL) ereport(ERROR, @@ -1663,8 +1728,7 @@ pltsql_post_transform_table_definition(ParseState *pstate, RangeVar *relation, c * string. */ char *table_name_start, - *original_name, - *temp; + *original_name; /* * Skip during restore since reloptions are also dumped using separate @@ -1678,24 +1742,7 @@ pltsql_post_transform_table_definition(ParseState *pstate, RangeVar *relation, c table_name_start = (char *) pstate->p_sourcetext + relation->location; - /* - * Could be the case that the fully qualified name is included, so just - * find the text after '.' in the identifier. We need to be careful as - * there can be '.' in the table name itself, so we will break the loop if - * current string matches with actual relname. - */ - temp = strpbrk(table_name_start, ". "); - while (temp && temp[0] != ' ' && - strncasecmp(relname, table_name_start, strlen(relname)) != 0 && - strncasecmp(relname, table_name_start + 1, strlen(relname)) != 0) /* match after skipping - * delimiter */ - { - temp += 1; - table_name_start = temp; - temp = strpbrk(table_name_start, ". "); - } - - original_name = extract_identifier(table_name_start); + original_name = extract_multipart_identifier_name(table_name_start); if (original_name == NULL) ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), @@ -1952,7 +1999,21 @@ pre_transform_target_entry(ResTarget *res, ParseState *pstate, colname_start = pstate->p_sourcetext + res->location; last_dot = colname_start; while(*colname_start != '\0') - { + { + /* + * comment follow up with column like : + * + * 'SELECT table1.c2--table1.REPGETTEXT(' + * + * will cause crash if we don't break the searching + * for the last_dot position + */ + if (*colname_start == '-' && *(colname_start+1) == '-') + { + last_dot++; + colname_start = last_dot; + break; + } if(open_square_bracket == 0 && *colname_start == '"') { double_quotes++; @@ -2028,7 +2089,7 @@ pre_transform_target_entry(ResTarget *res, ParseState *pstate, } /* To extract the identifier name from the query.*/ - original_name = extract_identifier(colname_start); + original_name = extract_identifier(colname_start, NULL); actual_alias_len = strlen(original_name); /* Maximum alias_len can be 63 after truncation. If alias_len is smaller than actual_alias_len, @@ -2422,7 +2483,7 @@ get_trigger_object_address(List *object, Relation *relp, bool missing_ok, bool o /* Generate similar error message with SQL Server when function/procedure is not found if possible. */ void -pltsql_report_proc_not_found_error(List *names, List *given_argnames, int nargs, ParseState *pstate, int location, bool proc_call) +pltsql_report_proc_not_found_error(List *names, List *fargs, List *given_argnames, Oid *input_typeids, int nargs, ParseState *pstate, int location, bool proc_call) { FuncCandidateList candidates = NULL, current_candidate = NULL; @@ -2430,6 +2491,8 @@ pltsql_report_proc_not_found_error(List *names, List *given_argnames, int nargs, int min_nargs = INT_MAX; int ncandidates = 0; bool found = false; + char *schemaname; + char *funcname; const char *obj_type = proc_call ? "procedure" : "function"; candidates = FuncnameGetCandidates(names, -1, NIL, false, false, false, true); /* search all possible @@ -2469,6 +2532,18 @@ pltsql_report_proc_not_found_error(List *names, List *given_argnames, int nargs, */ if (found) { + if (!proc_call) + { + /* deconstruct the names list */ + DeconstructQualifiedName(names, &schemaname, &funcname); + + /* + * Check whether function is an special function or not, and + * report appropriate error if applicable + */ + validate_special_function(schemaname, funcname, fargs, nargs, input_typeids); + } + ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), errmsg("The %s %s is found but cannot be used. Possibly due to datatype mismatch and implicit casting is not allowed.", obj_type, NameListToString(names))), @@ -2590,7 +2665,7 @@ pltsql_report_proc_not_found_error(List *names, List *given_argnames, int nargs, char *str; /* Fetch default positions */ - arg_default_positions = SysCacheGetAttr(PROCNSPSIGNATURE, + arg_default_positions = SysCacheGetAttr(PROCNAMENSPSIGNATURE, bbffunctuple, Anum_bbf_function_ext_default_positions, &isnull); @@ -2604,7 +2679,7 @@ pltsql_report_proc_not_found_error(List *names, List *given_argnames, int nargs, pfree(str); } else - ReleaseSysCache(bbffunctuple); + heap_freetuple(bbffunctuple); } } @@ -2684,7 +2759,7 @@ pltsql_report_proc_not_found_error(List *names, List *given_argnames, int nargs, if (default_positions_available) { - ReleaseSysCache(bbffunctuple); + heap_freetuple(bbffunctuple); } pfree(langname); } @@ -2696,8 +2771,8 @@ pltsql_report_proc_not_found_error(List *names, List *given_argnames, int nargs, errmsg("%s %s has no parameters and arguments were supplied.", obj_type, NameListToString(names))), parser_errposition(pstate, location)); } + ReleaseSysCache(tup); } - ReleaseSysCache(tup); } } @@ -3261,7 +3336,7 @@ pltsql_store_func_default_positions(ObjectAddress address, List *parameters, con proctup, oldtup; Form_pg_proc form_proctup; - NameData *schema_name_NameData, *objname_data; + NameData *schema_name_NameData; char *physical_schemaname; char *func_signature; char *original_name = NULL; @@ -3271,8 +3346,6 @@ pltsql_store_func_default_positions(ObjectAddress address, List *parameters, con uint64 flag_values = 0, flag_validity = 0; char *original_query = get_original_query_string(); - ScanKeyData key[2]; - TableScanDesc tblscan; /* Disallow extended catalog lookup during restore */ if (babelfish_dump_restore) @@ -3345,30 +3418,11 @@ pltsql_store_func_default_positions(ObjectAddress address, List *parameters, con * To get original function name, utilize location of original name * and query string. */ - char *func_name_start, - *temp; - const char *funcname = NameStr(form_proctup->proname); + char *func_name_start; func_name_start = (char *) queryString + origname_location; - /* - * Could be the case that the fully qualified name is included, so - * just find the text after '.' in the identifier. We need to be - * careful as there can be '.' in the function name itself, so we will - * break the loop if current string matches with actual funcname. - */ - temp = strpbrk(func_name_start, ". "); - while (temp && temp[0] != ' ' && - strncasecmp(funcname, func_name_start, strlen(funcname)) != 0 && - strncasecmp(funcname, func_name_start + 1, strlen(funcname)) != 0) /* match after skipping - * delimiter */ - { - temp += 1; - func_name_start = temp; - temp = strpbrk(func_name_start, ". "); - } - - original_name = extract_identifier(func_name_start); + original_name = extract_multipart_identifier_name(func_name_start); if (original_name == NULL) ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), @@ -3423,22 +3477,7 @@ pltsql_store_func_default_positions(ObjectAddress address, List *parameters, con new_record_nulls[Anum_bbf_function_ext_definition - 1] = true; new_record_replaces[Anum_bbf_function_ext_default_positions - 1] = true; - ScanKeyInit(&key[0], - Anum_bbf_function_ext_nspname, - BTEqualStrategyNumber, F_NAMEEQ, - NameGetDatum(schema_name_NameData)); - objname_data = (NameData *) palloc0(NAMEDATALEN); - snprintf(objname_data->data, NAMEDATALEN, "%s", NameStr(form_proctup->proname)); - ScanKeyInit(&key[1], - Anum_bbf_function_ext_funcname, - BTEqualStrategyNumber, F_NAMEEQ, - NameGetDatum(objname_data)); - - // scan - tblscan = table_beginscan_catalog(bbf_function_ext_rel, 2, key); - - // get the scan result -> original tuple - oldtup = heap_getnext(tblscan, ForwardScanDirection); + oldtup = get_bbf_function_tuple_from_proctuple(proctup); if (HeapTupleIsValid(oldtup)) { @@ -3446,6 +3485,7 @@ pltsql_store_func_default_positions(ObjectAddress address, List *parameters, con new_record, new_record_nulls, new_record_replaces); CatalogTupleUpdate(bbf_function_ext_rel, &tuple->t_self, tuple); + heap_freetuple(oldtup); } else { @@ -3466,11 +3506,11 @@ pltsql_store_func_default_positions(ObjectAddress address, List *parameters, con recordDependencyOn(&address, &index, DEPENDENCY_NORMAL); } - pfree(physical_schemaname); pfree(func_signature); + pfree(physical_schemaname); + pfree(schema_name_NameData); ReleaseSysCache(proctup); heap_freetuple(tuple); - heap_endscan(tblscan); table_close(bbf_function_ext_rel, RowExclusiveLock); } @@ -3609,7 +3649,7 @@ pltsql_drop_func_default_positions(Oid objectId) CatalogTupleDelete(bbf_function_ext_rel, &bbffunctuple->t_self); table_close(bbf_function_ext_rel, RowExclusiveLock); - ReleaseSysCache(bbffunctuple); + heap_freetuple(bbffunctuple); } ReleaseSysCache(proctuple); @@ -3719,7 +3759,7 @@ match_pltsql_func_call(HeapTuple proctup, int nargs, List *argnames, bool isnull; /* Fetch default positions */ - arg_default_positions = SysCacheGetAttr(PROCNSPSIGNATURE, + arg_default_positions = SysCacheGetAttr(PROCNAMENSPSIGNATURE, bbffunctuple, Anum_bbf_function_ext_default_positions, &isnull); @@ -3746,12 +3786,12 @@ match_pltsql_func_call(HeapTuple proctup, int nargs, List *argnames, /* we could not find defaults for some arguments. */ if (idx < pronargs) { - ReleaseSysCache(bbffunctuple); + heap_freetuple(bbffunctuple); return false; } } - ReleaseSysCache(bbffunctuple); + heap_freetuple(bbffunctuple); } } } @@ -3899,7 +3939,7 @@ PlTsqlMatchNamedCall(HeapTuple proctup, int nargs, List *argnames, } /* Fetch default positions */ - arg_default_positions = SysCacheGetAttr(PROCNSPSIGNATURE, + arg_default_positions = SysCacheGetAttr(PROCNAMENSPSIGNATURE, bbffunctuple, Anum_bbf_function_ext_default_positions, &isnull); @@ -3915,7 +3955,7 @@ PlTsqlMatchNamedCall(HeapTuple proctup, int nargs, List *argnames, pfree(str); } else - ReleaseSysCache(bbffunctuple); + heap_freetuple(bbffunctuple); } for (pp = numposargs; pp < pronargs; pp++) @@ -3972,7 +4012,7 @@ PlTsqlMatchNamedCall(HeapTuple proctup, int nargs, List *argnames, } if (default_positions_available) - ReleaseSysCache(bbffunctuple); + heap_freetuple(bbffunctuple); if (!match_found) return false; @@ -4065,7 +4105,7 @@ replace_pltsql_function_defaults(HeapTuple func_tuple, List *defaults, List *far int position,i,j; /* Fetch default positions */ - arg_default_positions = SysCacheGetAttr(PROCNSPSIGNATURE, + arg_default_positions = SysCacheGetAttr(PROCNAMENSPSIGNATURE, bbffunctuple, Anum_bbf_function_ext_default_positions, &isnull); @@ -4147,7 +4187,7 @@ replace_pltsql_function_defaults(HeapTuple func_tuple, List *defaults, List *far } ++i; } - ReleaseSysCache(bbffunctuple); + heap_freetuple(bbffunctuple); return ret; } @@ -4181,7 +4221,7 @@ insert_pltsql_function_defaults(HeapTuple func_tuple, List *defaults, Node **arg bool isnull; /* Fetch default positions */ - arg_default_positions = SysCacheGetAttr(PROCNSPSIGNATURE, + arg_default_positions = SysCacheGetAttr(PROCNAMENSPSIGNATURE, bbffunctuple, Anum_bbf_function_ext_default_positions, &isnull); @@ -4206,7 +4246,7 @@ insert_pltsql_function_defaults(HeapTuple func_tuple, List *defaults, Node **arg } } - ReleaseSysCache(bbffunctuple); + heap_freetuple(bbffunctuple); } else { @@ -4284,7 +4324,7 @@ print_pltsql_function_arguments(StringInfo buf, HeapTuple proctup, char *str; /* Fetch default positions */ - arg_default_positions = SysCacheGetAttr(PROCNSPSIGNATURE, + arg_default_positions = SysCacheGetAttr(PROCNAMENSPSIGNATURE, bbffunctuple, Anum_bbf_function_ext_default_positions, &isnull); @@ -4298,7 +4338,7 @@ print_pltsql_function_arguments(StringInfo buf, HeapTuple proctup, pfree(str); } else - ReleaseSysCache(bbffunctuple); + heap_freetuple(bbffunctuple); } /* Check for special treatment of ordered-set aggregates */ @@ -4424,7 +4464,7 @@ print_pltsql_function_arguments(StringInfo buf, HeapTuple proctup, } if (default_positions_available) - ReleaseSysCache(bbffunctuple); + heap_freetuple(bbffunctuple); return argsprinted; } @@ -4772,7 +4812,9 @@ fill_missing_values_in_copyfrom(Relation rel, Datum *values, bool *nulls) relid == namespace_ext_oid || relid == bbf_view_def_oid || relid == bbf_extended_properties_oid || - relid == bbf_schema_perms_oid) + relid == bbf_schema_perms_oid || + relid == bbf_partition_scheme_oid || + relid == bbf_partition_depend_oid) { AttrNumber attnum; @@ -4806,6 +4848,25 @@ fill_missing_values_in_copyfrom(Relation rel, Datum *values, bool *nulls) nulls[attnum - 1] = false; } } + + /* + * Insert new scheme_id column value in babelfish_partition_scheme + * if dump did not provide it. + */ + if (relid == bbf_partition_scheme_oid) + { + AttrNumber attnum; + + attnum = (AttrNumber) attnameAttNum(rel, "scheme_id", false); + Assert(attnum != InvalidAttrNumber); + + if (nulls[attnum - 1]) + { + int32 scheme_id = get_available_partition_scheme_id(); + values[attnum - 1] = Int32GetDatum(scheme_id); + nulls[attnum - 1] = false; + } + } } static bool @@ -5188,3 +5249,32 @@ unique_constraint_nulls_ordering(ConstrType constraint_type, SortByDir ordering) return SORTBY_NULLS_DEFAULT; } + +/* + * is_partitioned_table_reloptions_allowed + * This function checks if the given reloptions are allowed or not for partitioned tables. + * Returns true if allowed, false otherwise. + * + * Only bbf_rel_create_date and bbf_original_rel_name reloptions + * are allowed in TSQL dialect and while restoring babelfish database. + */ +static bool +is_partitioned_table_reloptions_allowed(Datum reloptions) +{ + if (sql_dialect == SQL_DIALECT_TSQL || babelfish_dump_restore) + { + List *options = untransformRelOptions(reloptions); + ListCell *cell; + + foreach(cell, options) + { + DefElem *defel = (DefElem *) lfirst(cell); + + if (pg_strcasecmp(defel->defname, ATTOPTION_BBF_TABLE_CREATE_DATE) != 0 && + pg_strcasecmp(defel->defname, ATTOPTION_BBF_ORIGINAL_TABLE_NAME) != 0) + return false; + + } + } + return true; +} diff --git a/contrib/babelfishpg_tsql/src/hooks.h b/contrib/babelfishpg_tsql/src/hooks.h index 19fe9a2c1fa..3f606f83d42 100644 --- a/contrib/babelfishpg_tsql/src/hooks.h +++ b/contrib/babelfishpg_tsql/src/hooks.h @@ -17,7 +17,6 @@ void pre_wrapper_pgstat_init_function_usage(const char *); pg_locale_t *collation_cache_entry_hook_function(Oid ,pg_locale_t *); extern bool output_update_transformation; extern bool output_into_insert_transformation; -extern char *extract_identifier(const char *start); extern char *gen_func_arg_list(Oid objectId); extern char * gen_func_arg_list_from_params(List* parameters); extern void pltsql_store_func_default_positions(ObjectAddress address, @@ -32,6 +31,9 @@ extern void alter_bbf_schema_permissions_catalog(ObjectWithArgs *owa, extern Oid get_tsql_trigger_oid(List *object, const char *tsql_trigger_name, bool object_from_input); +extern Datum pltsql_exec_tsql_cast_value(Datum value, bool *isnull, + Oid valtype, int32 valtypmod, + Oid reqtype, int32 reqtypmod); extern void pltsql_bbfSelectIntoUtility(ParseState *pstate, PlannedStmt *pstmt, const char *queryString, QueryEnvironment *queryEnv, ParamListInfo params, QueryCompletion *qc); diff --git a/contrib/babelfishpg_tsql/src/iterative_exec.c b/contrib/babelfishpg_tsql/src/iterative_exec.c index 1cc7fe11fcc..2f45698a391 100644 --- a/contrib/babelfishpg_tsql/src/iterative_exec.c +++ b/contrib/babelfishpg_tsql/src/iterative_exec.c @@ -819,6 +819,24 @@ dispatch_stmt(PLtsql_execstate *estate, PLtsql_stmt *stmt) case PLTSQL_STMT_GRANTSCHEMA: exec_stmt_grantschema(estate, (PLtsql_stmt_grantschema *) stmt); break; + case PLTSQL_STMT_PARTITION_FUNCTION: + if (pltsql_explain_only) + { + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("Showing Estimated Execution Plan for PARTITION FUNCTION statment is not yet supported"))); + } + exec_stmt_partition_function(estate, (PLtsql_stmt_partition_function *) stmt); + break; + case PLTSQL_STMT_PARTITION_SCHEME: + if (pltsql_explain_only) + { + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("Showing Estimated Execution Plan for PARTITION SCHEME statment is not yet supported"))); + } + exec_stmt_partition_scheme(estate, (PLtsql_stmt_partition_scheme *) stmt); + break; case PLTSQL_STMT_FULLTEXTINDEX: if (pltsql_explain_only) { diff --git a/contrib/babelfishpg_tsql/src/multidb.c b/contrib/babelfishpg_tsql/src/multidb.c index f5115dac12c..323c86d6143 100644 --- a/contrib/babelfishpg_tsql/src/multidb.c +++ b/contrib/babelfishpg_tsql/src/multidb.c @@ -37,8 +37,6 @@ static bool is_select_for_json(SelectStmt *stmt); static void select_json_modify(SelectStmt *stmt); static bool is_for_json(FuncCall *fc); static bool get_array_wrapper(List *for_json_args); -static void set_schemaname_dbo_to_sys(RangeVar *rv); - /************************************************************* @@ -707,13 +705,6 @@ rewrite_relation_walker(Node *node, void *context) if (IsA(node, RangeVar)) { RangeVar *rv = (RangeVar *) node; - - /* - * For the list of catalog names if the schema name - * specified is 'dbo' then replace with 'sys'. - */ - set_schemaname_dbo_to_sys(rv); - rewrite_rangevar(rv); return false; } @@ -971,51 +962,6 @@ rewrite_rangevar(RangeVar *rv) } } -static void -set_schemaname_dbo_to_sys(RangeVar *rv) -{ - /* - * list_of_dbo_catalog - * Contains the list of sys% views which are not database specific - * - * list_of_dbo_catalog_not_supported_for_cross_db - * Contains the list of sys% views which are database specific - * - * NOTE: While adding the sys% views to list check whether view is an database specific or not. - * - */ - char* list_of_dbo_catalog[6]= {"sysprocesses", "syscharsets", "sysconfigures", "syscurconfigs", "syslanguages", "syslogins"}; - char* list_of_dbo_catalog_not_supported_for_cross_db[6]= {"syscolumns", "sysforeignkeys", "sysindexes", "sysobjects", "systypes", "sysusers"}; - if (rv->schemaname && strcmp(rv->schemaname, "dbo") == 0) - { - for (int i = 0; i < (sizeof(list_of_dbo_catalog)/sizeof(list_of_dbo_catalog[0])); i++) - { - if(rv->relname && strcmp(rv->relname, list_of_dbo_catalog[i]) == 0) - { - rv->schemaname = pstrdup("sys"); - break; - } - } - for (int i = 0; i < (sizeof(list_of_dbo_catalog_not_supported_for_cross_db)/sizeof(list_of_dbo_catalog_not_supported_for_cross_db[0])); i++) - { - if(rv->relname && strcmp(rv->relname, list_of_dbo_catalog_not_supported_for_cross_db[i]) == 0) - { - /* Throw error for dbo catalog which does not support cross-db */ - if (rv->catalogname && strcmp(get_cur_db_name(), rv->catalogname) != 0) - { - ereport(ERROR, - (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("Cross-DB system view query is not currently supported in Babelfish."))); - } - else - { - rv->schemaname = pstrdup("sys"); - break; - } - } - } - } -} static void rewrite_objectwithargs(ObjectWithArgs *obj) { @@ -1034,12 +980,12 @@ rewrite_plain_name(List *name) String *new_schema; if (is_shared_schema(strVal(schema))) - break; /* do not thing for shared schemas */ + break; /* do nothing for shared schemas */ new_schema = makeString(get_physical_schema_name(cur_db, strVal(schema))); /* - * ignoring the return value sinece list is valid and cannot + * ignoring the return value since list is valid and cannot * be empty */ name = list_delete_first(name); @@ -1062,7 +1008,7 @@ rewrite_plain_name(List *name) new_schema = makeString(get_physical_schema_name(strVal(db), strVal(schema))); /* - * ignoring the return value sinece list is valid and + * ignoring the return value since list is valid and * cannot be empty */ name = list_delete_first(name); @@ -1101,7 +1047,7 @@ is_shared_schema(const char *name) { if ((strcmp("sys", name) == 0) || (strcmp("information_schema_tsql", name) == 0)) - return true; /* babelfish shared schema */ + return true; /* Babelfish shared schema */ else if ((strcmp("public", name) == 0) || (strcmp("pg_catalog", name) == 0) || (strcmp("pg_toast", name) == 0) @@ -1275,7 +1221,7 @@ get_physical_schema_name_by_mode(char *db_name, const char *schema_name, Migrati } /* - * Parser guarantees identifier will alsways be truncated to 64B. Schema + * Parser guarantees identifier will always be truncated to 64B. Schema * name that comes from other source (e.g scheam_id function) needs one * more truncate function call */ @@ -1356,7 +1302,7 @@ get_physical_user_name(char *db_name, char *user_name, bool suppress_error) truncate_tsql_identifier(new_user_name); /* - * All the role and user names are prefixed. Historically, dbo and + * All role and user names are prefixed. Historically, dbo and * db_owner in single-db mode were unprefixed These are two exceptions to * the naming convention */ @@ -1509,8 +1455,8 @@ physical_schema_name_exists(char *phys_schema_name) } /* -* Assume the database already exists and it is not a built in database -*/ + * Assume the database already exists and it is not a built-in database + */ bool is_user_database_singledb(const char *dbname) { @@ -1518,7 +1464,6 @@ is_user_database_singledb(const char *dbname) return !is_builtin_database(dbname) && physical_schema_name_exists("dbo"); } - /************************************************************* * Helper Functions *************************************************************/ diff --git a/contrib/babelfishpg_tsql/src/pl_exec-2.c b/contrib/babelfishpg_tsql/src/pl_exec-2.c index 1c20406f1cb..0e2d3005cfe 100644 --- a/contrib/babelfishpg_tsql/src/pl_exec-2.c +++ b/contrib/babelfishpg_tsql/src/pl_exec-2.c @@ -5,6 +5,7 @@ #include "access/table.h" #include "access/attmap.h" +#include "access/nbtree.h" #include "catalog/namespace.h" #include "catalog/pg_attribute.h" #include "catalog/pg_language.h" @@ -16,12 +17,17 @@ #include "storage/lmgr.h" #include "storage/procarray.h" #include "pltsql_bulkcopy.h" +#include "pltsql_partition.h" #include "table_variable_mvcc.h" #include "catalog.h" #include "dbcmds.h" #include "pl_explain.h" +#include "pltsql.h" #include "session.h" +#include "parser/scansup.h" +#include "parser/parse_oper.h" +#include "src/include/lib/qunique.h" /* helper function to get current T-SQL estate */ PLtsql_execstate *get_current_tsql_estate(void); @@ -56,6 +62,8 @@ static int exec_stmt_usedb_explain(PLtsql_execstate *estate, PLtsql_stmt_usedb * static int exec_stmt_grantdb(PLtsql_execstate *estate, PLtsql_stmt_grantdb *stmt); static int exec_stmt_fulltextindex(PLtsql_execstate *estate, PLtsql_stmt_fulltextindex *stmt); static int exec_stmt_grantschema(PLtsql_execstate *estate, PLtsql_stmt_grantschema *stmt); +static int exec_stmt_partition_function(PLtsql_execstate *estate, PLtsql_stmt_partition_function *stmt); +static int exec_stmt_partition_scheme(PLtsql_execstate *estate, PLtsql_stmt_partition_scheme *stmt); static int exec_stmt_insert_execute_select(PLtsql_execstate *estate, PLtsql_expr *expr); static int exec_stmt_insert_bulk(PLtsql_execstate *estate, PLtsql_stmt_insert_bulk *expr); static int exec_stmt_dbcc(PLtsql_execstate *estate, PLtsql_stmt_dbcc *stmt); @@ -4057,3 +4065,376 @@ exec_stmt_fulltextindex(PLtsql_execstate *estate, PLtsql_stmt_fulltextindex *stm return PLTSQL_RC_OK; } + +/* + * tsql_compare_values + * Note: This function is used to sort the values in the array. + * It compare two datum values using the function oid of comparator provided in arg, + * it also sets the contains_duplicate flag in the context if duplicate + * values are found. + * Returns -1 if a < b, 1 if a > b and 0 if a == b. + */ +int +tsql_compare_values(const void *a, const void *b, void *arg) +{ + Datum *da = (Datum *) a; + Datum *db = (Datum *) b; + int result; + + tsql_compare_context *cxt = (tsql_compare_context *) arg; + + result = DatumGetInt32(OidFunctionCall2Coll(cxt->function_oid, cxt->colloid, *da, *db)); + if (result == 0) + cxt->contains_duplicate = true; + return result; +} + +/* + * check_create_or_drop_permission_for_partition_specifier + * Checks if the current user has permission to create or drop a partition + * function or partition scheme. It allows only those logins that is either + * db owner or member of sysadmin. + */ +static void +check_create_or_drop_permission_for_partition_specifier(const char *name, bool is_create, bool is_function) +{ + char *dbname = get_cur_db_name(); + Oid session_user_id = GetSessionUserId(); + char *login = GetUserNameFromId(session_user_id, false); + bool login_is_db_owner = false; + + if (strncmp(login, get_owner_of_db(dbname), NAMEDATALEN) == 0) + login_is_db_owner = true; + + if (!login_is_db_owner && !is_member_of_role(session_user_id, get_role_oid("sysadmin", false))) + { + if (is_create) + ereport(ERROR, + (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), + errmsg("User does not have permission to perform this action."))); + else + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("Cannot drop the partition %s '%s', because it does not exist or you do not have permission.", + (is_function? "function": "scheme"), name))); + } + + pfree(dbname); + pfree(login); +} + +/* + * exec_stmt_partition_scheme + * Handles the CREATE/DROP PARTITION FUNCTION statement. + */ +static int +exec_stmt_partition_function(PLtsql_execstate *estate, PLtsql_stmt_partition_function *stmt) +{ + const char *partition_function_name = stmt->function_name; + PLtsql_type *typ = stmt->datatype; + List *arg = stmt->args; + bool isnull; + Oid valtype; + int32 valtypmod; + Datum tsql_type_datum; + char *tsql_typename = NULL; + Datum *input_values; + Datum *sql_variant_values; + ArrayType *arr_value = NULL; + Oid sql_variant_oid; + Oid basetype_oid; + Oid opclass_oid; + Oid opfamily_oid; + Oid cmpfunction_oid; + int nargs; + HeapTuple tuple; + Form_pg_type typform; + int16 dbid = get_cur_db_id(); + tsql_compare_context cxt; + LOCAL_FCINFO(fcinfo, 1); + + /* check if the login has necessary permissions for CREATE/DROP */ + check_create_or_drop_permission_for_partition_specifier(partition_function_name, stmt->is_create, true); + + if (!stmt->is_create) /* drop command */ + { + /* delete entry from the sys.babelfish_partition_scheme catalog */ + remove_entry_from_bbf_partition_function(dbid, partition_function_name); + /* make sure later statements in batch can see the updated catalog entry */ + CommandCounterIncrement(); + return PLTSQL_RC_OK; + } + + /* + * Otherwise, Create Command. + */ + + /* check if given name is exceeding the allowed limit */ + if (strlen(partition_function_name) > 128) + { + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("The identifier that starts with '%.128s' is too long. Maximum length is 128.", partition_function_name))); + } + + /* check if there is existing partition function with the given name in the current database */ + if (partition_function_exists(dbid, partition_function_name)) + { + ereport(ERROR, + (errcode(ERRCODE_DUPLICATE_FUNCTION), + errmsg("There is already an object named '%s' in the database.", partition_function_name))); + } + + /* + * Try to find the TSQL type name for the input type and if it fails + * and input type is DOMAIN type created in sys schema then + * find the TSQL type name using the base type of DOMAIN. + */ + InitFunctionCallInfoData(*fcinfo, NULL, 0, InvalidOid, NULL, NULL); + fcinfo->args[0].value = ObjectIdGetDatum(typ->typoid); + fcinfo->args[0].isnull = false; + tsql_type_datum = (*common_utility_plugin_ptr->translate_pg_type_to_tsql) (fcinfo); + if (tsql_type_datum) + { + tsql_typename = text_to_cstring(DatumGetTextPP(tsql_type_datum)); + } + else + { + tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typ->typoid)); + typform = (Form_pg_type) GETSTRUCT(tuple); + if (OidIsValid(typform->typbasetype) && typform->typnamespace == get_namespace_oid("sys", false)) + { + /* Input type is DOMAIN type created in sys schema. */ + InitFunctionCallInfoData(*fcinfo, NULL, 0, InvalidOid, NULL, NULL); + fcinfo->args[0].value = ObjectIdGetDatum(typform->typbasetype); + fcinfo->args[0].isnull = false; + tsql_type_datum = (*common_utility_plugin_ptr->translate_pg_type_to_tsql) (fcinfo); + if (tsql_type_datum) + { + tsql_typename = text_to_cstring(DatumGetTextPP(tsql_type_datum)); + } + } + ReleaseSysCache(tuple); + } + + /* + * Check if datatype is supported or not, if tsql_typename is NULL + * then it implies that type is User Defined Type. + */ + if (!tsql_typename || is_tsql_text_ntext_or_image_datatype(typ->typoid) || + (*common_utility_plugin_ptr->is_tsql_geometry_datatype) (typ->typoid) || + (*common_utility_plugin_ptr->is_tsql_geography_datatype) (typ->typoid) || + (*common_utility_plugin_ptr->is_tsql_rowversion_or_timestamp_datatype) (typ->typoid) || + typ->typoid == XMLOID) /* we don't have XML type specific to TSQL */ + { + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("The type '%s' is not valid for this operation.", typ->typname))); + } + /* + * Types varchar(max), nvarchar(max), varbinary(max) are also not supported. + */ + else if (typ->atttypmod == -1 && is_tsql_datatype_with_max_scale_expr_allowed(typ->typoid)) + { + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("The type '%s(max)' is not valid for this operation.", tsql_typename))); + } + else if ((*common_utility_plugin_ptr->is_tsql_sqlvariant_datatype) (typ->typoid)) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("The type '%s' is not yet supported for partition function in Babelfish.", tsql_typename))); + + /* check if the given number of boundaries are exceeding allowed limit */ + nargs = list_length(arg); + if (nargs >= MAX_PARTITIONS_LIMIT) + { + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("CREATE/ALTER partition function failed as only a " + "maximum of %d partitions can be created.", MAX_PARTITIONS_LIMIT))); + } + + input_values = palloc(nargs * sizeof(Datum)); + + for (volatile int i = 0; i < nargs; i++) + { + Datum val; + + /* evaluate the value from the expr */ + val = exec_eval_expr(estate, list_nth(arg, i), &isnull, &valtype, &valtypmod); + + /* raise error for null value */ + if (isnull) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("NULL values are not allowed in partition function boundary values list."))); + + /* + * implicitly convert range values to specified parameter type + * and raise error with ordinal position if conversion fails + */ + PG_TRY(); + { + input_values[i] = exec_cast_value(estate, val, &isnull, + valtype, valtypmod, + typ->typoid, typ->atttypmod); + } + PG_CATCH(); + { + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("Could not implicitly convert range values type specified at ordinal %d to partition function parameter type.", + i+1))); + } + PG_END_TRY(); + } + + /* + * Find oid of comparator function for input type, which will be used during the sorting. + * Here, we are first finding the default operator class for the input type then using that + * we are finding the operator family for that operator class and finally using that we are + * finding the defined comparator function for that operator family. + */ + basetype_oid = getBaseType(typ->typoid); + opclass_oid = GetDefaultOpClass(basetype_oid, BTREE_AM_OID); + opfamily_oid = get_opclass_family(opclass_oid); + cmpfunction_oid = get_opfamily_proc(opfamily_oid, basetype_oid, basetype_oid, + BTORDER_PROC); + + /* set the function oid of operator in tsql comparator context */ + cxt.function_oid = cmpfunction_oid; + cxt.colloid = tsql_get_server_collation_oid_internal(false); + cxt.contains_duplicate = false; + + /* + * sort the datum values using quick sort, we don't need to worry about worst case + * of quick sort here when the array is already sorted, the function qsort_arg() + * itself first checks and returns the same array if values already sorted. + */ + qsort_arg(input_values, nargs, sizeof(Datum), tsql_compare_values, &cxt); + + /* raise error if input contains duplicate value */ + if (cxt.contains_duplicate) + { + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("Duplicate values are not allowed in partition function boundary values list."))); + } + + sql_variant_oid = (*common_utility_plugin_ptr->get_tsql_datatype_oid) ("sql_variant"); + sql_variant_values = palloc(nargs * sizeof(Datum)); + /* cast each value to sql_variant datatype */ + for (int i = 0; i < nargs; i++) + { + sql_variant_values[i] = exec_cast_value(estate, input_values[i], &isnull, + typ->typoid, typ->atttypmod, + sql_variant_oid, + -1); + } + + /* construct array object from the values which needs to inserted in the catalog */ + arr_value = construct_array(sql_variant_values, nargs, sql_variant_oid, + -1, false, 'i'); + + /* add entry in the sys.babelfish_partition_function catalog */ + add_entry_to_bbf_partition_function(dbid, partition_function_name, tsql_typename, stmt->is_right, arr_value); + + pfree(tsql_typename); + pfree(input_values); + pfree(sql_variant_values); + pfree(arr_value); + + /* cleanup estate */ + exec_eval_cleanup(estate); + + /* make sure later statements in batch can see the updated catalog entry */ + CommandCounterIncrement(); + return PLTSQL_RC_OK; +} + +/* + * exec_stmt_partition_scheme + * Handles the CREATE/DROP PARTITION SCHEME statement. + */ +static int +exec_stmt_partition_scheme(PLtsql_execstate *estate, PLtsql_stmt_partition_scheme *stmt) +{ + const char *partition_scheme_name = stmt->scheme_name; + bool next_used = false; + int filegroups = stmt->filegroups; + char *partition_func_name = stmt->function_name; + int16 dbid = get_cur_db_id(); + + /* check if the login has necessary permissions for CREATE/DROP */ + check_create_or_drop_permission_for_partition_specifier(partition_scheme_name, stmt->is_create, false); + + if (!stmt->is_create) /* drop command */ + { + /* delete entry from the sys.babelfish_partition_scheme catalog */ + remove_entry_from_bbf_partition_scheme(dbid, partition_scheme_name); + /* make sure later statements in batch can see the updated catalog entry */ + CommandCounterIncrement(); + return PLTSQL_RC_OK; + } + + /* + * Otherwise, Create Command. + */ + + /* check if given name is exceeding the allowed limit */ + if (strlen(partition_scheme_name) > 128) + { + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("The identifier that starts with '%.128s' is too long. Maximum length is 128.", + partition_scheme_name))); + } + + /* raise error if provided partition function doesn't exists in the current database */ + if (!partition_function_exists(dbid, partition_func_name)) + { + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("Invalid object name '%s'.", partition_func_name))); + } + + /* + * perform next_used calculation check if it is specified + * filegroups are sufficient for the partitions which + * will be created using the given partition function + */ + if (filegroups == -1) /* implies that ALL option was used */ + { + next_used = true; + } + else + { + int partition_count = get_partition_count(dbid, partition_func_name); + if (filegroups < partition_count) + { + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("The associated partition function '%s' generates more partitions than there are file groups mentioned in the scheme '%s'.", + partition_func_name, partition_scheme_name))); + } + else if (filegroups > partition_count) + { + next_used = true; + } + } + + /* check if there is existing partition scheme with the given name in the current database */ + if (partition_scheme_exists(dbid, partition_scheme_name)) + { + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("There is already an object named '%s' in the database.", partition_scheme_name))); + } + /* add entry in the sys.babelfish_partition_scheme catalog */ + add_entry_to_bbf_partition_scheme(dbid, partition_scheme_name, partition_func_name, next_used); + + /* make sure later statements in batch can see the updated catalog entry */ + CommandCounterIncrement(); + return PLTSQL_RC_OK; +} diff --git a/contrib/babelfishpg_tsql/src/pl_exec.c b/contrib/babelfishpg_tsql/src/pl_exec.c index 9d2ea93c733..aa054dcea8b 100644 --- a/contrib/babelfishpg_tsql/src/pl_exec.c +++ b/contrib/babelfishpg_tsql/src/pl_exec.c @@ -491,6 +491,18 @@ extern int static void pltsql_exec_function_cleanup(PLtsql_execstate *estate, PLtsql_function *func, ErrorContextCallback *plerrcontext); +static bool called_for_tsql_itvf_function = false; +bool called_for_tsql_itvf_func(void); + + +bool +called_for_tsql_itvf_func() +{ + if (sql_dialect != SQL_DIALECT_TSQL) + return false; + return called_for_tsql_itvf_function; +} + /* ---------- * pltsql_exec_function Called by the call handler for * function execution. @@ -668,7 +680,13 @@ pltsql_exec_function(PLtsql_function *func, FunctionCallInfo fcinfo, if (pltsql_trace_exec_time) config.trace_mode |= TRACE_EXEC_TIME; + /* + * Following variable will be used inside exec_stmt_iterative function to + * identify whether the function is ITVF function or not + */ + called_for_tsql_itvf_function = func->is_itvf; rc = exec_stmt_iterative(&estate, func->exec_codes, &config); + called_for_tsql_itvf_function = false; if (rc != PLTSQL_RC_RETURN) { @@ -4612,6 +4630,9 @@ exec_stmt_execsql(PLtsql_execstate *estate, /* fetch current search_path */ char *old_search_path = NULL; + bool ro_func = (estate->func->fn_prokind == PROKIND_FUNCTION) && + (estate->func->fn_is_trigger == PLTSQL_NOT_TRIGGER) && + (strcmp(estate->func->fn_signature, "inline_code_block") != 0); if (stmt->original_query) original_query_string = stmt->original_query; @@ -4786,7 +4807,7 @@ exec_stmt_execsql(PLtsql_execstate *estate, * tsql_select_assign_stmt (select @a=1). with ANTLR=off, it is * handled in PLtsql_stmt_query_set. */ - if (stmt->need_to_push_result || stmt->is_tsql_select_assign_stmt || stmt->mod_stmt_tablevar) + if (stmt->need_to_push_result || stmt->is_tsql_select_assign_stmt || ro_func) enable_txn_in_triggers = false; if (enable_txn_in_triggers) @@ -5055,10 +5076,7 @@ exec_stmt_execsql(PLtsql_execstate *estate, if ((!pltsql_disable_batch_auto_commit || (stmt->txn_data != NULL)) && pltsql_support_tsql_transactions() && (enable_txn_in_triggers || estate->trigdata == NULL) && - !(estate->func->fn_prokind == PROKIND_FUNCTION && - estate->func->fn_is_trigger == PLTSQL_NOT_TRIGGER && - strcmp(estate->func->fn_signature, "inline_code_block") != 0) && - !estate->insert_exec) + !ro_func && !estate->insert_exec) { commit_stmt(estate, (estate->tsql_trigger_flags & TSQL_TRAN_STARTED)); @@ -10283,8 +10301,9 @@ reset_search_path(PLtsql_stmt_execsql *stmt, char **old_search_path, bool *reset *old_search_path = flatten_search_path(path_oids); list_free(path_oids); } - new_search_path = psprintf("%s, %s, %s", physical_schema, dbo_schema, *old_search_path); + new_search_path = psprintf("%s, %s, %s", quote_identifier(physical_schema), quote_identifier(dbo_schema), *old_search_path); + pfree(physical_schema); /* * Add the schema where the object is referenced and dbo * schema to the new search path @@ -10292,6 +10311,7 @@ reset_search_path(PLtsql_stmt_execsql *stmt, char **old_search_path, bool *reset (void) set_config_option("search_path", new_search_path, PGC_USERSET, PGC_S_SESSION, GUC_ACTION_SAVE, true, 0, false); + pfree(new_search_path); return true; } else if (top_es_entry->estate->db_name != NULL && stmt->is_ddl) @@ -10332,8 +10352,9 @@ reset_search_path(PLtsql_stmt_execsql *stmt, char **old_search_path, bool *reset *old_search_path = flatten_search_path(path_oids); list_free(path_oids); } - new_search_path = psprintf("%s, %s, %s", physical_schema, dbo_schema, *old_search_path); + new_search_path = psprintf("%s, %s, %s", quote_identifier(physical_schema), quote_identifier(dbo_schema), *old_search_path); + pfree(physical_schema); /* * Add the schema where the object is referenced and dbo * schema to the new search path @@ -10341,6 +10362,7 @@ reset_search_path(PLtsql_stmt_execsql *stmt, char **old_search_path, bool *reset (void) set_config_option("search_path", new_search_path, PGC_USERSET, PGC_S_SESSION, GUC_ACTION_SAVE, true, 0, false); + pfree(new_search_path); return true; } } @@ -10361,8 +10383,9 @@ reset_search_path(PLtsql_stmt_execsql *stmt, char **old_search_path, bool *reset *old_search_path = flatten_search_path(path_oids); list_free(path_oids); } - new_search_path = psprintf("%s, %s, %s", physical_schema, dbo_schema, *old_search_path); + new_search_path = psprintf("%s, %s, %s", quote_identifier(physical_schema), quote_identifier(dbo_schema), *old_search_path); + pfree(physical_schema); /* * Add the schema where the object is referenced and dbo schema to the * new search path @@ -10370,8 +10393,11 @@ reset_search_path(PLtsql_stmt_execsql *stmt, char **old_search_path, bool *reset (void) set_config_option("search_path", new_search_path, PGC_USERSET, PGC_S_SESSION, GUC_ACTION_SAVE, true, 0, false); + pfree(new_search_path); return true; } + + pfree(cur_dbname); return false; } diff --git a/contrib/babelfishpg_tsql/src/pl_funcs-2.c b/contrib/babelfishpg_tsql/src/pl_funcs-2.c index 1d2cfa107ba..12774b168c5 100644 --- a/contrib/babelfishpg_tsql/src/pl_funcs-2.c +++ b/contrib/babelfishpg_tsql/src/pl_funcs-2.c @@ -12,6 +12,7 @@ #include "utils/builtins.h" #include "utils/numeric.h" #include "utils/syscache.h" +#include "catalog/pg_proc.h" static int cmpfunc(const void *a, const void *b) @@ -350,6 +351,60 @@ coalesce_typmod_hook_impl(const CoalesceExpr *cexpr) return exprTypmod((Node *) linitial(cexpr->args)); } +void +check_restricted_stored_procedure(Oid proc_id) +{ + HeapTuple proctup; + Form_pg_proc procform; + const char *procname; + Oid schema_oid = InvalidOid; + Oid dbo_oid = InvalidOid; + bool is_restricted = false; + + /* + * List of procedure names that are not allowed to be dropped. These procedures + * are considered essential or restricted due to security or operational reasons. + */ + static const char *restricted_procedures[] = { + "xp_qv", + "xp_instance_regread", + "sp_addlinkedsrvlogin", + "sp_droplinkedsrvlogin", + "sp_dropserver", + "sp_enum_oledb_providers", + "sp_testlinkedserver" + }; + static const int RESTRICTED_PROCEDURES_COUNT = sizeof(restricted_procedures) / sizeof(restricted_procedures[0]); + + proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(proc_id)); + + procform = (Form_pg_proc) GETSTRUCT(proctup); + procname = pstrdup(NameStr(procform->proname)); + schema_oid = procform->pronamespace; + dbo_oid = get_namespace_oid("master_dbo", true); + + if (OidIsValid(schema_oid) && OidIsValid(dbo_oid) && schema_oid == dbo_oid) + { + /* Check if the procedure name is in the restricted list */ + for (int i = 0; i < RESTRICTED_PROCEDURES_COUNT; i++) + { + if (pg_strcasecmp(procname, restricted_procedures[i]) == 0) + { + is_restricted = true; + break; + } + } + } + + ReleaseSysCache(proctup); + if (is_restricted) + { + ereport(ERROR, + (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), + errmsg("must be owner of procedure %s", procname))); + } +} + /*********************************************************************************** * FREE FUNCTIONS **********************************************************************************/ @@ -487,6 +542,8 @@ free_stmt2(PLtsql_stmt *stmt) case PLTSQL_STMT_CHANGE_DBOWNER: case PLTSQL_STMT_FULLTEXTINDEX: case PLTSQL_STMT_GRANTSCHEMA: + case PLTSQL_STMT_PARTITION_FUNCTION: + case PLTSQL_STMT_PARTITION_SCHEME: case PLTSQL_STMT_SET_EXPLAIN_MODE: { /* Nothing to free */ diff --git a/contrib/babelfishpg_tsql/src/pl_gram.y b/contrib/babelfishpg_tsql/src/pl_gram.y index 9f384211997..a144f1d3617 100644 --- a/contrib/babelfishpg_tsql/src/pl_gram.y +++ b/contrib/babelfishpg_tsql/src/pl_gram.y @@ -7232,8 +7232,18 @@ parse_datatype(const char *string, int location) typmod = 1 + VARHDRSZ; /* for varchar/nvarchar/varbinary(MAX), set typmod back to -1 */ - else if (typmod == TSQLMaxTypmod && is_tsql_datatype_with_max_scale_expr_allowed(type_id)) - typmod = -1; + else if (typmod == TSQLMaxTypmod) + { + if (is_tsql_datatype_with_max_scale_expr_allowed(type_id)) + typmod = -1; + else + { + DeconstructQualifiedName(typeName->names, &schemaName, &dataTypeName); + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("Incorrect syntax near the keyword '%s'.", dataTypeName))); + } + } else if (typmod > (VARCHAR_MAX_SCALE + VARHDRSZ) && (is_tsql_varchar_or_char_datatype(type_id) || is_tsql_binary_or_varbinary_datatype(type_id))) { diff --git a/contrib/babelfishpg_tsql/src/pl_handler.c b/contrib/babelfishpg_tsql/src/pl_handler.c index b1353e0a4a9..9e6988d2e69 100644 --- a/contrib/babelfishpg_tsql/src/pl_handler.c +++ b/contrib/babelfishpg_tsql/src/pl_handler.c @@ -87,6 +87,7 @@ #include "schemacmds.h" #include "session.h" #include "pltsql.h" +#include "pltsql_partition.h" #include "pl_explain.h" #include "table_variable_mvcc.h" @@ -140,6 +141,7 @@ static void call_prev_ProcessUtility(PlannedStmt *pstmt, static void set_pgtype_byval(List *name, bool byval); static void pltsql_proc_get_oid_proname_proacl(AlterFunctionStmt *stmt, ParseState *pstate, Oid *oid, Acl **acl, bool *isSameFunc); static void pg_proc_update_oid_acl(ObjectAddress address, Oid oid, Acl *acl); +static void bbf_func_ext_update_proc_definition(Oid oid); static bool pltsql_truncate_identifier(char *ident, int len, bool warn); static Name pltsql_cstr_to_name(char *s, int len); extern void pltsql_add_guc_plan(CachedPlanSource *plansource); @@ -518,22 +520,28 @@ pltsql_pre_parse_analyze(ParseState *pstate, RawStmt *parseTree) relid = RangeVarGetRelid(stmt->relation, NoLock, false); /* - * Insert new dbid and owner columns value in babelfish catalog - * if dump did not provide it. + * Insert new dbid, owner, function_id and scheme_id column values + * in babelfish catalog if dump did not provide it. */ if (relid == sysdatabases_oid || relid == namespace_ext_oid || relid == bbf_view_def_oid || relid == bbf_extended_properties_oid || - relid == bbf_schema_perms_oid) + relid == bbf_schema_perms_oid || + relid == bbf_partition_function_oid || + relid == bbf_partition_scheme_oid || + relid == bbf_partition_depend_oid) { ResTarget *col = NULL; A_Const *dbidValue = NULL; A_Const *ownerValue = NULL; bool dbid_found = false; bool owner_found = false; + bool function_id_found = false; + bool scheme_id_found = false; - /* Skip if dbid and owner column already exists */ + + /* Skip if dbid, owner, function_id and scheme_id column already exists */ foreach(lc, stmt->cols) { ResTarget *col1 = (ResTarget *) lfirst(lc); @@ -543,8 +551,16 @@ pltsql_pre_parse_analyze(ParseState *pstate, RawStmt *parseTree) if (relid == sysdatabases_oid && pg_strcasecmp(col1->name, "owner") == 0) owner_found = true; + if (relid == bbf_partition_function_oid && + pg_strcasecmp(col1->name, "function_id") == 0) + function_id_found = true; + if (relid == bbf_partition_scheme_oid && + pg_strcasecmp(col1->name, "scheme_id") == 0) + scheme_id_found = true; } - if (dbid_found && (owner_found || relid != sysdatabases_oid)) + if (dbid_found && (owner_found || relid != sysdatabases_oid) + && (function_id_found || relid != bbf_partition_function_oid) + && (scheme_id_found || relid != bbf_partition_scheme_oid)) break; /* @@ -591,6 +607,38 @@ pltsql_pre_parse_analyze(ParseState *pstate, RawStmt *parseTree) stmt->cols = lappend(stmt->cols, col); } + /* + * Populate function_id column in babelfish_partition_function catalog with + * new one. + */ + if (!function_id_found && relid == bbf_partition_function_oid) + { + /* function_id column to store into InsertStmt's target list */ + col = makeNode(ResTarget); + col->name = "function_id"; + col->name_location = -1; + col->indirection = NIL; + col->val = NULL; + col->location = -1; + stmt->cols = lappend(stmt->cols, col); + } + + /* + * Populate scheme_id column in babelfish_partition_scheme catalog with + * new one. + */ + if (!scheme_id_found && relid == bbf_partition_scheme_oid) + { + /* scheme_id column to store into InsertStmt's target list */ + col = makeNode(ResTarget); + col->name = "scheme_id"; + col->name_location = -1; + col->indirection = NIL; + col->val = NULL; + col->location = -1; + stmt->cols = lappend(stmt->cols, col); + } + foreach(lc, selectStmt->valuesLists) { List *sublist = (List *) lfirst(lc); @@ -599,6 +647,28 @@ pltsql_pre_parse_analyze(ParseState *pstate, RawStmt *parseTree) sublist = lappend(sublist, dbidValue); if (!owner_found && relid == sysdatabases_oid) sublist = lappend(sublist, ownerValue); + /* + * For babelfish_partition_function and babelfish_partition_scheme catalog, + * new ID needs to be added for each value in values clause. + */ + if (!function_id_found && relid == bbf_partition_function_oid) + { + /* const value node to store into value clause */ + A_Const *functionidValue = makeNode(A_Const); + functionidValue->val.ival.type = T_Integer; + functionidValue->location = -1; + functionidValue->val.ival.ival = get_available_partition_function_id(); + sublist = lappend(sublist, functionidValue); + } + if (!scheme_id_found && relid == bbf_partition_scheme_oid) + { + /* const value node to store into value clause */ + A_Const *schemeidValue = makeNode(A_Const); + schemeidValue->val.ival.type = T_Integer; + schemeidValue->location = -1; + schemeidValue->val.ival.ival = get_available_partition_scheme_id(); + sublist = lappend(sublist, schemeidValue); + } } } break; @@ -979,6 +1049,29 @@ pltsql_post_parse_analyze(ParseState *pstate, Query *query, JumbleState *jstate) switch (nodeTag(parsetree)) { + case T_CreateFunctionStmt: + { + ListCell *option; + CreateTrigStmt *trigStmt; + Relation rel; + foreach (option, ((CreateFunctionStmt *) parsetree)->options){ + DefElem *defel = (DefElem *) lfirst(option); + if (strcmp(defel->defname, "trigStmt") == 0) + { + trigStmt = (CreateTrigStmt *) defel->arg; + rel = table_openrv(trigStmt->relation, ShareRowExclusiveLock); + if (rel->rd_islocaltemp){ + ereport(ERROR, + (errcode(ERRCODE_WRONG_OBJECT_TYPE), + errmsg("Cannot create trigger on a temporary object."), + "Cannot create trigger on a temporary object." + )); + } + table_close(rel, NoLock); + } + } + } + break; case T_CreateStmt: { CreateStmt *stmt = (CreateStmt *) parsetree; @@ -2311,104 +2404,118 @@ bbf_ProcessUtility(PlannedStmt *pstmt, { case T_AlterFunctionStmt: { - /* - * For ALTER PROC, we will: - * 1. Save important pg_proc metadata from the current proc (oid, proacl) - * 2. drop the current proc - * 3. create the new proc - * 4. update the pg_proc entry for the new proc with metadata from the old proc - * 5. update the babelfish_function_ext entry for the existing proc with new metadata based on the new proc - */ - AlterFunctionStmt *stmt = (AlterFunctionStmt *) parsetree; - bool isCompleteQuery = (context != PROCESS_UTILITY_SUBCOMMAND); - bool needCleanup; - Oid oldoid; - Acl *proacl; - bool isSameProc; - ObjectAddress address; - CreateFunctionStmt *cfs; - ListCell *option, *location_cell = NULL; - int origname_location = -1; - bool with_recompile = false; - - if (stmt->objtype != OBJECT_PROCEDURE) - break; + if (sql_dialect == SQL_DIALECT_TSQL) + { + /* + * For ALTER PROC, we will: + * 1. Save important pg_proc metadata from the current proc (oid, proacl) + * 2. drop the current proc + * 3. create the new proc + * 4. update the pg_proc entry for the new proc with metadata from the old proc + * 5. update the babelfish_function_ext entry for the existing proc with new metadata based on the new proc + */ + AlterFunctionStmt *stmt = (AlterFunctionStmt *) parsetree; + bool isCompleteQuery = (context != PROCESS_UTILITY_SUBCOMMAND); + bool needCleanup; + Oid oldoid; + Acl *proacl; + bool isSameProc; + ObjectAddress address; + CreateFunctionStmt *cfs; + ListCell *option, *location_cell = NULL; + int origname_location = -1; + bool with_recompile = false; + + if (!IS_TDS_CLIENT()) + { + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("TSQL ALTER PROCEDURE is not supported from PostgreSQL endpoint."))); + } - /* All event trigger calls are done only when isCompleteQuery is true */ - needCleanup = isCompleteQuery && EventTriggerBeginCompleteQuery(); + if (stmt->objtype != OBJECT_PROCEDURE) + break; - /* PG_TRY block is to ensure we call EventTriggerEndCompleteQuery */ - PG_TRY(); - { - StartTransactionCommand(); - if (isCompleteQuery) - EventTriggerDDLCommandStart(parsetree); + /* All event trigger calls are done only when isCompleteQuery is true */ + needCleanup = isCompleteQuery && EventTriggerBeginCompleteQuery(); - foreach (option, stmt->actions) + /* PG_TRY block is to ensure we call EventTriggerEndCompleteQuery */ + PG_TRY(); { - DefElem *defel = (DefElem *) lfirst(option); - if (strcmp(defel->defname, "location") == 0) + StartTransactionCommand(); + if (isCompleteQuery) + EventTriggerDDLCommandStart(parsetree); + + foreach (option, stmt->actions) { - /* - * location is an implicit option in tsql dialect, - * we use this mechanism to store location of function - * name so that we can extract original input function - * name from queryString. - */ - origname_location = intVal((Node *) defel->arg); - location_cell = option; - pfree(defel); + DefElem *defel = (DefElem *) lfirst(option); + if (strcmp(defel->defname, "location") == 0) + { + /* + * location is an implicit option in tsql dialect, + * we use this mechanism to store location of function + * name so that we can extract original input function + * name from queryString. + */ + origname_location = intVal((Node *) defel->arg); + location_cell = option; + pfree(defel); + } + else if (strcmp(defel->defname, "recompile") == 0) + { + /* + * ALTER PROCEDURE ... WITH RECOMPILE + * Record RECOMPILE in catalog + */ + with_recompile = true; + } } - else if (strcmp(defel->defname, "recompile") == 0) - { - /* - * ALTER PROCEDURE ... WITH RECOMPILE - * Record RECOMPILE in catalog - */ - with_recompile = true; + + /* delete location cell if it exists as it is for internal use only */ + if (location_cell) + stmt->actions = list_delete_cell(stmt->actions, location_cell); + + /* make a CreateFunctionStmt to pass into CreateFunction() */ + cfs = makeNode(CreateFunctionStmt); + cfs->is_procedure = true; + cfs->replace = true; + cfs->funcname = stmt->func->objname; + cfs->parameters = stmt->func->objfuncargs; + cfs->returnType = NULL; + cfs->options = stmt->actions; + + pltsql_proc_get_oid_proname_proacl(stmt, pstate, &oldoid, &proacl, &isSameProc); + if (!isSameProc) /* i.e. different signature */ + RemoveFunctionById(oldoid); + address = CreateFunction(pstate, cfs); /* if this is the same proc, will just update the existing one */ + pg_proc_update_oid_acl(address, oldoid, proacl); + /* Update function/procedure related metadata in babelfish catalog */ + pltsql_store_func_default_positions(address, cfs->parameters, queryString, origname_location, with_recompile); + /* Increase counter after bbf_func_ext modified in pltsql_store_func_default_positions*/ + CommandCounterIncrement(); + bbf_func_ext_update_proc_definition(oldoid); + if (!isSameProc) { + /* + * When the signatures differ we need to manually update the 'function_args' column in + * the 'bbf_schema_permissions' catalog + */ + alter_bbf_schema_permissions_catalog(stmt->func, cfs->parameters, OBJECT_PROCEDURE, oldoid); } + /* Clean up table entries for the create function statement */ + deleteDependencyRecordsFor(DefaultAclRelationId, address.objectId, false); + deleteDependencyRecordsFor(ProcedureRelationId, address.objectId, false); + deleteSharedDependencyRecordsFor(ProcedureRelationId, address.objectId, 0); + CommitTransactionCommand(); } - - /* delete location cell if it exists as it is for internal use only */ - if (location_cell) - stmt->actions = list_delete_cell(stmt->actions, location_cell); - - /* make a CreateFunctionStmt to pass into CreateFunction() */ - cfs = makeNode(CreateFunctionStmt); - cfs->is_procedure = true; - cfs->replace = true; - cfs->funcname = stmt->func->objname; - cfs->parameters = stmt->func->objfuncargs; - cfs->returnType = NULL; - cfs->options = stmt->actions; - - pltsql_proc_get_oid_proname_proacl(stmt, pstate, &oldoid, &proacl, &isSameProc); - if (!isSameProc) /* i.e. different signature */ - RemoveFunctionById(oldoid); - address = CreateFunction(pstate, cfs); /* if this is the same proc, will just update the existing one */ - pg_proc_update_oid_acl(address, oldoid, proacl); - /* Update function/procedure related metadata in babelfish catalog */ - pltsql_store_func_default_positions(address, cfs->parameters, queryString, origname_location, with_recompile); - if (!isSameProc) { - /* - * When the signatures differ we need to manually update the 'function_args' column in - * the 'bbf_schema_permissions' catalog - */ - alter_bbf_schema_permissions_catalog(stmt->func, cfs->parameters, OBJECT_PROCEDURE, oldoid); + PG_FINALLY(); + { + if (needCleanup) + EventTriggerEndCompleteQuery(); } - /* Clean up table entries for the create function statement */ - deleteDependencyRecordsFor(DefaultAclRelationId, address.objectId, false); - deleteDependencyRecordsFor(ProcedureRelationId, address.objectId, false); - deleteSharedDependencyRecordsFor(ProcedureRelationId, address.objectId, 0); - CommitTransactionCommand(); - } - PG_FINALLY(); - { - if (needCleanup) - EventTriggerEndCompleteQuery(); + PG_END_TRY(); + return; } - PG_END_TRY(); - return; + break; } case T_AlterTableStmt: { @@ -2448,6 +2555,15 @@ bbf_ProcessUtility(PlannedStmt *pstmt, } } } + + /* + * Babelfish partitioned tables have specific security requirements to maintain data integrity. + * Non-superusers should not be permitted to attach, detach, or modify partitions of these tables. + */ + if (!babelfish_dump_restore && atstmt->objtype == OBJECT_TABLE && !superuser()) + { + bbf_alter_handle_partitioned_table(atstmt); + } break; } case T_TruncateStmt: @@ -2506,7 +2622,7 @@ bbf_ProcessUtility(PlannedStmt *pstmt, { int location = defel->location; - orig_loginname = extract_identifier(queryString + location); + orig_loginname = extract_identifier(queryString + location, NULL); login_options = lappend(login_options, defel); } else if (strcmp(defel->defname, "from_windows") == 0) @@ -2681,7 +2797,7 @@ bbf_ProcessUtility(PlannedStmt *pstmt, { char *orig_user_name; - orig_user_name = extract_identifier(queryString + location); + orig_user_name = extract_identifier(queryString + location, NULL); user_options = lappend(user_options, makeDefElem("original_user_name", (Node *) makeString(orig_user_name), @@ -2736,7 +2852,7 @@ bbf_ProcessUtility(PlannedStmt *pstmt, { char *orig_user_name; - orig_user_name = extract_identifier(queryString + location); + orig_user_name = extract_identifier(queryString + location, NULL); user_options = lappend(user_options, makeDefElem("original_user_name", (Node *) makeString(orig_user_name), @@ -3169,15 +3285,43 @@ bbf_ProcessUtility(PlannedStmt *pstmt, { RoleSpec *rolspec = lfirst(item); char *user_name; + const char *db_principal_type = drop_user ? "user" : "role"; + const char *db_owner_name; + int role_oid; + int rolename_len; + bool is_tsql_db_principal = false; user_name = get_physical_user_name(db_name, rolspec->rolename, false); + db_owner_name = get_db_owner_name(db_name); + role_oid = get_role_oid(user_name, true); + rolename_len = strlen(rolspec->rolename); + is_tsql_db_principal = OidIsValid(role_oid) && + ((drop_user && is_user(role_oid)) || + (drop_role && is_role(role_oid))); + + /* If user is dbo or role is db_owner, restrict dropping */ + if ((drop_user && rolename_len == 3 && strncmp(rolspec->rolename, "dbo", 3) == 0) || + (drop_role && rolename_len == 8 && strncmp(rolspec->rolename, "db_owner", 8) == 0)) + ereport(ERROR, + (errcode(ERRCODE_CHECK_VIOLATION), + errmsg("Cannot drop the %s '%s'.", db_principal_type, rolspec->rolename))); + /* + * Check for current_user's privileges + * must be database owner to drop user/role + */ + if ((!stmt->missing_ok && !is_tsql_db_principal) || + !is_member_of_role(GetUserId(), get_role_oid(db_owner_name, false))) + ereport(ERROR, + (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), + errmsg("Cannot drop the %s '%s', because it does not exist or you do not have permission.", db_principal_type, rolspec->rolename))); + /* * If a role has members, do not drop it. * Note that here we don't handle invalid * roles. */ - if (drop_role && !is_empty_role(get_role_oid(user_name, true))) + if (drop_role && !is_empty_role(role_oid)) ereport(ERROR, (errcode(ERRCODE_CHECK_VIOLATION), errmsg("The role has members. It must be empty before it can be dropped."))); @@ -3421,10 +3565,12 @@ bbf_ProcessUtility(PlannedStmt *pstmt, { DropStmt *drop_stmt = (DropStmt *) parsetree; + if (drop_stmt->removeType == OBJECT_TABLE) + bbf_drop_handle_partitioned_table(drop_stmt); + if (drop_stmt->removeType != OBJECT_SCHEMA) { - if (sql_dialect == SQL_DIALECT_TSQL) - bbf_ExecDropStmt(drop_stmt); + bbf_ExecDropStmt(drop_stmt); break; } @@ -3568,6 +3714,9 @@ bbf_ProcessUtility(PlannedStmt *pstmt, else standard_ProcessUtility(pstmt, queryString, readOnlyTree, context, params, queryEnv, dest, qc); + + if (stmt->renameType == OBJECT_TABLE) + bbf_rename_handle_partitioned_table(stmt); if (sql_dialect == SQL_DIALECT_TSQL) { rename_update_bbf_catalog(stmt); @@ -3651,6 +3800,15 @@ bbf_ProcessUtility(PlannedStmt *pstmt, standard_ProcessUtility(pstmt, queryString, readOnlyTree, context, params, queryEnv, dest, qc); + /* + * Create partitions of babelfish partitioned table + * using the partition scheme and partitioning column. + */ + if (create_stmt->partspec && create_stmt->partspec->tsql_partition_scheme) + { + bbf_create_partition_tables(create_stmt); + } + if (create_stmt->tsql_tabletype || isTableVariable) { List *name; @@ -3668,6 +3826,46 @@ bbf_ProcessUtility(PlannedStmt *pstmt, return; } + case T_IndexStmt: + { + if (sql_dialect == SQL_DIALECT_TSQL) + { + IndexStmt *stmt = (IndexStmt *) parsetree; + + /* + * Create partitioned index if partition scheme is specified. + * Allow only aligned-index. + */ + if (stmt->excludeOpNames != NIL) + { + List *partition_schemes = stmt->excludeOpNames; + stmt->excludeOpNames = NIL; + + /* + * Create the index first so that columns and table name + * checks get done before index alignment check. + */ + if (prev_ProcessUtility) + prev_ProcessUtility(pstmt, queryString, readOnlyTree, context, params, + queryEnv, dest, qc); + else + standard_ProcessUtility(pstmt, queryString, readOnlyTree, context, params, + queryEnv, dest, qc); + + stmt->excludeOpNames = partition_schemes; + + /* Validate that index is aligned-index. */ + if (!bbf_validate_partitioned_index_alignment(stmt)) + { + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("Un-aligned Index is not supported in Babelfish."))); + } + return; + } + } + break; + } case T_CreateDomainStmt: { CreateDomainStmt *create_domain = (CreateDomainStmt *) parsetree; @@ -3740,7 +3938,7 @@ bbf_ProcessUtility(PlannedStmt *pstmt, ListCell *lc; ListCell *lc1; if (rv->schemaname != NULL) - logical_schema = get_logical_schema_name(rv->schemaname, true); + logical_schema = get_logical_schema_name(rv->schemaname, false); else logical_schema = get_authid_user_ext_schema_name(dbname, current_user); @@ -4069,6 +4267,85 @@ pg_proc_update_oid_acl(ObjectAddress address, Oid oid, Acl *acl) table_close(rel, RowExclusiveLock); } +/* + * Update the function definition of an alter procedure query + * "ALTER ..." to "CREATE ..." in bbf_function_ext + */ +static void bbf_func_ext_update_proc_definition(Oid oid) +{ + Relation bbf_function_ext_rel; + TupleDesc bbf_function_ext_rel_dsc; + Datum new_record[BBF_FUNCTION_EXT_NUM_COLS]; + bool new_record_replaces[BBF_FUNCTION_EXT_NUM_COLS]; + bool new_record_nulls[BBF_FUNCTION_EXT_NUM_COLS]; + char *original_query = get_original_query_string(); + HeapTuple tuple, + proctup, + oldtup; + StringInfoData infoSchemaStr; + + bbf_function_ext_rel = table_open(get_bbf_function_ext_oid(), RowExclusiveLock); + bbf_function_ext_rel_dsc = RelationGetDescr(bbf_function_ext_rel); + + if(original_query == NULL) + { + table_close(bbf_function_ext_rel, RowExclusiveLock); + elog(ERROR, "lookup failed for original query"); + } + + /* + * This solution only works because original_query does not contain + * any leading characters or comments before "ALTER". When BABEL-5140 + * is resolved we will need to refactor this code + */ + if(!(strlen(original_query) >= 5 && strncasecmp(original_query, "alter", 5) == 0)) + { + table_close(bbf_function_ext_rel, RowExclusiveLock); + elog(ERROR, "original query: %s, is improperly formatted", original_query); + } + + /* + * Procedure has already been modified, by alter proc + * we expect it to still exist in pg_proc and bbf_function_ext + */ + proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(oid)); + if (!HeapTupleIsValid(proctup)) + { + table_close(bbf_function_ext_rel, RowExclusiveLock); + elog(ERROR, "cache lookup failed for function %u", oid); + } + + oldtup = get_bbf_function_tuple_from_proctuple(proctup); + + if(!HeapTupleIsValid(oldtup)) + { + ReleaseSysCache(proctup); + table_close(bbf_function_ext_rel, RowExclusiveLock); + elog(ERROR, "cache lookup failed for function %u", oid); + } + + initStringInfo(&infoSchemaStr); + + MemSet(new_record_nulls, false, sizeof(new_record_nulls)); + MemSet(new_record_replaces, false, sizeof(new_record_replaces)); + + /* Change alter to create, add rest of characters, and update */ + appendStringInfoString(&infoSchemaStr, "CREATE"); + appendStringInfoString(&infoSchemaStr, original_query + 5); + new_record[Anum_bbf_function_ext_definition - 1] = CStringGetTextDatum(infoSchemaStr.data); + new_record_replaces[Anum_bbf_function_ext_definition - 1] = true; + + tuple = heap_modify_tuple(oldtup, bbf_function_ext_rel_dsc, + new_record, new_record_nulls, + new_record_replaces); + CatalogTupleUpdate(bbf_function_ext_rel, &tuple->t_self, tuple); + heap_freetuple(oldtup); + + /* Clean up */ + ReleaseSysCache(proctup); + heap_freetuple(tuple); + table_close(bbf_function_ext_rel, RowExclusiveLock); +} /* * Update the pg_type catalog entry for the given name to have * typbyval set to the given value. @@ -4364,6 +4641,7 @@ _PG_init(void) init_tsql_coerce_hash_tab(fcinfo); init_tsql_datatype_precedence_hash_tab(fcinfo); + init_special_function_list(); init_tsql_cursor_hash_tab(fcinfo); RegisterXactCallback(pltsql_xact_cb, NULL); RegisterSubXactCallback(pltsql_subxact_cb, NULL); @@ -6148,11 +6426,12 @@ bbf_ExecDropStmt(DropStmt *stmt) Relation relation = NULL; Oid schema_oid; ListCell *cell; - const char *logicalschema = NULL; + const char *logicalschema = NULL; + bool is_missing = sql_dialect == SQL_DIALECT_TSQL ? true : stmt->missing_ok; db_id = get_cur_db_id(); - if (stmt->removeType == OBJECT_SCHEMA) + if (stmt->removeType == OBJECT_SCHEMA && sql_dialect == SQL_DIALECT_TSQL) { foreach(cell, stmt->objects) { @@ -6176,7 +6455,7 @@ bbf_ExecDropStmt(DropStmt *stmt) lfirst(cell), &relation, AccessShareLock, - true); + is_missing); if (!relation) continue; @@ -6189,34 +6468,37 @@ bbf_ExecDropStmt(DropStmt *stmt) schema_oid = get_object_namespace(&address); if (OidIsValid(schema_oid)) schema_name = get_namespace_name(schema_oid); - if (schema_name != NULL) - logicalschema = get_logical_schema_name(schema_name, true); - - if (schema_name && major_name) + if (sql_dialect == SQL_DIALECT_TSQL) { - if (stmt->removeType == OBJECT_TABLE) - { - type = ExtendedPropertyTypeNames[EXTENDED_PROPERTY_TABLE]; - delete_extended_property(db_id, type, schema_name, - major_name, NULL); - type = ExtendedPropertyTypeNames[EXTENDED_PROPERTY_TABLE_COLUMN]; - delete_extended_property(db_id, type, schema_name, - major_name, NULL); - } - else if (stmt->removeType == OBJECT_VIEW) - { - type = ExtendedPropertyTypeNames[EXTENDED_PROPERTY_VIEW]; - delete_extended_property(db_id, type, schema_name, - major_name, NULL); - } - else if (stmt->removeType == OBJECT_SEQUENCE) + if (schema_name != NULL) + logicalschema = get_logical_schema_name(schema_name, true); + + if (schema_name && major_name) { - type = ExtendedPropertyTypeNames[EXTENDED_PROPERTY_SEQUENCE]; - delete_extended_property(db_id, type, schema_name, - major_name, NULL); + if (stmt->removeType == OBJECT_TABLE) + { + type = ExtendedPropertyTypeNames[EXTENDED_PROPERTY_TABLE]; + delete_extended_property(db_id, type, schema_name, + major_name, NULL); + type = ExtendedPropertyTypeNames[EXTENDED_PROPERTY_TABLE_COLUMN]; + delete_extended_property(db_id, type, schema_name, + major_name, NULL); + } + else if (stmt->removeType == OBJECT_VIEW) + { + type = ExtendedPropertyTypeNames[EXTENDED_PROPERTY_VIEW]; + delete_extended_property(db_id, type, schema_name, + major_name, NULL); + } + else if (stmt->removeType == OBJECT_SEQUENCE) + { + type = ExtendedPropertyTypeNames[EXTENDED_PROPERTY_SEQUENCE]; + delete_extended_property(db_id, type, schema_name, + major_name, NULL); + } } + clean_up_bbf_schema_permissions(logicalschema, major_name, false); } - clean_up_bbf_schema_permissions(logicalschema, major_name, false); } } else if (stmt->removeType == OBJECT_PROCEDURE || @@ -6232,10 +6514,14 @@ bbf_ExecDropStmt(DropStmt *stmt) lfirst(cell), &relation, AccessShareLock, - true); + is_missing); Assert(relation == NULL); if (!OidIsValid(address.objectId)) continue; + + /* Restrict dropping of extended stored procedures for non-superuser roles */ + if (stmt->removeType == OBJECT_PROCEDURE && !superuser()) + check_restricted_stored_procedure(address.objectId); /* Get major_name */ relation = table_open(address.classId, AccessShareLock); @@ -6260,22 +6546,26 @@ bbf_ExecDropStmt(DropStmt *stmt) schema_oid = get_object_namespace(&address); if (OidIsValid(schema_oid)) schema_name = get_namespace_name(schema_oid); - if (schema_name != NULL) - logicalschema = get_logical_schema_name(schema_name, true); - if (schema_name && major_name) + if (sql_dialect == SQL_DIALECT_TSQL) { - if (stmt->removeType == OBJECT_PROCEDURE) - type = ExtendedPropertyTypeNames[EXTENDED_PROPERTY_PROCEDURE]; - else if (stmt->removeType == OBJECT_FUNCTION) - type = ExtendedPropertyTypeNames[EXTENDED_PROPERTY_FUNCTION]; - else if (stmt->removeType == OBJECT_TYPE) - type = ExtendedPropertyTypeNames[EXTENDED_PROPERTY_TYPE]; - - delete_extended_property(db_id, type, schema_name, major_name, - NULL); + if (schema_name != NULL) + logicalschema = get_logical_schema_name(schema_name, true); + + if (schema_name && major_name) + { + if (stmt->removeType == OBJECT_PROCEDURE) + type = ExtendedPropertyTypeNames[EXTENDED_PROPERTY_PROCEDURE]; + else if (stmt->removeType == OBJECT_FUNCTION) + type = ExtendedPropertyTypeNames[EXTENDED_PROPERTY_FUNCTION]; + else if (stmt->removeType == OBJECT_TYPE) + type = ExtendedPropertyTypeNames[EXTENDED_PROPERTY_TYPE]; + + delete_extended_property(db_id, type, schema_name, major_name, + NULL); + } + clean_up_bbf_schema_permissions(logicalschema, major_name, false); } - clean_up_bbf_schema_permissions(logicalschema, major_name, false); } } } diff --git a/contrib/babelfishpg_tsql/src/pltsql.h b/contrib/babelfishpg_tsql/src/pltsql.h index 555c76b1cdd..42f5b4b53d3 100644 --- a/contrib/babelfishpg_tsql/src/pltsql.h +++ b/contrib/babelfishpg_tsql/src/pltsql.h @@ -64,6 +64,7 @@ #define TRIGGER_MAX_NEST_LEVEL 32 /* Maximum allowed trigger nesting level*/ + /* * Compiler's namespace item types */ @@ -198,7 +199,9 @@ typedef enum PLtsql_stmt_type PLTSQL_STMT_DBCC, PLTSQL_STMT_ALTER_DB, PLTSQL_STMT_FULLTEXTINDEX, - PLTSQL_STMT_GRANTSCHEMA + PLTSQL_STMT_GRANTSCHEMA, + PLTSQL_STMT_PARTITION_FUNCTION, + PLTSQL_STMT_PARTITION_SCHEME } PLtsql_stmt_type; /* @@ -1093,6 +1096,34 @@ typedef struct PLtsql_stmt_grantschema char *schema_name; /* schema name */ } PLtsql_stmt_grantschema; + +/* + * Partition Function + */ +typedef struct PLtsql_stmt_partition_function +{ + PLtsql_stmt_type cmd_type; + int lineno; + char *function_name; + bool is_create; + bool is_right; + PLtsql_type *datatype; + List *args; /* the arguments (list of exprs) */ +} PLtsql_stmt_partition_function; + +/* + * Partition Scheme + */ +typedef struct PLtsql_stmt_partition_scheme +{ + PLtsql_stmt_type cmd_type; + int lineno; + char *scheme_name; + bool is_create; + char *function_name; + int filegroups; /* filegroups count, -1 indicates ALL is specified */ +} PLtsql_stmt_partition_scheme; + /* * ASSERT statement */ @@ -1829,6 +1860,21 @@ typedef struct tsql_identity_insert_fields Oid schema_oid; } tsql_identity_insert_fields; +/* + * It is modified version of compare_context, which is used to + * provide extra arg during sort operation to compare function. + * Please check tsql_compare_values() and exec_stmt_partition_function() + * for more details. + */ +typedef struct tsql_compare_context +{ + Oid function_oid; /* oid of comparator operator */ + Oid colloid; /* collation which needs to used during comparison */ + bool contains_duplicate; /* true if the array contains duplicate values */ +} tsql_compare_context; + +extern int tsql_compare_values(const void *a, const void *b, void *arg); + extern tsql_identity_insert_fields tsql_identity_insert; extern check_lang_as_clause_hook_type check_lang_as_clause_hook; extern write_stored_proc_probin_hook_type write_stored_proc_probin_hook; @@ -2035,6 +2081,7 @@ extern void pltsql_free_function_memory(PLtsql_function *func); extern void pltsql_dumptree(PLtsql_function *func); extern void pre_function_call_hook_impl(const char *funcName); extern int32 coalesce_typmod_hook_impl(const CoalesceExpr *cexpr); +extern void check_restricted_stored_procedure(Oid proc_id); /* * Scanner functions in pl_scanner.c @@ -2063,6 +2110,9 @@ extern void pltsql_scanner_finish(void); */ extern int pltsql_yyparse(void); +/* functions in hooks.c */ +extern char *extract_identifier(const char *start, int *last_pos); + /* functions in pltsql_utils.c */ extern char *gen_createfulltextindex_cmds(const char *table_name, const char *schema_name, const List *column_name, const char *index_name); extern char *gen_dropfulltextindex_cmds(const char *index_name, const char *schema_name); @@ -2119,7 +2169,7 @@ extern void UnlockLogicalDatabaseForSession(int16 dbid, LOCKMODE lockmode, bool extern char *bpchar_to_cstring(const BpChar *bpchar); extern char *varchar_to_cstring(const VarChar *varchar); extern char *flatten_search_path(List *oid_list); -extern const char *get_pltsql_function_signature_internal(const char *funcname, int nargs, const Oid *argtypes); +extern char *get_pltsql_function_signature_internal(const char *funcname, int nargs, const Oid *argtypes); extern void report_info_or_warning(int elevel, char *message); extern void init_and_check_common_utility(void); extern Oid tsql_get_trigger_oid(char *tgname, Oid tgnamespace, Oid user_id); @@ -2135,6 +2185,11 @@ extern bool pltsql_createFunction(ParseState *pstate, PlannedStmt *pstmt, const ParamListInfo params); extern Oid get_sys_varcharoid(void); extern Oid get_sysadmin_oid(void); +extern bool is_tsql_varchar_or_char_datatype(Oid oid); /* sys.char / sys.varchar */ +extern bool is_tsql_nchar_or_nvarchar_datatype(Oid oid); /* sys.nchar / sys.nvarchar */ +extern bool is_tsql_binary_or_varbinary_datatype(Oid oid); /* sys.binary / sys.varbinary */ +extern bool is_tsql_datatype_with_max_scale_expr_allowed(Oid oid); /* sys.varchar(max), sys.nvarchar(max), sys.varbinary(max) */ +extern bool is_tsql_text_ntext_or_image_datatype(Oid oid); /* sys.text, sys.ntext, sys.image */ typedef struct { @@ -2217,4 +2272,10 @@ void GetOpenqueryTupdescFromMetadata(char *linked_server, char *query, TupleDes extern void exec_utility_cmd_helper(char *query_str); extern void exec_alter_role_cmd(char *query_str, RoleSpec *role); +/* + * Functions in pltsql_coerce.c + */ +extern bool validate_special_function(char *proc_nsname, char *proc_name, List* fargs, int nargs, Oid *input_typeids); +extern void init_special_function_list(void); + #endif /* PLTSQL_H */ diff --git a/contrib/babelfishpg_tsql/src/pltsql_bulkcopy.c b/contrib/babelfishpg_tsql/src/pltsql_bulkcopy.c index 878edf10242..fb2d209e485 100644 --- a/contrib/babelfishpg_tsql/src/pltsql_bulkcopy.c +++ b/contrib/babelfishpg_tsql/src/pltsql_bulkcopy.c @@ -350,6 +350,8 @@ CopyMultiInsertBufferFlush(CopyMultiInsertInfo *miinfo, */ save_cur_lineno = cstate->cur_rowno; + /* Open indices to update them after the multi insert */ + ExecOpenIndices(resultRelInfo, false); /* * table_multi_insert may leak memory, so switch to short-lived memory * context before calling it. @@ -361,7 +363,6 @@ CopyMultiInsertBufferFlush(CopyMultiInsertInfo *miinfo, mycid, ti_options, buffer->bistate); - MemoryContextSwitchTo(oldcontext); for (i = 0; i < nused; i++) { @@ -383,6 +384,36 @@ CopyMultiInsertBufferFlush(CopyMultiInsertInfo *miinfo, ExecClearTuple(slots[i]); } + /* + * ExecInsertIndexTuples also leaks memory, so only switch back to old + * context after it. + */ + MemoryContextSwitchTo(oldcontext); + + /* Close the indices we've opened before multi insert */ + ExecCloseIndices(resultRelInfo); + + /* + * ExecCloseIndices does not free neither resulsting arrays, allocated + * in ExecOpenIndices, nor its contents. Instead of moving open/close into + * short-lived context lets clean it up explicitly, so indices open/close + * can be untied from batch handling in future if needed. + * + * There is an additional call to ExecCloseIndices in + * EndBulkCopy->ExecCloseResultRelations, we reset ri_NumIndices to make + * it no-op. + */ + if (resultRelInfo->ri_NumIndices > 0) + { + for (i = 0; i < resultRelInfo->ri_NumIndices; i++) + { + pfree(resultRelInfo->ri_IndexRelationInfo[i]); + } + pfree(resultRelInfo->ri_IndexRelationInfo); + pfree(resultRelInfo->ri_IndexRelationDescs); + resultRelInfo->ri_NumIndices = 0; + } + /* Mark that all slots are free. */ buffer->nused = 0; @@ -556,12 +587,11 @@ ExecuteBulkCopy(BulkCopyState cstate, int rowCount, int colCount, Assert(list_length(cstate->range_table) == 1); /* - * The target must be a plain, foreign, or partitioned relation, or have + * The target must be a plain, or foreign relation, or have * an INSTEAD OF INSERT row trigger. */ if (cstate->rel->rd_rel->relkind != RELKIND_RELATION && cstate->rel->rd_rel->relkind != RELKIND_FOREIGN_TABLE && - cstate->rel->rd_rel->relkind != RELKIND_PARTITIONED_TABLE && !(cstate->rel->trigdesc && cstate->rel->trigdesc->trig_insert_instead_row)) { @@ -580,6 +610,10 @@ ExecuteBulkCopy(BulkCopyState cstate, int rowCount, int colCount, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cannot bulk copy to sequence \"%s\"", RelationGetRelationName(cstate->rel)))); + else if (cstate->rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("Bulk Copy to partitioned-table is not yet supported in Babelfish."))); else ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), @@ -587,8 +621,6 @@ ExecuteBulkCopy(BulkCopyState cstate, int rowCount, int colCount, RelationGetRelationName(cstate->rel)))); } - ExecOpenIndices(cstate->resultRelInfo, false); - econtext = GetPerTupleExprContext(cstate->estate); /* Set up callback to identify error line number. */ diff --git a/contrib/babelfishpg_tsql/src/pltsql_coerce.c b/contrib/babelfishpg_tsql/src/pltsql_coerce.c index 23a4ca0ef8f..d482f5892b8 100644 --- a/contrib/babelfishpg_tsql/src/pltsql_coerce.c +++ b/contrib/babelfishpg_tsql/src/pltsql_coerce.c @@ -10,6 +10,8 @@ #include "varatt.h" #include "access/htup_details.h" +#include "access/genam.h" +#include "access/table.h" #include "access/parallel.h" /* InitializingParallelWorker */ #include "miscadmin.h" #include "catalog/pg_authid.h" @@ -29,6 +31,7 @@ #include "utils/builtins.h" #include "utils/float.h" #include "utils/guc.h" +#include "utils/fmgroids.h" #include "common/int.h" #include "utils/numeric.h" #include "utils/memutils.h" @@ -54,6 +57,7 @@ extern bool babelfish_dump_restore; PG_FUNCTION_INFO_V1(init_tsql_coerce_hash_tab); PG_FUNCTION_INFO_V1(init_tsql_datatype_precedence_hash_tab); +PG_FUNCTION_INFO_V1(get_immediate_base_type_of_UDT); static Oid select_common_type_setop(ParseState *pstate, List *exprs, Node **which_expr); static Oid select_common_type_for_isnull(ParseState *pstate, List *exprs); @@ -375,6 +379,40 @@ tsql_precedence_info_t tsql_precedence_infos[] = #define TOTAL_TSQL_PRECEDENCE_COUNT (sizeof(tsql_precedence_infos)/sizeof(tsql_precedence_infos[0])) +/* Following constants value are defined based on the special function list */ +#define SFUNC_MAX_ARGS 4 /* maximum number of args special function in special function list can have */ +#define SFUNC_MAX_VALID_TYPES 8 /* maximum number of valid types supported argument of function in special function list can have */ + +/* struct to store details of valid types supported for a argument */ +typedef struct tsql_valid_arg_type +{ + int len; /* length of list of valid types for the argument */ + char *valid_types[SFUNC_MAX_VALID_TYPES]; /* list of valid type name supported for the argument */ + Oid valid_types_oid[SFUNC_MAX_VALID_TYPES]; /* list of valid type oid supported for the argument */ +} tsql_valid_arg_type_t; + +/* struct to store details of special function */ +typedef struct tsql_special_function +{ + const char *nsp; /* namespace of special function */ + const char *funcname; /* name of special function */ + const char *formatted_funcname; /* formatted name of special function */ + int nargs; /* number of arguments of special function */ + tsql_valid_arg_type_t valid_arg_types[SFUNC_MAX_ARGS]; /* list for storing details of all the valid types supported for each arguments */ +} tsql_special_function_t; + +tsql_special_function_t tsql_special_function_list[] = +{ + {"sys", "replace", "replace", 3, {{8, {"char","varchar","nchar","nvarchar","text","ntext","binary","varbinary"}, {InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid}}, {8, {"char","varchar","nchar","nvarchar","text","ntext","binary","varbinary"}, {InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid}}, {8, {"char","varchar","nchar","nvarchar","text","ntext","binary","varbinary"}, {InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid}}}}, + {"sys", "stuff", "stuff", 4, {{8, {"char","varchar","nchar","nvarchar","binary","varbinary","text","ntext"}, {InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid}}, {4, {"tinyint","smallint","int","bigint"}, {InvalidOid, InvalidOid, InvalidOid, InvalidOid}} , {4, {"tinyint","smallint","int","bigint"}, {InvalidOid, InvalidOid, InvalidOid, InvalidOid}}, {8, {"char","varchar","nchar","nvarchar","binary","varbinary","text","ntext"}, {InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid}}}}, + {"sys", "translate", "translate", 3, {{6, {"char","varchar","nchar","nvarchar","text","ntext"}, {InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid}}, {6, {"char","varchar","nchar","nvarchar","text","ntext"}, {InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid}} , {6, {"char","varchar","nchar","nvarchar","text","ntext"}, {InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid}}}}, + {"sys", "trim", "Trim", 2, {{6, {"char","varchar","nchar","nvarchar","text","ntext"}, {InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid}}, {6, {"char","varchar","nchar","nvarchar","text","ntext"}, {InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid, InvalidOid}}}} +}; + +static bool inited_tsql_special_function_list = false; + +#define TOTAL_TSQL_SPECIAL_FUNCTION_COUNT (sizeof(tsql_special_function_list)/sizeof(tsql_special_function_list[0])) + /* T-SQL Cast */ typedef struct tsql_cast_info_key { @@ -889,11 +927,404 @@ run_tsql_best_match_heuristics(int nargs, Oid *input_typeids, FuncCandidateList return new_candidates; } +/* + * get_immediate_base_type_of_UDT_internal() + * This function returns the Immediate base type for UDT. + * Returns InvalidOid if given type is not an UDT + */ +static Oid +get_immediate_base_type_of_UDT_internal(Oid typeid) +{ + HeapTuple tuple; + bool isnull; + Datum datum; + Datum tsql_typename; + Oid base_type; + LOCAL_FCINFO(fcinfo, 1); + + if (!OidIsValid(typeid)) + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("typeid is invalid!"))); + + /* if common_utility_plugin_ptr is not initialised */ + if (common_utility_plugin_ptr == NULL) + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("Failed to find common utility plugin."))); + + /* if tsql_typename is NULL it implies that inputTypId corresponds to UDT */ + InitFunctionCallInfoData(*fcinfo, NULL, 0, InvalidOid, NULL, NULL); + fcinfo->args[0].value = ObjectIdGetDatum(typeid); + fcinfo->args[0].isnull = false; + tsql_typename = (*common_utility_plugin_ptr->translate_pg_type_to_tsql) (fcinfo); + + /* if given type is not an UDT then return InvalidOid */ + if (tsql_typename) + return InvalidOid; + + /* Get immediate base type id of given type id */ + tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typeid)); + if (!HeapTupleIsValid(tuple)) + return InvalidOid; + + datum = SysCacheGetAttr(TYPEOID, tuple, Anum_pg_type_typbasetype, &isnull); + if (isnull) + return InvalidOid; + + base_type = DatumGetObjectId(datum); + ReleaseSysCache(tuple); + + return base_type; +} + +Datum +get_immediate_base_type_of_UDT(PG_FUNCTION_ARGS) +{ + Oid base_type; + + base_type = get_immediate_base_type_of_UDT_internal(PG_GETARG_OID(0)); + if (!OidIsValid(base_type)) + PG_RETURN_NULL(); + + PG_RETURN_OID(base_type); +} + +void +init_special_function_list() +{ + Oid type_id; + + /* if common_utility_plugin_ptr is not initialised */ + if (common_utility_plugin_ptr == NULL) + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("Failed to find common utility plugin."))); + + /* mark the special function list initialised */ + inited_tsql_special_function_list = true; + + for (int special_func_idx = 0; special_func_idx < TOTAL_TSQL_SPECIAL_FUNCTION_COUNT; special_func_idx++) + { + for (int arg_idx = 0; arg_idx < tsql_special_function_list[special_func_idx].nargs; arg_idx++) + { + for (int valid_type_idx = 0; valid_type_idx < tsql_special_function_list[special_func_idx].valid_arg_types[arg_idx].len; valid_type_idx++) + { + if (!OidIsValid(tsql_special_function_list[special_func_idx].valid_arg_types[arg_idx].valid_types_oid[valid_type_idx])) + { + type_id = (*common_utility_plugin_ptr->get_tsql_datatype_oid)(tsql_special_function_list[special_func_idx].valid_arg_types[arg_idx].valid_types[valid_type_idx]); + + if (OidIsValid(type_id)) + { + tsql_special_function_list[special_func_idx].valid_arg_types[arg_idx].valid_types_oid[valid_type_idx] = type_id; + } + else + { + /* type id is not loaded. wait for next scan */ + inited_tsql_special_function_list = false; + } + } + } + } + } +} + +/* + * For a given function details, validate whether it is in special function list + * and also validate the input argument data types. + */ +bool +validate_special_function(char *func_nsname, char *func_name, List* fargs, int nargs, Oid *input_typeids) +{ + tsql_special_function_t *special_func; + bool type_match; + Oid input_type_id, valid_type_id, base_type_id; + Oid sys_varcharoid; + + /* Sanity checks */ + if (func_name == NULL || (nargs != 0 && input_typeids == NULL) || fargs == NIL) + return false; + + /* + * Special function handling is only for some specific system functions. + * If func_nsname is NULL, consider it to be a "sys". + */ + if (func_nsname != NULL && + (strlen(func_nsname) != 3 || strncmp(func_nsname, "sys", 3) != 0)) + return false; + + /* Initialise T-SQL special function argument type id list if not already done */ + if (!inited_tsql_special_function_list) + { + init_special_function_list(); + } + + /* Get Special function details */ + special_func = NULL; + for (int i = 0; i < TOTAL_TSQL_SPECIAL_FUNCTION_COUNT; i++) + { + if (strcmp(func_name, tsql_special_function_list[i].funcname) == 0 + && nargs == tsql_special_function_list[i].nargs) + { + special_func = &tsql_special_function_list[i]; + break; + } + } + + /* If function is not a special function no additional handling required */ + if (special_func == NULL) + { + /* report error for case when NULL casted to different datatypes and passed as 2nd or 3rd argument of SUBSTRING() function */ + if (strlen(func_name) == 9 && strncmp(func_name, "substring", 9) == 0) + { + for (int i = 1; i < nargs; i++) + { + Node *arg = (Node *) lfirst(list_nth_cell(fargs, i)); + + if (input_typeids[i] == UNKNOWNOID) + continue; + + /* Throw error when input is constant and NULL */ + if (IsA(arg, Const) && ((Const *)arg)->constisnull) + { + const char *typ_name; + int len; + + if (common_utility_plugin_ptr == NULL) + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("Failed to find common utility plugin."))); + + typ_name = (*common_utility_plugin_ptr->resolve_pg_type_to_tsql) (input_typeids[i]); + if(typ_name) + { + len = strlen(typ_name); + + if (!((len == 3 && strncmp(typ_name,"int", 3) == 0) || + (len == 7 && strncmp(typ_name,"tinyint", 7) == 0) || + (len == 8 && strncmp(typ_name,"smallint", 8) == 0) || + (len == 6 && strncmp(typ_name,"bigint", 6) == 0))) + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_FUNCTION), + errmsg("Argument data type %s is invalid for argument %d of substring function.", + format_type_be(input_typeids[i]), i+1))); + } + } + } + } + return false; + } + + sys_varcharoid = get_sys_varcharoid(); + + /* Report error in case of invalid argument datatype */ + for (int i = 0; i < special_func->nargs; i++) + { + /* + * if argument is NULL then keep its typeId as UNKNOWN and skip the report error handling + * otherwise consider it as sys.VARCHAR + */ + if (input_typeids[i] == UNKNOWNOID) + { + Node *arg = (Node *) lfirst(list_nth_cell(fargs, i)); + if (IsA(arg, Const) && ((Const *)arg)->constisnull) + continue; + else + input_type_id = sys_varcharoid; + } + else + input_type_id = input_typeids[i]; + + /* for UDT use its base type for input argument datatype validation */ + base_type_id = get_immediate_base_type_of_UDT_internal(input_type_id); + if (OidIsValid(base_type_id)) + input_type_id = base_type_id; + + type_match = false; + for (int j = 0; j < special_func->valid_arg_types[i].len; j++) + { + valid_type_id = special_func->valid_arg_types[i].valid_types_oid[j]; + + if (input_type_id == valid_type_id) + { + type_match = true; + break; + } + } + if (!type_match) + { + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_FUNCTION), + errmsg("Argument data type %s is invalid for argument %d of %s function.", + format_type_be(input_type_id), i+1, special_func->formatted_funcname))); + } + } + + return true; +} + +/* + * tsql_func_select_candidate_for_special_func() + * + * For functions present in special function list, and try to find best candidate + * based on matching return type. Also throw error in case of invalid argument data type. + */ +static FuncCandidateList +tsql_func_select_candidate_for_special_func(List *names, List *fargs, int nargs, Oid *input_typeids, FuncCandidateList candidates) +{ + FuncCandidateList current_candidate, best_candidate; + Oid expr_result_type; + char *proc_nsname; + char *proc_name; + bool is_func_validated; + int ncandidates; + Oid rettype; + Oid sys_oid = get_namespace_oid("sys", false); + + DeconstructQualifiedName(names, &proc_nsname, &proc_name); + + is_func_validated = validate_special_function(proc_nsname, proc_name, fargs, nargs, input_typeids); + + /* Return NULL if function is not a special function */ + if (!is_func_validated) + return NULL; + + /* if common_utility_plugin_ptr is not initialised */ + if (common_utility_plugin_ptr == NULL) + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("Failed to find common utility plugin."))); + + /* function based logic to decide return type */ + expr_result_type = InvalidOid; + if (strlen(proc_name) == 4 && strncmp(proc_name,"trim", 4) == 0) + { + if ((*common_utility_plugin_ptr->is_tsql_nvarchar_datatype)(input_typeids[1]) + || (*common_utility_plugin_ptr->is_tsql_nchar_datatype)(input_typeids[1])) + { + expr_result_type = (*common_utility_plugin_ptr->lookup_tsql_datatype_oid) ("nvarchar"); + } + else if ((*common_utility_plugin_ptr->is_tsql_varchar_datatype)(input_typeids[1]) + || (*common_utility_plugin_ptr->is_tsql_bpchar_datatype)(input_typeids[1]) + || input_typeids[1] == UNKNOWNOID) + { + expr_result_type = get_sys_varcharoid(); + } + } + else if (strlen(proc_name) == 9 && strncmp(proc_name, "translate", 9) == 0) + { + if (input_typeids[1] != input_typeids[2]) + { + if (!((input_typeids[1] == UNKNOWNOID && (*common_utility_plugin_ptr->is_tsql_varchar_datatype)(input_typeids[2])) + || (input_typeids[2] == UNKNOWNOID && (*common_utility_plugin_ptr->is_tsql_varchar_datatype)(input_typeids[1])))) + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_FUNCTION), + errmsg("The second and third arguments of the TRANSLATE built-in function must have same argument data type."))); + } + if ((*common_utility_plugin_ptr->is_tsql_nvarchar_datatype)(input_typeids[0]) + || (*common_utility_plugin_ptr->is_tsql_nchar_datatype)(input_typeids[0]) + || (*common_utility_plugin_ptr->is_tsql_ntext_datatype)(input_typeids[0])) + { + expr_result_type = (*common_utility_plugin_ptr->lookup_tsql_datatype_oid) ("nvarchar"); + } + else if ((*common_utility_plugin_ptr->is_tsql_varchar_datatype)(input_typeids[0]) + || (*common_utility_plugin_ptr->is_tsql_bpchar_datatype)(input_typeids[0]) + || (*common_utility_plugin_ptr->is_tsql_text_datatype)(input_typeids[0]) + || input_typeids[0] == UNKNOWNOID) + { + expr_result_type = get_sys_varcharoid(); + } + } + else if (strlen(proc_name) == 7 && strncmp(proc_name,"replace", 7) == 0) + { + if ((*common_utility_plugin_ptr->is_tsql_nvarchar_datatype)(input_typeids[0]) + || (*common_utility_plugin_ptr->is_tsql_nchar_datatype)(input_typeids[0]) + || (*common_utility_plugin_ptr->is_tsql_nvarchar_datatype)(input_typeids[1]) + || (*common_utility_plugin_ptr->is_tsql_nchar_datatype)(input_typeids[1]) + || (*common_utility_plugin_ptr->is_tsql_nvarchar_datatype)(input_typeids[2]) + || (*common_utility_plugin_ptr->is_tsql_nchar_datatype)(input_typeids[2])) + { + expr_result_type = (*common_utility_plugin_ptr->lookup_tsql_datatype_oid) ("nvarchar"); + } + else + { + expr_result_type = get_sys_varcharoid(); + } + } + else if (strlen(proc_name) == 5 && strncmp(proc_name, "stuff", 5) == 0) + { + if ((*common_utility_plugin_ptr->is_tsql_sys_binary_datatype)(input_typeids[0]) + || (*common_utility_plugin_ptr->is_tsql_sys_varbinary_datatype)(input_typeids[0])) + { + expr_result_type = (*common_utility_plugin_ptr->lookup_tsql_datatype_oid) ("varbinary"); + } + else if ((*common_utility_plugin_ptr->is_tsql_nvarchar_datatype)(input_typeids[0]) + || (*common_utility_plugin_ptr->is_tsql_nchar_datatype)(input_typeids[0]) + || (*common_utility_plugin_ptr->is_tsql_nvarchar_datatype)(input_typeids[3]) + || (*common_utility_plugin_ptr->is_tsql_nchar_datatype)(input_typeids[3]) + || (*common_utility_plugin_ptr->is_tsql_ntext_datatype)(input_typeids[0]) + || (*common_utility_plugin_ptr->is_tsql_ntext_datatype)(input_typeids[3])) + { + expr_result_type = (*common_utility_plugin_ptr->lookup_tsql_datatype_oid) ("nvarchar"); + } + else if ((*common_utility_plugin_ptr->is_tsql_varchar_datatype)(input_typeids[0]) + || (*common_utility_plugin_ptr->is_tsql_bpchar_datatype)(input_typeids[0]) + || (*common_utility_plugin_ptr->is_tsql_text_datatype)(input_typeids[0]) + || input_typeids[0] == UNKNOWNOID) + { + expr_result_type = get_sys_varcharoid(); + } + } + + if (!OidIsValid(expr_result_type)) + return NULL; + + /* Get the candidate with matching return type */ + ncandidates = 0; + best_candidate = NULL; + for (current_candidate = candidates; + current_candidate != NULL; + current_candidate = current_candidate->next) + { + /* we should only consider candidates for special function from sys schema */ + if (get_func_namespace(current_candidate->oid) != sys_oid) + continue; + + rettype = get_func_rettype(current_candidate->oid); + if (expr_result_type == rettype) + { + best_candidate = current_candidate; + ncandidates++; + } + } + + /* Only one definition should exists per return type for special function */ + if (ncandidates == 0) + { + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("function %s.%s with return type %s does not exists.", proc_nsname, proc_name, format_type_be(expr_result_type)))); + } + else if (ncandidates > 1) + { + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("multiple definitions of function %s.%s with return type %s found.", proc_nsname, proc_name, format_type_be(expr_result_type)))); + } + + if (best_candidate != NULL) + best_candidate->next = NULL; + return best_candidate; +} + static FuncCandidateList -tsql_func_select_candidate(int nargs, +tsql_func_select_candidate(List *names, + List *fargs, + int nargs, Oid *input_typeids, FuncCandidateList candidates, - bool unknowns_resolved) + bool unknowns_resolved, + bool is_special) { FuncCandidateList new_candidates; FuncCandidateList current_candidate; @@ -901,6 +1332,17 @@ tsql_func_select_candidate(int nargs, int i; bool candidates_are_opers = false; + if (is_special) + { + /* + * In case of dump restore we don't require special handling as PG handling will be sufficient + */ + if (babelfish_dump_restore) + return NULL; + + return tsql_func_select_candidate_for_special_func(names, fargs, nargs, input_typeids, candidates); + } + if (unknowns_resolved) { Oid *new_input_typeids = palloc(nargs * sizeof(Oid)); @@ -1016,7 +1458,7 @@ starts_with(const char *text, const char *pat) } static Node * -tsql_coerce_string_literal_hook(ParseCallbackState *pcbstate, Oid targetTypeId, +tsql_coerce_string_literal_hook(Oid targetTypeId, int32 targetTypeMod, int32 baseTypeMod, Const *newcon, char *value, CoercionContext ccontext, CoercionForm cformat, @@ -1149,8 +1591,6 @@ tsql_coerce_string_literal_hook(ParseCallbackState *pcbstate, Oid targetTypeId, false)); errFunc = makeFuncExpr(errFuncOid, targetTypeId, args, 0, 0, COERCE_EXPLICIT_CALL); - cancel_parser_errposition_callback(pcbstate); - result = (Node *) errFunc; /* If target is a domain, apply constraints. */ diff --git a/contrib/babelfishpg_tsql/src/pltsql_partition.c b/contrib/babelfishpg_tsql/src/pltsql_partition.c new file mode 100644 index 00000000000..41a6d14a4f5 --- /dev/null +++ b/contrib/babelfishpg_tsql/src/pltsql_partition.c @@ -0,0 +1,915 @@ +/*------------------------------------------------------------------------- + * + * pltsql_partition.c + * This file contains definitions of functions used + * for PL/tsql Partition. + * + * Portions Copyright (c) 2024, AWS + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * contrib/babelfishpg_tsql/src/pltsql_partition.c + * + *------------------------------------------------------------------------- + */ + +#include "postgres.h" +#include "access/genam.h" +#include "access/relation.h" +#include "access/table.h" +#include "catalog/partition.h" +#include "catalog/pg_inherits.h" +#include "catalog/pg_type.h" +#include "common/md5.h" +#include "miscadmin.h" +#include "nodes/makefuncs.h" +#include "nodes/nodes.h" +#include "nodes/pg_list.h" +#include "nodes/plannodes.h" +#include "parser/parse_coerce.h" +#include "parser/parse_type.h" +#include "utils/builtins.h" +#include "utils/elog.h" +#include "utils/fmgroids.h" +#include "utils/partcache.h" +#include "utils/lsyscache.h" +#include "utils/syscache.h" + +#include "catalog.h" +#include "hooks.h" +#include "pltsql.h" +#include "pltsql_partition.h" +#include "session.h" + +#define MD5_HASH_LEN 32 + +static char *construct_unique_hash(char *relation_name); +static void set_partition_range_bounds(PartitionBoundSpec *partbound, Datum *range_values, int idx, + int total_partitions, bool is_binary_datatype); +static void set_node_value_from_datum(A_Const *node, Datum val, bool is_binary_datatype); +static CreateStmt *create_partition_stmt(char *physical_schema_name, char *relname); +static void rename_table_update_bbf_partitions_name(RenameStmt *stmt, Oid parentrelid); + + +/* + * bbf_create_partition_tables + * This function creates partitions of babelfish partitioned table + * using the partition scheme and partitioning column. + */ +void +bbf_create_partition_tables(CreateStmt *stmt) +{ + Relation rel; + HeapTuple tuple; + SysScanDesc scan; + ScanKeyData scanKey[2]; + char *input_parameter_type; + char *partition_function_name; + Datum *range_values; + Datum *datum_values; + bool *nulls; + int nelems; + Oid sql_variant_type_oid; + Oid input_type_oid; + ListCell *elements; + Oid partition_column_typoid = InvalidOid; + Oid partition_column_basetypoid = InvalidOid; + char *partition_column_typname = NULL; + bool is_binary_datatype = false; + int16 dbid = get_cur_db_id(); + char *partition_scheme_name = stmt->partspec->tsql_partition_scheme; + char *relname = stmt->relation->relname; + char *partition_colname = linitial_node(PartitionElem, stmt->partspec->partParams)->name; + CreateStmt *partition_stmt; + PlannedStmt *wrapper; + char *unique_hash; + char *physical_schema_name; + char *logical_schema_name; + ArrayType *values; + bool isnull; + int i; + char *partition_name; + + /* Partitioning is not supported for tempopary tables. */ + if (stmt->relation->relpersistence == RELPERSISTENCE_TEMP) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("Creation of temporary partitioned tables is not supported in Babelfish."))); + + /* + * Get partition function name for the provided partition scheme, + * if provided partition scheme exists in current database. + */ + partition_function_name = get_partition_function_name(dbid, partition_scheme_name); + + /* Raise error if provided partition scheme doesn't exists in current database. */ + if (!partition_function_name) + { + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("Invalid partition scheme '%s' specifed.", partition_scheme_name))); + } + + /* Extract the datatype of partitioning column from CREATE statement. */ + foreach (elements, stmt->tableElts) + { + Node *element = lfirst(elements); + ColumnDef *coldef; + + if (nodeTag(element) != T_ColumnDef) + continue; + + coldef = castNode(ColumnDef, element); + + if (pg_strcasecmp(coldef->colname, partition_colname) == 0) + { + HeapTuple ctype = LookupTypeName(NULL, coldef->typeName, NULL, true); + Form_pg_type pg_type = (Form_pg_type) GETSTRUCT(ctype); + + partition_column_typoid = pg_type->oid; + partition_column_basetypoid = pg_type->typbasetype; + partition_column_typname = pstrdup(NameStr(pg_type->typname)); + ReleaseSysCache(ctype); + break; + } + } + + /* Get OID of sql_variant type. */ + sql_variant_type_oid = (*common_utility_plugin_ptr->get_tsql_datatype_oid) ("sql_variant"); + + /* + * Extract metadata of partition function like ranges and input parameter type by + * looking up in bbf_partition_function catalog using the partition function name and dbid. + */ + rel = table_open(get_bbf_partition_function_oid(), AccessShareLock); + + ScanKeyInit(&scanKey[0], + Anum_bbf_partition_function_dbid, + BTEqualStrategyNumber, F_INT2EQ, + Int16GetDatum(dbid)); + + ScanKeyEntryInitialize(&scanKey[1], 0, + Anum_bbf_partition_function_name, + BTEqualStrategyNumber, InvalidOid, + tsql_get_server_collation_oid_internal(false), + F_TEXTEQ, CStringGetTextDatum(partition_function_name)); + + scan = systable_beginscan(rel, get_bbf_partition_function_pk_idx_oid(), + false, NULL, 2, scanKey); + + tuple = systable_getnext(scan); + + if (!HeapTupleIsValid(tuple)) /* Sanity check. */ + { + systable_endscan(scan); + table_close(rel, AccessShareLock); + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("Partition function '%s' used for the specifed partition scheme '%s' does not exist.", partition_function_name, partition_scheme_name))); + } + + input_parameter_type = TextDatumGetCString(heap_getattr(tuple, Anum_bbf_partition_function_input_parameter_type, RelationGetDescr(rel), &isnull)); + values = DatumGetArrayTypeP(heap_getattr(tuple, Anum_bbf_partition_function_range_values, RelationGetDescr(rel), &isnull)); + deconstruct_array(values, sql_variant_type_oid, -1, false, 'i', &datum_values, &nulls, &nelems); + + systable_endscan(scan); + table_close(rel, AccessShareLock); + + /* + * If the partition columns type is UDT type, then we need + * to use the base type of that type while comparing with + * input parameter type of partition function. + */ + if (OidIsValid(partition_column_basetypoid)) + { + /* Get the TSQL typoid from partitioning column type name. */ + Oid tsql_typoid = (*common_utility_plugin_ptr->get_tsql_datatype_oid) (partition_column_typname); + + /* If the value of tsql_typname is NULL, it indicates that partitioning column is UDT type. */ + if (!OidIsValid(tsql_typoid)) + { + /* Substitute typoid with the base type to facilitate comparison. */ + partition_column_typoid = partition_column_basetypoid; + } + } + + input_type_oid = (*common_utility_plugin_ptr->get_tsql_datatype_oid) (input_parameter_type); + + /* + * Validate that type of partitioning columns is same + * to input parameter type of partition function. + */ + if (partition_column_typoid != input_type_oid) + { + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("Partition column '%s' has data type '%s' which is different from the partition function '%s' parameter data type '%s'.", + partition_colname, partition_column_typname, partition_function_name, input_parameter_type))); + } + + /* Check if the input parameter type is (var)binary datatype. */ + input_type_oid = getBaseType(input_type_oid); + if ((*common_utility_plugin_ptr->is_tsql_binary_datatype) (input_type_oid) || + (*common_utility_plugin_ptr->is_tsql_varbinary_datatype) (input_type_oid)) + is_binary_datatype = true; + + /* Convert each sql_variant values to CString. */ + range_values = palloc(nelems * sizeof(Datum)); + for (i = 0; i < nelems; i++) + { + range_values[i] = pltsql_exec_tsql_cast_value(datum_values[i], &isnull, + sql_variant_type_oid, -1, + CSTRINGOID, -1); + } + + /* + * Find default schema for current user when schema + * is not explicitly specified with create statement. + */ + if (!stmt->relation->schemaname) + { + char *db_name = get_cur_db_name(); + const char *user = get_user_for_database(db_name); + logical_schema_name = get_authid_user_ext_schema_name(db_name, user); + physical_schema_name = get_physical_schema_name(db_name, logical_schema_name); + pfree(db_name); + } + else + { + physical_schema_name = pstrdup(stmt->relation->schemaname); + logical_schema_name = (char *) get_logical_schema_name(physical_schema_name, false); + } + + partition_stmt = create_partition_stmt(physical_schema_name, relname); + + if (!partition_stmt) /* Sanity Check. */ + { + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("Failed to construct partitions for relation \"%s\".", relname))); + } + + /* Make a wrapper PlannedStmt. */ + wrapper = makeNode(PlannedStmt); + wrapper->commandType = CMD_UTILITY; + wrapper->canSetTag = false; + wrapper->utilityStmt = (Node *) partition_stmt; + wrapper->stmt_location = 0; + wrapper->stmt_len = 0; + + /* Construct hash based on partitioned table name. */ + unique_hash = construct_unique_hash(relname); + + for (i = 0; i < nelems + 1; i++) + { + /* + * Construct partition name with unique hash based + * on partitioned table name and partition number. + * And Set the name in CREATE PARTITION statment. + */ + partition_name = psprintf("%s_partition_%d", unique_hash, i); + partition_stmt->relation->relname = partition_name; + + /* Set the range boundaries in CREATE PARTITION statment. */ + set_partition_range_bounds(partition_stmt->partbound, range_values, i, nelems + 1, is_binary_datatype); + + /* Execute the CREATE PARTITION statment. */ + standard_ProcessUtility(wrapper, + "(CREATE PARTITION)", + false, + PROCESS_UTILITY_SUBCOMMAND, + NULL, + NULL, + None_Receiver, + NULL); + + CommandCounterIncrement(); + pfree(partition_name); + } + + /* + * Add an entry in sys.babelfish_partition_depend to track the + * dependency between partition scheme and partitioned table. + */ + add_entry_to_bbf_partition_depend(dbid, partition_scheme_name, logical_schema_name, relname); + + /* Free the allocated memory. */ + pfree(partition_column_typname); + pfree(partition_function_name); + pfree(physical_schema_name); + pfree(logical_schema_name); + pfree(unique_hash); + pfree(datum_values); + pfree(range_values); +} + +/* + * create_partition_stmt + * Creates a CREATE PARTITION statement using the provided physical schema name and relation name. + * Here, we need to change the dialect to postgres to parse the CREATE PARTITION Postgres statement. + * After parsing, we reset the dialect back to original value. + */ +static CreateStmt* +create_partition_stmt(char *physical_schema_name, char *relname) +{ + CreateStmt *partition_stmt = NULL; + const char *old_dialect = GetConfigOption("babelfishpg_tsql.sql_dialect", true, true); + List *res; + StringInfoData query; + + /* + * We prepare the following query to CREATE PARTITION of partitioned table. + * This will be executed using standard_ProcessUtility(). + */ + initStringInfo(&query); + appendStringInfo(&query, "CREATE TABLE \"%s\".dummy PARTITION OF \"%s\".\"%s\"" + " FOR VALUES FROM ('dummy') TO ('dummy');", + physical_schema_name, physical_schema_name, relname); + PG_TRY(); + { + set_config_option("babelfishpg_tsql.sql_dialect", "postgres", GUC_CONTEXT_CONFIG, + PGC_S_SESSION, GUC_ACTION_SAVE, true, 0, false); + res = raw_parser(query.data, RAW_PARSE_DEFAULT); + partition_stmt = (CreateStmt *) parsetree_nth_stmt(res, 0); + } + PG_FINALLY(); + { + /* Reset dialect back to original value. */ + set_config_option("babelfishpg_tsql.sql_dialect", old_dialect, GUC_CONTEXT_CONFIG, + PGC_S_SESSION, GUC_ACTION_SAVE, true, 0, false); + pfree(query.data); + } + PG_END_TRY(); + return partition_stmt; +} + +/* + * construct_unique_hash + * Constructs a unique hash based on the relation name, + * this is used to construct unique names for partitions. + */ +static char* +construct_unique_hash(char *relation_name) +{ + char *md5; + bool success; + const char *errstr = NULL; + + md5 = (char *) palloc(MD5_HASH_LEN + 1); + + success = pg_md5_hash(relation_name, strlen(relation_name), md5, &errstr); + + if (unlikely(!success)) /* Out of memory. */ + { + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("Constructing unique partition name failed for relation \"%s\": %s.", relation_name, errstr))); + } + + return md5; +} + +/* + * set_partition_range_bounds + * This function sets the lower and upper bounds for a range partition based on its index + * and the total number of partitions. It handles the following cases: + * 1. For the first partition, it sets the lower bound to DEFAULT to + * accommodate NULL values along with other values. + * 2. For the last partition, it sets the upper bound to MAXVALUE. + * 3. For other partitions, it sets the bounds to the corresponding values in the range_values array. + */ +static void +set_partition_range_bounds(PartitionBoundSpec *partbound, Datum *range_values, int idx, + int total_partitions, bool is_binary_datatype) +{ + + /* Set lower bound of partition. */ + if (idx == 0) /* first partition */ + { + partbound->is_default = true; + partbound->location = -1; + partbound->lowerdatums = NIL; + partbound->upperdatums = NIL; + return; + } + else + { + A_Const *node = makeNode(A_Const); + set_node_value_from_datum(node, range_values[idx-1], is_binary_datatype); + partbound->is_default = false; + partbound->lowerdatums = list_make1(node); + } + + /* Set upper bound of partition. */ + if (idx == total_partitions - 1) /* last partition */ + { + ColumnRef *node = makeNode(ColumnRef); + node->fields = list_make1(makeString("maxvalue")); + partbound->is_default = false; + partbound->upperdatums = list_make1(node); + } + else + { + A_Const *node = makeNode(A_Const); + set_node_value_from_datum(node, range_values[idx], is_binary_datatype); + partbound->is_default = false; + partbound->upperdatums = list_make1(node); + } +} + +/* + * set_node_value_from_datum + * Set the value of an A_Const node based on the datatype. + * If the data type is (var)binary, the value is set as a hexadecimal string. + * Otherwise, the value is set as a regular string. + */ +static void +set_node_value_from_datum(A_Const *node, Datum val, bool is_binary_datatype) +{ + if (is_binary_datatype) + { + node->val.sval.type = T_TSQL_HexString; + node->val.hsval.hsval = DatumGetCString(val); + } + else + { + node->val.sval.type = T_String; + node->val.sval.sval = DatumGetCString(val); + } +} + +/* + * bbf_drop_handle_partitioned_table + * When the table is being dropped is: + * 1. babelfish partitioned table, then it removes the entry from bbf_partition_depend catalog. + * 2. partition of babelfish partitioned table, then it throws an error. + * 3. other than above, then it does nothing. + */ +void +bbf_drop_handle_partitioned_table(DropStmt *stmt) +{ + Relation relation; + ListCell *cell; + int16 dbid; + char *physical_schemaname; + char *logical_schemaname; + char *relname; + Form_pg_class form; + + foreach (cell, stmt->objects) + { + relation = NULL; + get_object_address(stmt->removeType, lfirst(cell), &relation, AccessShareLock, true); + if (!relation) + continue; + + form = RelationGetForm(relation); + relname = RelationGetRelationName(relation); + + /* Proceed further only for permanent and partition/partitioned table. */ + if (!(form->relkind == RELKIND_PARTITIONED_TABLE || form->relispartition) + || form->relpersistence != RELPERSISTENCE_PERMANENT) + { + relation_close(relation, AccessShareLock); + continue; + } + + physical_schemaname = get_namespace_name(form->relnamespace); + + /* Find logical schema name from physical schema name. */ + logical_schemaname = (char *) get_logical_schema_name(physical_schemaname, true); + + if (!logical_schemaname) /* not a TSQL schema */ + { + pfree(physical_schemaname); + relation_close(relation, AccessShareLock); + continue; + } + + /* Find dbid from physical schema name for a TSQL schema. */ + dbid = get_dbid_from_physical_schema_name(physical_schemaname, false); + pfree(physical_schemaname); + + if (form->relispartition) /* relation is partition of table */ + { + /* Prevent non-superusers from droping partitions of Babelfish partitioned tables. */ + if (!superuser() && is_bbf_partitioned_table(dbid, logical_schemaname, get_rel_name(get_partition_parent(form->oid, false)))) + { + relation_close(relation, AccessShareLock); + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("Cannot drop the babelfish partition table '%s'.", relname))); + } + } + else if (form->relkind == RELKIND_PARTITIONED_TABLE) /* relation is partitioned table */ + { + /* In case of babelfish partitioned table then remove the entry from bbf_partition_depend table. */ + if (is_bbf_partitioned_table(dbid, logical_schemaname, relname)) + remove_entry_from_bbf_partition_depend(dbid, logical_schemaname, relname); + } + relation_close(relation, AccessShareLock); + pfree(logical_schemaname); + } +} + +/* + * bbf_validate_partitioned_index_alignment + * Validates whether the index being created on a partitioned table is aligned + * with the table's partition scheme. It checks if the column specified for + * the index is part of the partitioning columns and if the partition scheme + * used for the index matches the partition scheme used for the table. + */ +bool +bbf_validate_partitioned_index_alignment(IndexStmt *stmt) +{ + char *partition_scheme_name = strVal(linitial(stmt->excludeOpNames)); + char *colname = strVal(lsecond(stmt->excludeOpNames)); + char *relname = stmt->relation->relname; + char *physical_schema_name; + char *logical_schema_name; + char *partition_scheme_used_for_table; + int16 dbid = get_cur_db_id(); + char *db_name = get_cur_db_name(); + Oid relid; + HeapTuple tuple; + int attnum; + Relation rel; + PartitionKey key; + int partnatts; + int i; + + /* + * Find default schema for current user when schema + * is not explicitly specified for TDS client. + */ + if (!stmt->relation->schemaname) + { + const char *user = get_user_for_database(db_name); + logical_schema_name = get_authid_user_ext_schema_name(db_name, user); + physical_schema_name = get_physical_schema_name(db_name, logical_schema_name); + } + else + { + physical_schema_name = pstrdup(stmt->relation->schemaname); + logical_schema_name = (char *) get_logical_schema_name(physical_schema_name, false); + } + + relid = get_relname_relid(relname, get_namespace_oid(physical_schema_name, false)); + + pfree(physical_schema_name); + pfree(db_name); + + /* Search for the column specified with partition scheme in table's columns. */ + tuple = SearchSysCacheAttName(relid, colname); + + /* Raise an error if column specified with partition scheme doesn't exists in table. */ + if (!HeapTupleIsValid(tuple)) + { + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_COLUMN), + errmsg("column '%s' does not exist", colname))); + } + + attnum = ((Form_pg_attribute) GETSTRUCT(tuple))->attnum; + ReleaseSysCache(tuple); + + /* Raise an error if provided partition scheme doesn't exists in the current database. */ + if (!partition_scheme_exists(dbid, partition_scheme_name)) + { + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("Invalid object name '%s'.", partition_scheme_name))); + } + + /* Find the partition scheme used to create partitioned table. */ + partition_scheme_used_for_table = get_partition_scheme_for_partitioned_table(dbid, logical_schema_name, relname); + pfree(logical_schema_name); + + /* partition_scheme_used_for_table will be null for non-partitioned table */ + if (!partition_scheme_used_for_table || + pg_strcasecmp(partition_scheme_name, partition_scheme_used_for_table) != 0) + { + if (partition_scheme_used_for_table) + pfree(partition_scheme_used_for_table); + return false; + } + + /* + * Column specified with partition scheme should be part of partitioning columns. + * Otherwise, the index is unaligned. + */ + rel = RelationIdGetRelation(relid); + key = RelationGetPartitionKey(rel); + partnatts = get_partition_natts(key); + + for (i = 0; i < partnatts; i++) + { + if (attnum == get_partition_col_attnum(key, i)) + break; + } + + RelationClose(rel); + + if (partition_scheme_used_for_table) + pfree(partition_scheme_used_for_table); + + if (i == partnatts) /* not part of partitioning columns */ + return false; + return true; +} + +/* + * bbf_rename_handle_partitioned_table + * 1. For a rename operation on a babelfish partitioned table, rename all of its partition and + * and update the table_name in sys.babelfish_partition_depend catalog. + * 2. For a rename operation on a babelfish partition table, raise error. + */ +void +bbf_rename_handle_partitioned_table(RenameStmt *stmt) +{ + char *table_name = stmt->relation->relname; + char *physical_schema_name; + char *logical_schema_name; + bool is_partition_table, is_partitioned_table; + Form_pg_class form; + HeapTuple tuple; + Oid nsp_oid; + int16 dbid; + RangeVar *new_rel = makeRangeVar(stmt->relation->schemaname, stmt->newname, -1); + Oid relid = RangeVarGetRelid(new_rel, NoLock, true);; + + /* Get the namespace OID and type of the table. */ + tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid)); + + if (!HeapTupleIsValid(tuple)) /* Sanity check. */ + return; + + form = (Form_pg_class) GETSTRUCT(tuple); + is_partition_table = form->relispartition; + is_partitioned_table = (form->relkind == RELKIND_PARTITIONED_TABLE); + nsp_oid = form->relnamespace; + ReleaseSysCache(tuple); + + /* Proceed further only if table is a partition or partitioned table. */ + if (!is_partition_table && !is_partitioned_table) + return; + + /* Get the physical schema name from namespace OID. */ + physical_schema_name = get_namespace_name(nsp_oid); + + /* Find the logical schema name from physical schema name. */ + logical_schema_name = (char *) get_logical_schema_name(physical_schema_name, true); + + if (!logical_schema_name) /* not a TSQL schema */ + { + pfree(physical_schema_name); + return; + } + + /* Find the dbid from the physical schema name. */ + dbid = get_dbid_from_physical_schema_name(physical_schema_name, false); + + /* + * For babelfish partition table, user should not + * be allowed to rename it. + */ + if (is_partition_table) + { + char *parent_table_name = get_rel_name(get_partition_parent(relid, false)); + if (is_bbf_partitioned_table(dbid, logical_schema_name, parent_table_name)) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("Cannot rename babelfish partition table '%s'.", stmt->relation->relname))); + pfree(parent_table_name); + } + /* + * For babelfish partitioned table, rename all of its partition and + * update the table_name in sys.babelfish_partition_depend catalog. + */ + else if (is_bbf_partitioned_table(dbid, logical_schema_name, table_name)) + { + rename_table_update_bbf_partitions_name(stmt, relid); + rename_table_update_bbf_partition_depend_catalog(stmt, logical_schema_name, dbid); + } + + pfree(physical_schema_name); + pfree(logical_schema_name); +} + +/* + * rename_table_update_bbf_partitions_name + * For a rename operation on a babelfish partitioned table, it renames all partition + * of the table to the new name using hash based on the new name, so that + * name of partitions of any partitioned table doesn't conflict. + */ +static void +rename_table_update_bbf_partitions_name(RenameStmt *stmt, Oid parentrelid) +{ + char *physical_schema_name = stmt->relation->schemaname; + char *table_name = stmt->relation->relname; + List *partition_names = NIL; + char *new_hash; + PlannedStmt *wrapper; + RenameStmt *rename_partition_stmt = NULL; + List *parsetree; + Relation relation; + SysScanDesc scan; + ScanKeyData key; + Oid inhrelid; + HeapTuple tuple; + const char *old_dialect; + StringInfoData query; + char *partition_name; + char *new_partition_name; + + relation = table_open(InheritsRelationId, AccessShareLock); + + ScanKeyInit(&key, + Anum_pg_inherits_inhparent, + BTEqualStrategyNumber, F_OIDEQ, + ObjectIdGetDatum(parentrelid)); + + scan = systable_beginscan(relation, InheritsParentIndexId, true, + NULL, 1, &key); + + while ((tuple = systable_getnext(scan)) != NULL) + { + inhrelid = ((Form_pg_inherits) GETSTRUCT(tuple))->inhrelid; + partition_names = lappend(partition_names, get_rel_name(inhrelid)); + } + systable_endscan(scan); + table_close(relation, AccessShareLock); + + /* + * We prepare the following query to rename the partitions of partitioned table. + * This will be executed using standard_ProcessUtility(). + */ + initStringInfo(&query); + appendStringInfo(&query, "ALTER TABLE \"%s\".dummy RENAME TO dummy;", physical_schema_name); + + old_dialect = GetConfigOption("babelfishpg_tsql.sql_dialect", true, true); + + /* We need to change the dialect to postgres to parse the RENAME statement. */ + PG_TRY(); + { + set_config_option("babelfishpg_tsql.sql_dialect", "postgres", GUC_CONTEXT_CONFIG, + PGC_S_SESSION, GUC_ACTION_SAVE, true, 0, false); + + parsetree = raw_parser(query.data, RAW_PARSE_DEFAULT); + rename_partition_stmt = (RenameStmt *) parsetree_nth_stmt(parsetree, 0); + } + PG_FINALLY(); + { + /* Reset dialect back to original value. */ + set_config_option("babelfishpg_tsql.sql_dialect", old_dialect, GUC_CONTEXT_CONFIG, + PGC_S_SESSION, GUC_ACTION_SAVE, true, 0, false); + } + PG_END_TRY(); + + if (!rename_partition_stmt) /* Sanity Check. */ + { + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("Failed to rename partitions of relation \"%s\".", table_name))); + } + + /* Need to make a wrapper PlannedStmt. */ + wrapper = makeNode(PlannedStmt); + wrapper->commandType = CMD_UTILITY; + wrapper->canSetTag = false; + wrapper->utilityStmt = (Node *) rename_partition_stmt; + wrapper->stmt_location = 0; + wrapper->stmt_len = 0; + + /* Construct hash based on new name. */ + new_hash = construct_unique_hash(stmt->newname); + + for (int i = 0; i < list_length(partition_names); i++) + { + partition_name = list_nth(partition_names, i); + + /* + * Generate new partition name by replacing the hash portion + * of existing partition name with new hash value. + */ + new_partition_name = pstrdup(partition_name); + memcpy(new_partition_name, new_hash, MD5_HASH_LEN); + + /* Set the names in RENAME statment. */ + rename_partition_stmt->relation->relname = partition_name; + rename_partition_stmt->newname = new_partition_name; + + /* Execute the rename statment. */ + standard_ProcessUtility(wrapper, + "(RENAME PARTITION)", + false, + PROCESS_UTILITY_SUBCOMMAND, + NULL, + NULL, + None_Receiver, + NULL); + + CommandCounterIncrement(); + + pfree(partition_name); + pfree(new_partition_name); + } + + /* Free the allocated memory. */ + if (partition_names) + list_free(partition_names); + pfree(new_hash); + pfree(query.data); +} + +/* + * For Babelfish partitioned tables, non-superusers should not be permitted + * to attach or detach partitions from the partitioned table, and they + * should also be restricted from modifying the partitions from both + * TSQL as well as PG endpoint. + * + * NOTE: We are only blocking operation on Babelfish partitioned tables i.e. + * partitioned tables created from the TSQL endpoint. Existing users who have + * created partitioned tables from the PostgreSQL endpoint can continue to modify, + * attach, and detach partitions as usual. + */ +void +bbf_alter_handle_partitioned_table(AlterTableStmt *stmt) +{ + AlterTableCmd *cmd = (AlterTableCmd *) linitial(stmt->cmds); + int16 dbid; + char *physical_schemaname; + char *logical_schemaname; + Form_pg_class form; + Oid nsp_oid; + HeapTuple tuple; + bool is_partition_table, is_partitioned_table; + Oid relid = RangeVarGetRelid(stmt->relation, NoLock, true); + + if (!OidIsValid(relid)) + return; + + /* Get the namespace OID and rekind type of the table. */ + tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid)); + + if (!HeapTupleIsValid(tuple)) /* Sanity check. */ + return; + + form = (Form_pg_class) GETSTRUCT(tuple); + is_partition_table = form->relispartition; + is_partitioned_table = (form->relkind == 'p'); + nsp_oid = form->relnamespace; + ReleaseSysCache(tuple); + + /* Proceed further only if table is a partition or partitioned table. */ + if (!is_partition_table && !is_partitioned_table) + return; + + /* Get the schema name from namespace OID. */ + physical_schemaname = get_namespace_name(nsp_oid); + + /* Find dbid logical schema name physical schema name. */ + logical_schemaname = (char *) get_logical_schema_name(physical_schemaname, true); + if (!logical_schemaname) /* not a TSQL schema */ + { + pfree(physical_schemaname); + return; + } + + /* Find dbid from physical schema name for a TSQL schema. */ + dbid = get_dbid_from_physical_schema_name(physical_schemaname, false); + + /* + * For babelfish partitioned table, user should not be + * allowed to attach/detach to table directly. + * These commands can be executed only from PG endpoint. + */ + if (is_partitioned_table && (cmd->subtype == AT_AttachPartition || + cmd->subtype == AT_DetachPartition || cmd->subtype == AT_DetachPartitionFinalize)) + { + if (is_bbf_partitioned_table(dbid, logical_schemaname, stmt->relation->relname)) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("Cannot %s babelfish partitioned table '%s'.", + cmd->subtype == AT_AttachPartition ? "attach partition to" : "detach partition from", + stmt->relation->relname))); + } + /* + * For babelfish partition table, user should not + * be allowed to modify it. + * This will blocked from both TSQL and PG endpoint. + */ + else if (is_partition_table) + { + char *parent_table_name = get_rel_name(get_partition_parent(relid, false)); + if (is_bbf_partitioned_table(dbid, logical_schemaname, parent_table_name)) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("Modifying partitions directly is not supported. You can modify the partitions by modifying the parent table."))); + pfree(parent_table_name); + } + + pfree(physical_schemaname); + pfree(logical_schemaname); +} diff --git a/contrib/babelfishpg_tsql/src/pltsql_partition.h b/contrib/babelfishpg_tsql/src/pltsql_partition.h new file mode 100644 index 00000000000..a4d72963656 --- /dev/null +++ b/contrib/babelfishpg_tsql/src/pltsql_partition.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * pltsql_partition.h + * This file contains declartions of function externs used + * for PL/tsql Partition. + * + * Portions Copyright (c) 2024, AWS + * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * contrib/babelfishpg_tsql/src/pltsql_partition.h + * + *------------------------------------------------------------------------- + */ +#ifndef PLTSQL_PARTITION_H +#define PLTSQL_PARTITION_H + +#include "nodes/parsenodes.h" + +/* Max number of partitions allowed for babelfish partitioned tables. */ +#define MAX_PARTITIONS_LIMIT 15000 + +extern void bbf_create_partition_tables(CreateStmt *stmt); +extern void bbf_drop_handle_partitioned_table(DropStmt *stmt); +extern void bbf_alter_handle_partitioned_table(AlterTableStmt *stmt); +extern bool bbf_validate_partitioned_index_alignment(IndexStmt *stmt); +extern void bbf_rename_handle_partitioned_table(RenameStmt *stmt); + +#endif /* PLTSQL_PARTITION_H */ diff --git a/contrib/babelfishpg_tsql/src/pltsql_ruleutils.c b/contrib/babelfishpg_tsql/src/pltsql_ruleutils.c index 5ae29053e9d..462aebe5c7f 100644 --- a/contrib/babelfishpg_tsql/src/pltsql_ruleutils.c +++ b/contrib/babelfishpg_tsql/src/pltsql_ruleutils.c @@ -859,7 +859,7 @@ tsql_print_function_arguments(StringInfo buf, HeapTuple proctup, char *str; /* Fetch default positions */ - arg_default_positions = SysCacheGetAttr(PROCNSPSIGNATURE, + arg_default_positions = SysCacheGetAttr(PROCNAMENSPSIGNATURE, bbffunctuple, Anum_bbf_function_ext_default_positions, &isnull); @@ -873,7 +873,7 @@ tsql_print_function_arguments(StringInfo buf, HeapTuple proctup, pfree(str); } else - ReleaseSysCache(bbffunctuple); + heap_freetuple(bbffunctuple); } } @@ -979,7 +979,7 @@ tsql_print_function_arguments(StringInfo buf, HeapTuple proctup, } if (default_positions_available) - ReleaseSysCache(bbffunctuple); + heap_freetuple(bbffunctuple); return argsprinted; } diff --git a/contrib/babelfishpg_tsql/src/pltsql_utils.c b/contrib/babelfishpg_tsql/src/pltsql_utils.c index 65e71955622..8d27110bcbd 100644 --- a/contrib/babelfishpg_tsql/src/pltsql_utils.c +++ b/contrib/babelfishpg_tsql/src/pltsql_utils.c @@ -6,6 +6,7 @@ #include "catalog/pg_type.h" #include "catalog/pg_trigger.h" #include "catalog/pg_constraint.h" +#include "funcapi.h" #include "parser/parser.h" /* only needed for GUC variables */ #include "parser/parse_type.h" #include "mb/pg_wchar.h" @@ -34,11 +35,6 @@ bool suppress_string_truncation_error = false; bool pltsql_suppress_string_truncation_error(void); -bool is_tsql_varchar_or_char_datatype(Oid oid); /* sys.char / sys.varchar */ -bool is_tsql_nchar_or_nvarchar_datatype(Oid oid); /* sys.nchar / sys.nvarchar */ -bool is_tsql_binary_or_varbinary_datatype(Oid oid); /* sys.binary / sys.varbinary */ -bool is_tsql_datatype_with_max_scale_expr_allowed(Oid oid); /* sys.varchar(max), sys.nvarchar(max), sys.varbinary(max) */ -bool is_tsql_text_ntext_or_image_datatype(Oid oid); bool @@ -51,6 +47,7 @@ extern char *get_cur_db_name(void); extern char *construct_unique_index_name(char *index_name, char *relation_name); extern char *get_physical_schema_name(char *db_name, const char *schema_name); extern const char *get_dbo_schema_name(const char *dbname); +PG_FUNCTION_INFO_V1(split_identifier_internal); /* To cache oid of sys.varchar */ static Oid sys_varcharoid = InvalidOid; @@ -211,17 +208,40 @@ pltsql_createFunction(ParseState *pstate, PlannedStmt *pstmt, const char *queryS Oid func_oid = InvalidOid; char *schemaname = NULL; char *funcname = NULL; + List *path_oids = NULL; + char *cur_schema_name = NULL; func = makeNode(ObjectWithArgs); - func->objname = stmt->funcname; - func->args_unspecified = true; /* Get the schema name and function name. */ DeconstructQualifiedName(stmt->funcname, &schemaname, &funcname); - /* function, procedure */ + /* If schema name is not specified, use the current default schema */ + if (schemaname == NULL || !strlen(schemaname)) + { + path_oids = fetch_search_path(false); + if (path_oids != NIL) + { + cur_schema_name = get_namespace_name(linitial_oid(path_oids)); + if (unlikely(cur_schema_name == NULL)) + { + ereport(ERROR, (errcode(ERRCODE_UNDEFINED_SCHEMA), + errmsg("Current schema name could not be determined"))); + } + func->objname = list_make2(makeString(cur_schema_name), makeString(funcname)); + list_free(path_oids); + } + } + else + func->objname = stmt->funcname; + + func->args_unspecified = true; + func_oid = LookupFuncWithArgs(OBJECT_ROUTINE, func, true); + if (cur_schema_name) + pfree(cur_schema_name); + if (OidIsValid(func_oid)) { /* Restrict duplicate procedure/function. */ @@ -1265,7 +1285,7 @@ flatten_search_path(List *oid_list) return pathbuf.data; } -const char * +char * get_pltsql_function_signature_internal(const char *funcname, int nargs, const Oid *argtypes) { @@ -1579,6 +1599,71 @@ split_object_name(char *name) return res; } +/* + * Wrapper over split_object_name function above to expose it as a SQL function. + */ +Datum +split_identifier_internal(PG_FUNCTION_ARGS) +{ + FuncCallContext *funcctx; + char **split_parts = NULL; + + if (SRF_IS_FIRSTCALL()) + { + int num_parts = 0; + MemoryContext oldcontext; + + funcctx = SRF_FIRSTCALL_INIT(); + oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx); + if (!PG_ARGISNULL(0)) + { + char *input; + char **splited_object_name; + int i, j = 0; + + input = text_to_cstring(PG_GETARG_TEXT_P(0)); + splited_object_name = split_object_name(input); + + for (i = 0; i < 4; i++) + { + if (strlen(splited_object_name[i]) > 0) + num_parts++; + } + + if (num_parts > 0) + { + split_parts = (char **) palloc(num_parts * sizeof(char *)); + + for (i = 0; i < 4; i++) + { + if (i >= (4 - num_parts)) + split_parts[j++] = splited_object_name[i]; + else + pfree(splited_object_name[i]); + } + } + pfree(splited_object_name); + } + + funcctx->max_calls = num_parts; + funcctx->user_fctx = split_parts; + MemoryContextSwitchTo(oldcontext); + } + + funcctx = SRF_PERCALL_SETUP(); + split_parts = (char **) funcctx->user_fctx; + + if (funcctx->call_cntr < funcctx->max_calls) + { + VarChar *val = (*common_utility_plugin_ptr->tsql_varchar_input) (split_parts[funcctx->call_cntr], + strlen(split_parts[funcctx->call_cntr]), + -1); + SRF_RETURN_NEXT(funcctx, PointerGetDatum(val)); + } + else + SRF_RETURN_DONE(funcctx); +} + /* * is_schema_from_db diff --git a/contrib/babelfishpg_tsql/src/procedures.c b/contrib/babelfishpg_tsql/src/procedures.c index d3a0781741d..eedbc854a2a 100644 --- a/contrib/babelfishpg_tsql/src/procedures.c +++ b/contrib/babelfishpg_tsql/src/procedures.c @@ -93,7 +93,6 @@ static List *gen_sp_droprolemember_subcmds(const char *user, const char *member) static List *gen_sp_rename_subcmds(const char *objname, const char *newname, const char *schemaname, ObjectType objtype, const char *curr_relname); static void update_bbf_server_options(char *servername, char *optname, char *optvalue, bool isInsert); static void clean_up_bbf_server_option(char *servername); -static void remove_delimited_identifer(char *str); static void rename_extended_property(ObjectType objtype, const char *var_schema_name, const char *var_major_name, @@ -593,6 +592,9 @@ handle_bool_expr_rec(BoolExpr *expr, List *list, bool is_sp_describe_undeclared_ A_Expr *xpr; ColumnRef *ref; + if (is_sp_describe_undeclared_parameters && !is_supported_case_sp_describe_undeclared_parameters) + return list; + foreach(lc, args) { Expr *arg = (Expr *) lfirst(lc); @@ -638,6 +640,9 @@ handle_where_clause_attnums(ParseState *pstate, Node *w_clause, List *target_att char *name; int attrno; + if (is_sp_describe_undeclared_parameters && !is_supported_case_sp_describe_undeclared_parameters) + return target_attnums; + if (w_clause && nodeTag(w_clause) == T_A_Expr) { A_Expr *where_clause = (A_Expr *) w_clause; @@ -736,6 +741,9 @@ handle_where_clause_restargets_left(ParseState *pstate, Node *w_clause, List *ex char *name; int attrno; + if (is_sp_describe_undeclared_parameters && !is_supported_case_sp_describe_undeclared_parameters) + return extra_restargets; + if (w_clause && nodeTag(w_clause) == T_A_Expr) { A_Expr *where_clause = (A_Expr *) w_clause; @@ -849,6 +857,9 @@ handle_where_clause_restargets_right(ParseState *pstate, Node *w_clause, List *e String *field; ResTarget *res; + if (is_sp_describe_undeclared_parameters && !is_supported_case_sp_describe_undeclared_parameters) + return extra_restargets; + if (w_clause && nodeTag(w_clause) == T_A_Expr) { A_Expr *where_clause = (A_Expr *) w_clause; @@ -1041,98 +1052,101 @@ sp_describe_undeclared_parameters_internal(PG_FUNCTION_ARGS) } } - /* - * Analyze the parsed statement to suggest types for undeclared - * parameters - */ - switch (node_type) + if (is_supported_case_sp_describe_undeclared_parameters) { - case T_InsertStmt: - rewrite_object_refs(parsetree->stmt); - sql_dialect = sql_dialect_value_old; - insert_stmt = (InsertStmt *) parsetree->stmt; - relation = insert_stmt->relation; - relid = RangeVarGetRelid(relation, NoLock, false); - r = relation_open(relid, AccessShareLock); - pstate = (ParseState *) palloc0(sizeof(ParseState)); - pstate->p_target_relation = r; - cols = checkInsertTargets(pstate, insert_stmt->cols, &target_attnums); - break; - case T_UpdateStmt: - rewrite_object_refs(parsetree->stmt); - sql_dialect = sql_dialect_value_old; - update_stmt = (UpdateStmt *) parsetree->stmt; - relation = update_stmt->relation; - relid = RangeVarGetRelid(relation, NoLock, false); - r = relation_open(relid, AccessShareLock); - pstate = (ParseState *) palloc0(sizeof(ParseState)); - pstate->p_target_relation = r; - cols = list_copy(update_stmt->targetList); - - /* - * Add attnums to cols based on targetList - */ - foreach(lc, cols) - { - ResTarget *col = (ResTarget *) lfirst(lc); - char *name = col->name; - int attrno; + /* + * Analyze the parsed statement to suggest types for undeclared + * parameters + */ + switch (node_type) + { + case T_InsertStmt: + rewrite_object_refs(parsetree->stmt); + sql_dialect = sql_dialect_value_old; + insert_stmt = (InsertStmt *) parsetree->stmt; + relation = insert_stmt->relation; + relid = RangeVarGetRelid(relation, NoLock, false); + r = relation_open(relid, AccessShareLock); + pstate = (ParseState *) palloc0(sizeof(ParseState)); + pstate->p_target_relation = r; + cols = checkInsertTargets(pstate, insert_stmt->cols, &target_attnums); + break; + case T_UpdateStmt: + rewrite_object_refs(parsetree->stmt); + sql_dialect = sql_dialect_value_old; + update_stmt = (UpdateStmt *) parsetree->stmt; + relation = update_stmt->relation; + relid = RangeVarGetRelid(relation, NoLock, false); + r = relation_open(relid, AccessShareLock); + pstate = (ParseState *) palloc0(sizeof(ParseState)); + pstate->p_target_relation = r; + cols = list_copy(update_stmt->targetList); - attrno = attnameAttNum(pstate->p_target_relation, name, false); - if (attrno == InvalidAttrNumber) + /* + * Add attnums to cols based on targetList + */ + foreach(lc, cols) { - ereport(ERROR, - (errcode(ERRCODE_UNDEFINED_COLUMN), - errmsg("column \"%s\" of relation \"%s\" does not exist", - name, - RelationGetRelationName(pstate->p_target_relation)))); + ResTarget *col = (ResTarget *) lfirst(lc); + char *name = col->name; + int attrno; + + attrno = attnameAttNum(pstate->p_target_relation, name, false); + if (attrno == InvalidAttrNumber) + { + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_COLUMN), + errmsg("column \"%s\" of relation \"%s\" does not exist", + name, + RelationGetRelationName(pstate->p_target_relation)))); + } + target_attnums = lappend_int(target_attnums, attrno); } - target_attnums = lappend_int(target_attnums, attrno); - } - target_attnums = handle_where_clause_attnums(pstate, update_stmt->whereClause, target_attnums, true); - extra_restargets = handle_where_clause_restargets_left(pstate, update_stmt->whereClause, extra_restargets, true); + target_attnums = handle_where_clause_attnums(pstate, update_stmt->whereClause, target_attnums, true); + extra_restargets = handle_where_clause_restargets_left(pstate, update_stmt->whereClause, extra_restargets, true); - cols = list_concat_copy(cols, extra_restargets); - break; - case T_DeleteStmt: - rewrite_object_refs(parsetree->stmt); - sql_dialect = sql_dialect_value_old; - delete_stmt = (DeleteStmt *) parsetree->stmt; - relation = delete_stmt->relation; - relid = RangeVarGetRelid(relation, NoLock, false); - r = relation_open(relid, AccessShareLock); - pstate = (ParseState *) palloc0(sizeof(ParseState)); - pstate->p_target_relation = r; - cols = NIL; - - /* - * Add attnums to cols based on targetList - */ - foreach(lc, cols) - { - ResTarget *col = (ResTarget *) lfirst(lc); - char *name = col->name; - int attrno; + cols = list_concat_copy(cols, extra_restargets); + break; + case T_DeleteStmt: + rewrite_object_refs(parsetree->stmt); + sql_dialect = sql_dialect_value_old; + delete_stmt = (DeleteStmt *) parsetree->stmt; + relation = delete_stmt->relation; + relid = RangeVarGetRelid(relation, NoLock, false); + r = relation_open(relid, AccessShareLock); + pstate = (ParseState *) palloc0(sizeof(ParseState)); + pstate->p_target_relation = r; + cols = NIL; - attrno = attnameAttNum(pstate->p_target_relation, name, false); - if (attrno == InvalidAttrNumber) + /* + * Add attnums to cols based on targetList + */ + foreach(lc, cols) { - ereport(ERROR, - (errcode(ERRCODE_UNDEFINED_COLUMN), - errmsg("column \"%s\" of relation \"%s\" does not exist", - name, - RelationGetRelationName(pstate->p_target_relation)))); + ResTarget *col = (ResTarget *) lfirst(lc); + char *name = col->name; + int attrno; + + attrno = attnameAttNum(pstate->p_target_relation, name, false); + if (attrno == InvalidAttrNumber) + { + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_COLUMN), + errmsg("column \"%s\" of relation \"%s\" does not exist", + name, + RelationGetRelationName(pstate->p_target_relation)))); + } + target_attnums = lappend_int(target_attnums, attrno); } - target_attnums = lappend_int(target_attnums, attrno); - } - target_attnums = handle_where_clause_attnums(pstate, delete_stmt->whereClause, target_attnums, true); - extra_restargets = handle_where_clause_restargets_left(pstate, delete_stmt->whereClause, extra_restargets, true); + target_attnums = handle_where_clause_attnums(pstate, delete_stmt->whereClause, target_attnums, true); + extra_restargets = handle_where_clause_restargets_left(pstate, delete_stmt->whereClause, extra_restargets, true); - cols = list_concat_copy(cols, extra_restargets); - break; - default: - is_supported_case_sp_describe_undeclared_parameters = false; - break; + cols = list_concat_copy(cols, extra_restargets); + break; + default: + is_supported_case_sp_describe_undeclared_parameters = false; + break; + } } if (is_supported_case_sp_describe_undeclared_parameters) @@ -1200,7 +1214,7 @@ sp_describe_undeclared_parameters_internal(PG_FUNCTION_ARGS) break; } - if (!(list_length(values_list) > 1) && is_supported_case_sp_describe_undeclared_parameters) + if (is_supported_case_sp_describe_undeclared_parameters && !(list_length(values_list) > 1)) { foreach(lc, values_list) { @@ -1209,6 +1223,9 @@ sp_describe_undeclared_parameters_internal(PG_FUNCTION_ARGS) int numvalues = 0; int numtotalvalues = list_length(sublist); + if (!is_supported_case_sp_describe_undeclared_parameters) + break; + undeclaredparams->paramnames = (char **) palloc(sizeof(char *) * numtotalvalues); undeclaredparams->paramindexes = (int *) palloc(sizeof(int) * numtotalvalues); if (list_length(sublist) != num_target_attnums) @@ -1249,8 +1266,13 @@ sp_describe_undeclared_parameters_internal(PG_FUNCTION_ARGS) default: break; } - fields = columnref->fields; - if (!(nodeTag(columnref) != T_ColumnRef && nodeTag(parsetree->stmt) != T_DeleteStmt)) + + if (is_supported_case_sp_describe_undeclared_parameters) + fields = columnref->fields; + + if (is_supported_case_sp_describe_undeclared_parameters && + !(nodeTag(columnref) != T_ColumnRef && + nodeTag(parsetree->stmt) != T_DeleteStmt)) { foreach(fieldcell, fields) { @@ -3529,8 +3551,6 @@ sp_babelfish_volatility(PG_FUNCTION_ARGS) PG_RETURN_VOID(); } -extern bool pltsql_quoted_identifier; - Datum sp_renamedb_internal(PG_FUNCTION_ARGS) { @@ -3694,16 +3714,6 @@ sp_rename_internal(PG_FUNCTION_ARGS) curr_relname[--len] = 0; } - /* remove delimited identifiers if quoted_identifier is on */ - if (pltsql_quoted_identifier) - { - remove_delimited_identifer(obj_name); - remove_delimited_identifer(schema_name); - if (curr_relname != NULL) { - remove_delimited_identifer(curr_relname); - } - } - /* check if inputs are empty after removing trailing spaces */ if (obj_name == NULL) ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), @@ -3936,6 +3946,7 @@ rename_extended_property(ObjectType objtype, const char *var_schema_name, } } +extern const char *ATTOPTION_BBF_ORIGINAL_TABLE_NAME; extern const char *ATTOPTION_BBF_ORIGINAL_NAME; static List * @@ -3952,6 +3963,7 @@ gen_sp_rename_subcmds(const char *objname, const char *newname, const char *sche { case OBJECT_TABLE: appendStringInfo(&query, "ALTER TABLE dummy RENAME TO dummy; "); + appendStringInfo(&query, "ALTER TABLE dummy SET (dummy = 'dummy'); "); break; case OBJECT_VIEW: appendStringInfo(&query, "ALTER VIEW dummy RENAME TO dummy; "); @@ -3990,7 +4002,10 @@ gen_sp_rename_subcmds(const char *objname, const char *newname, const char *sche res = raw_parser(query.data, RAW_PARSE_DEFAULT); sql_dialect = old_dialect; - if ((objtype != OBJECT_COLUMN) && (objtype != OBJECT_TRIGGER) && (list_length(res) != 1)) + if ((objtype != OBJECT_TABLE) && + (objtype != OBJECT_COLUMN) && + (objtype != OBJECT_TRIGGER) && + (list_length(res) != 1)) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("Expected 1 statement but get %d statements after parsing", list_length(res)))); @@ -4008,6 +4023,29 @@ gen_sp_rename_subcmds(const char *objname, const char *newname, const char *sche renamestmt->newname = pstrdup(lowerstr(newname)); renamestmt->relation->schemaname = pstrdup(lowerstr(schemaname)); renamestmt->relation->relname = pstrdup(lowerstr(objname)); + + if (objtype == OBJECT_TABLE) + { + AlterTableStmt *altertablestmt; + AlterTableCmd *cmd; + ListCell *lc = NULL; + + rewrite_object_refs(stmt); + /* extra query nodes for modifying reloption */ + stmt = parsetree_nth_stmt(res, 1); + altertablestmt = (AlterTableStmt *) stmt; + if (!IsA(altertablestmt, AlterTableStmt)) + ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("query is not a AlterTableStmt"))); + + altertablestmt->relation->schemaname = pstrdup(lowerstr(schemaname)); + altertablestmt->relation->relname = pstrdup(lowerstr(newname)); + altertablestmt->objtype = OBJECT_TABLE; + /* get data of the first node */ + lc = list_head(altertablestmt->cmds); + cmd = (AlterTableCmd *) lfirst(lc); + cmd->subtype = AT_SetRelOptions; + cmd->def = (Node *) list_make1(makeDefElem(pstrdup(ATTOPTION_BBF_ORIGINAL_TABLE_NAME), (Node *) makeString(pstrdup(newname)), -1)); + } } else if ((objtype == OBJECT_PROCEDURE) || (objtype == OBJECT_FUNCTION)) { @@ -4084,23 +4122,6 @@ gen_sp_rename_subcmds(const char *objname, const char *newname, const char *sche return res; } -static void -remove_delimited_identifer(char *str) -{ - size_t len = strlen(str); - if ((str[0] == '"' && str[len - 1] == '"') || (str[0] == '[' && str[len - 1] == ']')) - { - memmove(str, &str[1], len - 1); - str[len - 2] = '\0'; - } - if (isspace(str[0])) - ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), - errmsg("Either the parameter @objname is ambiguous or the claimed @objtype (COLUMN) is wrong."))); - len = strlen(str); - while (isspace(str[len - 1])) - str[--len] = 0; -} - Datum sp_enum_oledb_providers_internal(PG_FUNCTION_ARGS) { diff --git a/contrib/babelfishpg_tsql/src/schemacmds.c b/contrib/babelfishpg_tsql/src/schemacmds.c index acb4d023400..70d157ce1b6 100644 --- a/contrib/babelfishpg_tsql/src/schemacmds.c +++ b/contrib/babelfishpg_tsql/src/schemacmds.c @@ -19,6 +19,7 @@ #include "hooks.h" #include "schemacmds.h" #include "session.h" +#include "pltsql.h" static bool has_ext_info(const char *schemaname); @@ -38,7 +39,7 @@ add_ns_ext_info(CreateSchemaStmt *stmt, const char *queryString, const char *ori if (!orig_name) { if (stmt->location != -1 && queryString) - orig_name = extract_identifier(queryString + stmt->location); + orig_name = extract_identifier(queryString + stmt->location, NULL); else orig_name = ""; } diff --git a/contrib/babelfishpg_tsql/src/session.c b/contrib/babelfishpg_tsql/src/session.c index 3e91b8e5a8d..e235ded59f8 100644 --- a/contrib/babelfishpg_tsql/src/session.c +++ b/contrib/babelfishpg_tsql/src/session.c @@ -187,7 +187,7 @@ set_search_path_for_user_schema(const char *db_name, const char *user) physical_schema = get_physical_schema_name(pstrdup(db_name), schema); } - path = psprintf(buffer, physical_schema); + path = psprintf(buffer, quote_identifier(physical_schema)); SetConfigOption("search_path", path, PGC_SUSET, diff --git a/contrib/babelfishpg_tsql/src/stmt_walker.c b/contrib/babelfishpg_tsql/src/stmt_walker.c index cbb1de605b4..fed5228e983 100644 --- a/contrib/babelfishpg_tsql/src/stmt_walker.c +++ b/contrib/babelfishpg_tsql/src/stmt_walker.c @@ -112,6 +112,8 @@ stmt_walker(PLtsql_stmt *stmt, WalkerFunc walker, void *context) case PLTSQL_STMT_DBCC: case PLTSQL_STMT_ALTER_DB: case PLTSQL_STMT_GRANTSCHEMA: + case PLTSQL_STMT_PARTITION_FUNCTION: + case PLTSQL_STMT_PARTITION_SCHEME: break; /* TSQL-only executable node */ case PLTSQL_STMT_SAVE_CTX: @@ -215,6 +217,8 @@ general_walker_func(PLtsql_stmt *stmt, void *context) DISPATCH(ALTER_DB, alter_db) DISPATCH(FULLTEXTINDEX, fulltextindex) DISPATCH(GRANTSCHEMA, grantschema) + DISPATCH(PARTITION_FUNCTION, partition_function) + DISPATCH(PARTITION_SCHEME, partition_scheme) /* TSQL-only executable node */ DISPATCH(SAVE_CTX, save_ctx) diff --git a/contrib/babelfishpg_tsql/src/stmt_walker.h b/contrib/babelfishpg_tsql/src/stmt_walker.h index b1cc14d6722..b15570374d5 100644 --- a/contrib/babelfishpg_tsql/src/stmt_walker.h +++ b/contrib/babelfishpg_tsql/src/stmt_walker.h @@ -92,6 +92,8 @@ typedef bool (*Stmt_alter_db_act) ACTION_SIGNITURE(alter_db); typedef bool (*Stmt_dbcc_act) ACTION_SIGNITURE(dbcc); typedef bool (*Stmt_fulltextindex_act) ACTION_SIGNITURE(fulltextindex); typedef bool (*Stmt_grantschema_act) ACTION_SIGNITURE(grantschema); +typedef bool (*Stmt_partition_function_act) ACTION_SIGNITURE(partition_function); +typedef bool (*Stmt_partition_scheme_act) ACTION_SIGNITURE(partition_scheme); /* TSQL-only executable node */ typedef bool (*Stmt_save_ctx) ACTION_SIGNITURE(save_ctx); @@ -147,6 +149,8 @@ typedef struct Walker_context Stmt_dbcc_act dbcc_act; Stmt_fulltextindex_act fulltextindex_act; Stmt_grantschema_act grantschema_act; + Stmt_partition_function_act partition_function_act; + Stmt_partition_scheme_act partition_scheme_act; /* TSQL-only executable node */ Stmt_save_ctx save_ctx_act; diff --git a/contrib/babelfishpg_tsql/src/string.c b/contrib/babelfishpg_tsql/src/string.c index eeee45274eb..49baaf96619 100644 --- a/contrib/babelfishpg_tsql/src/string.c +++ b/contrib/babelfishpg_tsql/src/string.c @@ -30,6 +30,7 @@ PG_FUNCTION_INFO_V1(quotename); PG_FUNCTION_INFO_V1(string_escape); PG_FUNCTION_INFO_V1(formatmessage); PG_FUNCTION_INFO_V1(tsql_varchar_substr); +PG_FUNCTION_INFO_V1(tsql_varbinary_substr); PG_FUNCTION_INFO_V1(float_str); /* @@ -497,14 +498,23 @@ prepare_format_string(StringInfo buf, char *msg_string, int nargs, Datum tsql_varchar_substr(PG_FUNCTION_ARGS) { - if (PG_ARGISNULL(0) || PG_ARGISNULL(1) || PG_ARGISNULL(2)) - PG_RETURN_NULL(); - return DirectFunctionCall3(text_substr, PG_GETARG_DATUM(0), PG_GETARG_INT32(1), PG_GETARG_INT32(2)); } +/* + * tsql_varbinary_substr() + * Return a substring starting at the specified position. + */ +Datum +tsql_varbinary_substr(PG_FUNCTION_ARGS) +{ + return DirectFunctionCall3(bytea_substr, PG_GETARG_DATUM(0), + PG_GETARG_INT32(1), + PG_GETARG_INT32(2)); +} + /* * Returns character data converted from numeric data. The character data * is right-justified, with a specified length and decimal precision. diff --git a/contrib/babelfishpg_tsql/src/tsqlIface.cpp b/contrib/babelfishpg_tsql/src/tsqlIface.cpp index 68572573fb6..c34b4ac083c 100644 --- a/contrib/babelfishpg_tsql/src/tsqlIface.cpp +++ b/contrib/babelfishpg_tsql/src/tsqlIface.cpp @@ -91,6 +91,8 @@ extern "C" /* To store the time spent in ANTLR parsing for the current batch */ extern instr_time antlr_parse_time; + + extern bool is_classic_catalog(const char *name); } static void toDotRecursive(ParseTree *t, const std::vector &ruleNames, const std::string &sourceText); @@ -121,6 +123,10 @@ PLtsql_stmt *makeSetExplainModeStatement(TSqlParser::Set_statementContext *ctx, PLtsql_expr *makeTsqlExpr(const std::string &fragment, bool addSelect); PLtsql_expr *makeTsqlExpr(ParserRuleContext *ctx, bool addSelect); PLtsql_stmt *makeCreateFulltextIndexStmt(TSqlParser::Create_fulltext_indexContext *ctx); +PLtsql_stmt *makeCreatePartitionFunction(TSqlParser::Create_partition_functionContext *ctx); +PLtsql_stmt *makeDropPartitionFunction(TSqlParser::Drop_partition_functionContext *ctx); +PLtsql_stmt *makeCreatePartitionScheme(TSqlParser::Create_partition_schemeContext *ctx); +PLtsql_stmt *makeDropPartitionScheme(TSqlParser::Drop_partition_schemeContext *ctx); PLtsql_stmt *makeDropFulltextIndexStmt(TSqlParser::Drop_fulltext_indexContext *ctx); std::tuple getDatabaseSchemaAndTableName(TSqlParser::Table_nameContext* tctx); void * makeBlockStmt(ParserRuleContext *ctx, tsqlBuilder &builder); @@ -174,7 +180,7 @@ static bool is_compiling_create_function(); static void process_query_specification(TSqlParser::Query_specificationContext *qctx, PLtsql_expr_query_mutator *mutator); static void process_select_statement(TSqlParser::Select_statementContext *selectCtx, PLtsql_expr_query_mutator *mutator); static void process_select_statement_standalone(TSqlParser::Select_statement_standaloneContext *standaloneCtx, PLtsql_expr_query_mutator *mutator, tsqlBuilder &builder); -template static std::string rewrite_object_name_with_omitted_db_and_schema_name(T ctx, GetCtxFunc getDatabase, GetCtxFunc getSchema); +template static std::string rewrite_object_name_with_omitted_db_and_schema_name(T ctx, GetCtxFunc getDatabase, GetCtxFunc getSchema, GetCtxFunc getObject); template static std::string rewrite_information_schema_to_information_schema_tsql(T ctx, GetCtxFunc getSchema); template static std::string rewrite_column_name_with_omitted_schema_name(T ctx, GetCtxFunc getSchema, GetCtxFunc getTableName); template static void rewrite_geospatial_query_helper(T ctx, TSqlParser::Method_callContext *method, size_t geospatial_start_index); @@ -207,6 +213,9 @@ static void handleBitOperators(TSqlParser::Plus_minus_bit_exprContext *ctx); static void handleModuloOperator(TSqlParser::Mult_div_percent_exprContext *ctx); static void handleAtAtVarInPredicate(TSqlParser::PredicateContext *ctx); static void handleOrderByOffsetFetch(TSqlParser::Order_by_clauseContext *ctx); +static void rewrite_string_agg_query(TSqlParser::STRING_AGGContext *ctx); +static bool setSysSchema = false; +static void rewrite_function_trim_to_sys_trim(TSqlParser::TRIMContext *ctx); /* * Structure / Utility function for general purpose of query string modification @@ -349,6 +358,22 @@ stripQuoteFromId(TSqlParser::IdContext *ctx) return getFullText(ctx); } +std::string +stripQuoteFromId(std::string s) +{ + if (s.front() == '[') + { + Assert(s.back() == ']'); + return s.substr(1,s.length()-2); + } + else if (s.front() == '"') + { + Assert(s.back() == '"'); + return s.substr(1,s.length()-2); + } + return s; +} + static int get_curr_compile_body_lineno_adjustment() { @@ -819,6 +844,8 @@ class tsqlCommonMutator : public TSqlParserBaseListener public: explicit tsqlCommonMutator() = default; bool in_create_or_alter_function = false; + bool in_create_or_alter_procedure = false; + bool in_create_or_alter_trigger = false; void enterCreate_or_alter_function(TSqlParser::Create_or_alter_functionContext *ctx) override { in_create_or_alter_function = true; @@ -828,6 +855,22 @@ class tsqlCommonMutator : public TSqlParserBaseListener in_create_or_alter_function = false; } + void enterCreate_or_alter_procedure(TSqlParser::Create_or_alter_procedureContext *ctx) override { + in_create_or_alter_procedure = true; + } + + void exitCreate_or_alter_procedure(TSqlParser::Create_or_alter_procedureContext *ctx) override { + in_create_or_alter_procedure = false; + } + + void enterCreate_or_alter_trigger(TSqlParser::Create_or_alter_triggerContext *ctx) override { + in_create_or_alter_trigger = true; + } + + void exitCreate_or_alter_trigger(TSqlParser::Create_or_alter_triggerContext *ctx) override { + in_create_or_alter_trigger = false; + } + void enterTransaction_statement(TSqlParser::Transaction_statementContext *ctx) override { if (in_create_or_alter_function && ctx->COMMIT()){ throw PGErrorWrapperException(ERROR, ERRCODE_FEATURE_NOT_SUPPORTED, "Invalid use of a side-effecting operator 'COMMIT TRANSACTION' within a function.", 0, 0); @@ -884,6 +927,30 @@ class tsqlCommonMutator : public TSqlParserBaseListener } } + void enterCreate_partition_function(TSqlParser::Create_partition_functionContext *ctx) override { + if (in_create_or_alter_function){ + throw PGErrorWrapperException(ERROR, ERRCODE_FEATURE_NOT_SUPPORTED, "Invalid use of a side-effecting operator 'CREATE PARTITION FUNCTION' within a function.", 0, 0); + } + } + + void enterDrop_partition_function(TSqlParser::Drop_partition_functionContext *ctx) override { + if (in_create_or_alter_function){ + throw PGErrorWrapperException(ERROR, ERRCODE_FEATURE_NOT_SUPPORTED, "Invalid use of a side-effecting operator 'DROP PARTITION FUNCTION' within a function.", 0, 0); + } + } + + void enterCreate_partition_scheme(TSqlParser::Create_partition_schemeContext *ctx) override { + if (in_create_or_alter_function){ + throw PGErrorWrapperException(ERROR, ERRCODE_FEATURE_NOT_SUPPORTED, "Invalid use of a side-effecting operator 'CREATE PARTITION SCHEME' within a function.", 0, 0); + } + } + + void enterDrop_partition_scheme(TSqlParser::Drop_partition_schemeContext *ctx) override { + if (in_create_or_alter_function){ + throw PGErrorWrapperException(ERROR, ERRCODE_FEATURE_NOT_SUPPORTED, "Invalid use of a side-effecting operator 'DROP PARTITION SCHEME' within a function.", 0, 0); + } + } + /* Column Name */ void exitSimple_column_name(TSqlParser::Simple_column_nameContext *ctx) override { @@ -907,6 +974,62 @@ class tsqlCommonMutator : public TSqlParserBaseListener void exitFunction_call(TSqlParser::Function_callContext *ctx) override { handleGeospatialFunctionsInFunctionCall(ctx); + + if (ctx->func_proc_name_server_database_schema()) + { + auto fpnsds = ctx->func_proc_name_server_database_schema(); + + if (fpnsds->DOT().empty() && fpnsds->id().back()->keyword()) /* built-in functions */ + { + auto id = fpnsds->id().back(); + + if (id->keyword()->NULLIF()) /* NULLIF */ + { + if (ctx->function_arg_list() && !ctx->function_arg_list()->expression().empty()) + { + auto first_arg = ctx->function_arg_list()->expression().front(); + if (dynamic_cast(first_arg) && static_cast(first_arg)->constant()->NULL_P()) + throw PGErrorWrapperException(ERROR, ERRCODE_INVALID_PARAMETER_VALUE, "The first argument to NULLIF cannot be a constant NULL.", getLineAndPos(first_arg)); + } + } + if (id->keyword()->CHECKSUM()) + { + if (ctx->function_arg_list() && !ctx->function_arg_list()->expression().empty()) + { + for (auto arg: ctx->function_arg_list()->expression()) + { + if (dynamic_cast(arg) && static_cast(arg)->constant()->NULL_P()) + throw PGErrorWrapperException(ERROR, ERRCODE_INVALID_PARAMETER_VALUE, "Argument NULL is invalid for CHECKSUM().", getLineAndPos(arg)); + } + } + } + if (id->keyword()->TRIM() || id->keyword()->REPLACE() || id->keyword()->TRANSLATE() || id->keyword()->SUBSTRING()) + { + size_t startPosition = id->keyword()->start->getStartIndex(); + rewritten_query_fragment.emplace(std::make_pair(startPosition, std::make_pair("", "sys."))); + } + } + + if (ctx->func_proc_name_server_database_schema()->procedure) + { + std::string proc_name = stripQuoteFromId(ctx->func_proc_name_server_database_schema()->procedure); + if (pg_strcasecmp(proc_name.c_str(), "identity") == 0) + { + has_identity_function = true; + } + + if (pg_strcasecmp(proc_name.c_str(), "identity_into_bigint") == 0) + { + throw PGErrorWrapperException(ERROR, ERRCODE_FEATURE_NOT_SUPPORTED, + format_errmsg("function %s does not exist", proc_name.c_str()), getLineAndPos(ctx)); + } + } + } + } + + void exitTRIM(TSqlParser::TRIMContext *ctx) override + { + rewrite_function_trim_to_sys_trim(ctx); } /* We are adding handling for CLR_UDT Types in: @@ -963,7 +1086,8 @@ class tsqlCommonMutator : public TSqlParserBaseListener { GetCtxFunc getDatabase = [](TSqlParser::Full_object_nameContext *o) { return o->database; }; GetCtxFunc getSchema = [](TSqlParser::Full_object_nameContext *o) { return o->schema; }; - std::string rewritten_name = rewrite_object_name_with_omitted_db_and_schema_name(ctx, getDatabase, getSchema); + GetCtxFunc getObject = [](TSqlParser::Full_object_nameContext *o) { return o->object_name; }; + std::string rewritten_name = rewrite_object_name_with_omitted_db_and_schema_name(ctx, getDatabase, getSchema, getObject); std::string rewritten_schema_name = rewrite_information_schema_to_information_schema_tsql(ctx, getSchema); if (!rewritten_name.empty()) rewritten_query_fragment.emplace(std::make_pair(ctx->start->getStartIndex(), std::make_pair(::getFullText(ctx), rewritten_name))); @@ -980,7 +1104,8 @@ class tsqlCommonMutator : public TSqlParserBaseListener { GetCtxFunc getDatabase = [](TSqlParser::Table_nameContext *o) { return o->database; }; GetCtxFunc getSchema = [](TSqlParser::Table_nameContext *o) { return o->schema; }; - std::string rewritten_name = rewrite_object_name_with_omitted_db_and_schema_name(ctx, getDatabase, getSchema); + GetCtxFunc getObject = [](TSqlParser::Table_nameContext *o) { return o->table; }; + std::string rewritten_name = rewrite_object_name_with_omitted_db_and_schema_name(ctx, getDatabase, getSchema, getObject); std::string rewritten_schema_name = rewrite_information_schema_to_information_schema_tsql(ctx, getSchema); if (!rewritten_name.empty()) rewritten_query_fragment.emplace(std::make_pair(ctx->start->getStartIndex(), std::make_pair(::getFullText(ctx), rewritten_name))); @@ -1002,7 +1127,8 @@ class tsqlCommonMutator : public TSqlParserBaseListener { GetCtxFunc getDatabase = [](TSqlParser::Simple_nameContext *o) { return nullptr; }; // can't exist GetCtxFunc getSchema = [](TSqlParser::Simple_nameContext *o) { return o->schema; }; - std::string rewritten_name = rewrite_object_name_with_omitted_db_and_schema_name(ctx, getDatabase, getSchema); + GetCtxFunc getObject = [](TSqlParser::Simple_nameContext *o) { return o->name; }; + std::string rewritten_name = rewrite_object_name_with_omitted_db_and_schema_name(ctx, getDatabase, getSchema, getObject); std::string rewritten_schema_name = rewrite_information_schema_to_information_schema_tsql(ctx, getSchema); if (!rewritten_name.empty()) rewritten_query_fragment.emplace(std::make_pair(ctx->start->getStartIndex(), std::make_pair(::getFullText(ctx), rewritten_name))); @@ -1018,8 +1144,9 @@ class tsqlCommonMutator : public TSqlParserBaseListener { GetCtxFunc getDatabase = [](TSqlParser::Func_proc_name_schemaContext *o) { return nullptr; }; // can't exist GetCtxFunc getSchema = [](TSqlParser::Func_proc_name_schemaContext *o) { return o->schema; }; + GetCtxFunc getObject = [](TSqlParser::Func_proc_name_schemaContext *o) { return o->procedure; }; std::string rewritten_schema_name = rewrite_information_schema_to_information_schema_tsql(ctx, getSchema); - std::string rewritten_name = rewrite_object_name_with_omitted_db_and_schema_name(ctx, getDatabase, getSchema); + std::string rewritten_name = rewrite_object_name_with_omitted_db_and_schema_name(ctx, getDatabase, getSchema, getObject); if (!rewritten_name.empty()) rewritten_query_fragment.emplace(std::make_pair(ctx->start->getStartIndex(), std::make_pair(::getFullText(ctx), rewritten_name))); if (pltsql_enable_tsql_information_schema && !rewritten_schema_name.empty()) @@ -1032,7 +1159,8 @@ class tsqlCommonMutator : public TSqlParserBaseListener { GetCtxFunc getDatabase = [](TSqlParser::Func_proc_name_database_schemaContext *o) { return o->database; }; GetCtxFunc getSchema = [](TSqlParser::Func_proc_name_database_schemaContext *o) { return o->schema; }; - std::string rewritten_name = rewrite_object_name_with_omitted_db_and_schema_name(ctx, getDatabase, getSchema); + GetCtxFunc getObject = [](TSqlParser::Func_proc_name_database_schemaContext *o) { return o->procedure; }; + std::string rewritten_name = rewrite_object_name_with_omitted_db_and_schema_name(ctx, getDatabase, getSchema, getObject); std::string rewritten_schema_name = rewrite_information_schema_to_information_schema_tsql(ctx, getSchema); if (!rewritten_name.empty()) rewritten_query_fragment.emplace(std::make_pair(ctx->start->getStartIndex(), std::make_pair(::getFullText(ctx), rewritten_name))); @@ -1056,7 +1184,8 @@ class tsqlCommonMutator : public TSqlParserBaseListener { GetCtxFunc getDatabase = [](TSqlParser::Func_proc_name_server_database_schemaContext *o) { return o->database; }; GetCtxFunc getSchema = [](TSqlParser::Func_proc_name_server_database_schemaContext *o) { return o->schema; }; - std::string rewritten_name = rewrite_object_name_with_omitted_db_and_schema_name(ctx, getDatabase, getSchema); + GetCtxFunc getObject = [](TSqlParser::Func_proc_name_server_database_schemaContext *o) { return o->procedure; }; + std::string rewritten_name = rewrite_object_name_with_omitted_db_and_schema_name(ctx, getDatabase, getSchema, getObject); std::string rewritten_schema_name = rewrite_information_schema_to_information_schema_tsql(ctx, getSchema); if (!rewritten_name.empty()) { @@ -1128,6 +1257,52 @@ class tsqlCommonMutator : public TSqlParserBaseListener rewritten_query_fragment.emplace(std::make_pair(linked_srv->start->getStartIndex(), std::make_pair(linked_srv_name, str))); } } + + void exitSTRING_AGG(TSqlParser::STRING_AGGContext *ctx) override + { + /* + * For User Defined Function/Procedure/Trigger the language of the body of Function/Procedure/Trigger is set as 'pltsql' + * hence we cannot rewrite the STRING_AGG query into PG syntax during creation of this objects, + * hence skipped the rewriting of STRING_AGG query for Function/Procedure/Trigger. + * Also, Function's/Procedure's/Trigger's body gets compiled during its execution so the rewriting of + * STRING_AGG query will happen during execution. + */ + if (!(in_create_or_alter_function || in_create_or_alter_procedure || in_create_or_alter_trigger)) + rewrite_string_agg_query(ctx); + } + + /* + * The $PARTITION function handling is implemented in the + * tsqlCommonMutator to support its usage not only from direct calls + * but also within Views, Procedures, and Functions. + */ + void exitPartition_function_call(TSqlParser::Partition_function_callContext *ctx) override + { + /* + * Re-write db_name.$PARTITION.partition_func_name(exp) + * to sys.search_partition(partition_func_name, exp, db_name) + * where db_name is optional. + */ + + /* Replace "$PARTITION" with "sys.search_partition(partition_func_name, ".*/ + rewritten_query_fragment.emplace(std::make_pair(ctx->DOLLAR_PARTITION()->getSymbol()->getStartIndex(), + std::make_pair(::getFullText(ctx->DOLLAR_PARTITION()), "sys.search_partition('" + stripQuoteFromId(ctx->func_name) + "', "))); + + /* Remove dot after the $PARTITION, partition function name and "(" from query. */ + rewritten_query_fragment.emplace(std::make_pair(ctx->DOT().back()->getSymbol()->getStartIndex(), std::make_pair(::getFullText(ctx->DOT().back()), ""))); + rewritten_query_fragment.emplace(std::make_pair(ctx->id().back()->start->getStartIndex(), std::make_pair(::getFullText(ctx->id().back()), ""))); + rewritten_query_fragment.emplace(std::make_pair(ctx->LR_BRACKET()->getSymbol()->getStartIndex(), std::make_pair(::getFullText(ctx->LR_BRACKET()),""))); + + /* Re-write db_name only if exits in the query. */ + if (ctx->db_name) + { + /* Replace the ")" with the ", db_name) ". */ + rewritten_query_fragment.emplace(std::make_pair(ctx->RR_BRACKET()->getSymbol()->getStartIndex(), std::make_pair(::getFullText(ctx->RR_BRACKET()), ", '" + stripQuoteFromId(ctx->db_name) + "')"))); + /* Remove db_name and dot after that from query. */ + rewritten_query_fragment.emplace(std::make_pair(ctx->id().front()->start->getStartIndex(), std::make_pair(::getFullText(ctx->id().front()), ""))); + rewritten_query_fragment.emplace(std::make_pair(ctx->DOT().front()->getSymbol()->getStartIndex(), std::make_pair(::getFullText(ctx->DOT().front()), ""))); + } + } }; //////////////////////////////////////////////////////////////////////////////// @@ -1734,6 +1909,22 @@ class tsqlBuilder : public tsqlCommonMutator if (is_schema_specified) stmt->is_schema_specified = true; + if (is_cross_db) + { + if (ctx->select_statement_standalone() && + ctx->select_statement_standalone()->select_statement() && + ctx->select_statement_standalone()->select_statement()->query_expression() && + ctx->select_statement_standalone()->select_statement()->query_expression()->query_specification() && + ctx->select_statement_standalone()->select_statement()->query_expression()->query_specification()->INTO() && + ctx->select_statement_standalone()->select_statement()->query_expression()->query_specification()->table_name()) + { + throw PGErrorWrapperException(ERROR, + ERRCODE_FEATURE_NOT_SUPPORTED, + "cross-db 'SELECT INTO' statement is not supported in Babelfish. As a workaround, consider running CREATE TABLE and INSERT-SELECT statements.", + getLineAndPos(ctx->select_statement_standalone())); + } + } + if (is_compiling_create_function()) { /* select without destination should be blocked. We can use already information about desitnation, which is already processed. */ @@ -1755,6 +1946,23 @@ class tsqlBuilder : public tsqlCommonMutator else if (ctx->delete_statement() && ctx->delete_statement()->delete_statement_from()->ddl_object() && !ctx->delete_statement()->delete_statement_from()->ddl_object()->local_id() && (ctx->delete_statement()->table_sources() ? ::getFullText(ctx->delete_statement()->table_sources()).c_str()[0] != '@' : true)) /* delete non-local object, table variables are allowed */ throw PGErrorWrapperException(ERROR, ERRCODE_INVALID_FUNCTION_DEFINITION, "'DELETE' cannot be used within a function", getLineAndPos(ctx->delete_statement()->delete_statement_from()->ddl_object())); + + /* + * Reject if OUTPUT clause is missing INTO (returning to client) or OUTPUT INTO non local object + */ + + if (ctx->insert_statement() && ctx->insert_statement()->output_clause() && (!ctx->insert_statement()->output_clause()->INTO() || !ctx->insert_statement()->output_clause()->LOCAL_ID())) + { + throw PGErrorWrapperException(ERROR, ERRCODE_INVALID_FUNCTION_DEFINITION, "Invalid use of a side-effecting operator 'INSERT' within a function.", getLineAndPos(ctx->insert_statement()->output_clause())); + } + else if (ctx->update_statement() && ctx->update_statement()->output_clause() && (!ctx->update_statement()->output_clause()->INTO() || !ctx->update_statement()->output_clause()->LOCAL_ID())) + { + throw PGErrorWrapperException(ERROR, ERRCODE_INVALID_FUNCTION_DEFINITION, "Invalid use of a side-effecting operator 'UPDATE' within a function.", getLineAndPos(ctx->update_statement()->output_clause())); + } + else if (ctx->delete_statement() && ctx->delete_statement()->output_clause() && (!ctx->delete_statement()->output_clause()->INTO() || !ctx->delete_statement()->output_clause()->LOCAL_ID())) + { + throw PGErrorWrapperException(ERROR, ERRCODE_INVALID_FUNCTION_DEFINITION, "Invalid use of a side-effecting operator 'DELETE' within a function.", getLineAndPos(ctx->delete_statement()->output_clause())); + } } /* we must add previous rewrite at first. */ @@ -1813,6 +2021,22 @@ class tsqlBuilder : public tsqlCommonMutator { stmt = makeDropFulltextIndexStmt(ctx->drop_fulltext_index()); } + else if (ctx->create_partition_function()) + { + stmt = makeCreatePartitionFunction(ctx->create_partition_function()); + } + else if (ctx->drop_partition_function()) + { + stmt = makeDropPartitionFunction(ctx->drop_partition_function()); + } + else if (ctx->create_partition_scheme()) + { + stmt = makeCreatePartitionScheme(ctx->create_partition_scheme()); + } + else if (ctx->drop_partition_scheme()) + { + stmt = makeDropPartitionScheme(ctx->drop_partition_scheme()); + } else { stmt = makeSQL(ctx); @@ -1842,6 +2066,11 @@ class tsqlBuilder : public tsqlCommonMutator clear_rewritten_query_fragment(); return; } + if (ctx->create_partition_function() || ctx->drop_partition_function() + || ctx->create_partition_scheme() || ctx->drop_partition_scheme()) + { + return; + } PLtsql_stmt_execsql *stmt = (PLtsql_stmt_execsql *) getPLtsql_fragment(ctx); Assert(stmt); // record that the stmt is ddl @@ -1940,7 +2169,7 @@ class tsqlBuilder : public tsqlCommonMutator } } } - else if (grant->ON() && grant->permission_object() && grant->permission_object()->object_type() && grant->permission_object()->object_type()->SCHEMA()) + else if (grant->ON() && grant->permission_object() && grant->permission_object()->permission_object_type() && grant->permission_object()->permission_object_type()->SCHEMA()) { if (grant->principals() && grant->permissions()) { @@ -1977,7 +2206,7 @@ class tsqlBuilder : public tsqlCommonMutator } } - else if (revoke->ON() && revoke->permission_object() && revoke->permission_object()->object_type() && revoke->permission_object()->object_type()->SCHEMA()) + else if (revoke->ON() && revoke->permission_object() && revoke->permission_object()->permission_object_type() && revoke->permission_object()->permission_object_type()->SCHEMA()) { if (revoke->principals() && revoke->permissions()) { @@ -2240,6 +2469,11 @@ class tsqlBuilder : public tsqlCommonMutator handleOrderByOffsetFetch(ctx); } + void exitTRIM(TSqlParser::TRIMContext *ctx) override + { + rewrite_function_trim_to_sys_trim(ctx); + } + // NB: the following are copied in tsqlMutator void exitColumn_def_table_constraints(TSqlParser::Column_def_table_constraintsContext *ctx) { @@ -2296,13 +2530,27 @@ class tsqlBuilder : public tsqlCommonMutator } else is_schema_specified = false; + + // The flag setSysSchema is used exclusively in case of rewriting a cross-DB catalog reference + // that uses 'dbo' as schema: this puts 'sys' in tsqlBuilder::schema_name, which ends up + // in (PLtsql_stmt_execsql *stmt)->schema_name; this is required for correct resolution + // of the catalog reference at run time. + setSysSchema = false; tsqlCommonMutator::exitFull_object_name(ctx); - if (ctx && (ctx->DOT().size() <= 2) && ctx->database) + // When server is specified, the query is handed off to openquery_internal() + if (ctx && (!ctx->server)) { - db_name = stripQuoteFromId(ctx->database); + // 3 dots: cover the leading-dot case '.dbname.schema.object' + if (ctx && (ctx->DOT().size() <= 3) && ctx->database) + { + db_name = stripQuoteFromId(ctx->database); - if (!string_matches(db_name.c_str(), get_cur_db_name())) - is_cross_db = true; + if (!string_matches(db_name.c_str(), get_cur_db_name())) + is_cross_db = true; + + if (setSysSchema) + schema_name = "sys"; + } } } @@ -2404,59 +2652,7 @@ class tsqlBuilder : public tsqlCommonMutator rewritten_query_fragment.emplace(std::make_pair(bctx->bif_no_brackets->getStartIndex(), std::make_pair(::getFullText(bctx->SESSION_USER()), "sys.session_user()"))); } - handleGeospatialFunctionsInFunctionCall(ctx); - - /* analyze scalar function call */ - if (ctx->func_proc_name_server_database_schema()) - { - if (ctx->func_proc_name_server_database_schema()->schema) - schema_name = stripQuoteFromId(ctx->func_proc_name_server_database_schema()->schema); - - auto fpnsds = ctx->func_proc_name_server_database_schema(); - - if (fpnsds->DOT().empty() && fpnsds->id().back()->keyword()) /* built-in functions */ - { - auto id = fpnsds->id().back(); - - if (id->keyword()->NULLIF()) /* NULLIF */ - { - if (ctx->function_arg_list() && !ctx->function_arg_list()->expression().empty()) - { - auto first_arg = ctx->function_arg_list()->expression().front(); - if (dynamic_cast(first_arg) && static_cast(first_arg)->constant()->NULL_P()) - throw PGErrorWrapperException(ERROR, ERRCODE_INVALID_PARAMETER_VALUE, "The first argument to NULLIF cannot be a constant NULL.", getLineAndPos(first_arg)); - } - } - - if (id->keyword()->CHECKSUM()) - { - if (ctx->function_arg_list() && !ctx->function_arg_list()->expression().empty()) - { - for (auto arg: ctx->function_arg_list()->expression()) - { - if (dynamic_cast(arg) && static_cast(arg)->constant()->NULL_P()) - throw PGErrorWrapperException(ERROR, ERRCODE_INVALID_PARAMETER_VALUE, "Argument NULL is invalid for CHECKSUM().", getLineAndPos(arg)); - } - } - } - - } - - if (ctx->func_proc_name_server_database_schema()->procedure) - { - std::string proc_name = stripQuoteFromId(ctx->func_proc_name_server_database_schema()->procedure); - if (pg_strcasecmp(proc_name.c_str(), "identity") == 0) - { - has_identity_function = true; - } - - if (pg_strcasecmp(proc_name.c_str(), "identity_into_bigint") == 0) - { - throw PGErrorWrapperException(ERROR, ERRCODE_FEATURE_NOT_SUPPORTED, - format_errmsg("function %s does not exist", proc_name.c_str()), getLineAndPos(ctx)); - } - } - } + tsqlCommonMutator::exitFunction_call(ctx); } ////////////////////////////////////////////////////////////////////////////// @@ -3322,7 +3518,6 @@ antlr_parse_query(const char *sourceText, bool useSLLParsing) { std::unique_ptr mutator = std::make_unique(parser.getRuleNames(), sourceStream); antlr4::tree::ParseTreeWalker firstPass; firstPass.walk(mutator.get(), tree); - // for batch-level statement (i.e. create procedure), we don't need to create actual PLtsql_stmt* by tsqlBuilder. // We can just relay the query string to backend parser via one PLtsql_stmt_execsql. TSqlParser::Tsql_fileContext *tsql_file = dynamic_cast(tree); @@ -3363,6 +3558,7 @@ antlr_parse_query(const char *sourceText, bool useSLLParsing) { result.parseTreeCreated = parseTreeCreated; result.success = true; + return result; } catch (PGErrorWrapperException &e) @@ -4720,6 +4916,9 @@ makeReturnQueryStmt(TSqlParser::Select_statement_standaloneContext *ctx, bool it result->lineno =getLineNo(ctx); auto *expr = makeTsqlExpr(ctx, false); + PLtsql_expr_query_mutator mutator(expr, ctx); + add_rewritten_query_fragment_to_mutator(&mutator); + mutator.run(); result->query = expr; if (itvf) { @@ -5870,7 +6069,7 @@ makeGrantdbStatement(TSqlParser::Security_statementContext *ctx) } } } - else if (grant->ON() && grant->permission_object() && grant->permission_object()->object_type() && grant->permission_object()->object_type()->SCHEMA()) + else if (grant->ON() && grant->permission_object() && grant->permission_object()->permission_object_type() && grant->permission_object()->permission_object_type()->SCHEMA()) { if (grant->principals() && grant->permissions()) { @@ -5965,7 +6164,7 @@ makeGrantdbStatement(TSqlParser::Security_statementContext *ctx) } } - else if (revoke->ON() && revoke->permission_object() && revoke->permission_object()->object_type() && revoke->permission_object()->object_type()->SCHEMA()) + else if (revoke->ON() && revoke->permission_object() && revoke->permission_object()->permission_object_type() && revoke->permission_object()->permission_object_type()->SCHEMA()) { if (revoke->principals() && revoke->permissions()) { @@ -6997,8 +7196,12 @@ post_process_create_table(TSqlParser::Create_tableContext *ctx, PLtsql_stmt_exec if (cctx->ON()) { Assert(cctx->storage_partition_clause()); - removeTokenStringFromQuery(stmt->sqlstmt, cctx->ON(), baseCtx); - removeCtxStringFromQuery(stmt->sqlstmt, cctx->storage_partition_clause(), baseCtx); + /* remove storage_partition_clause only if it's not partitioning clause */ + if (cctx->storage_partition_clause()->id().size() != 2) + { + removeTokenStringFromQuery(stmt->sqlstmt, cctx->ON(), baseCtx); + removeCtxStringFromQuery(stmt->sqlstmt, cctx->storage_partition_clause(), baseCtx); + } } else if (cctx->TEXTIMAGE_ON()) { @@ -7098,6 +7301,81 @@ getDatabaseSchemaAndTableName(TSqlParser::Table_nameContext* tctx) downcase_truncate_identifier(table_name.c_str(), table_name.length(), true)); } +PLtsql_stmt * +makeCreatePartitionFunction(TSqlParser::Create_partition_functionContext *ctx) +{ + PLtsql_stmt_partition_function *stmt = (PLtsql_stmt_partition_function *) palloc(sizeof(PLtsql_stmt_partition_function)); + std::string typeStr = ::getFullText(ctx->data_type()); + PLtsql_type *type = parse_datatype(typeStr.c_str(), 0); + + stmt->function_name = pstrdup(stripQuoteFromId(ctx->id()).c_str()); + stmt->datatype = type; + stmt->lineno = getLineNo(ctx); + stmt->cmd_type = PLTSQL_STMT_PARTITION_FUNCTION; + stmt->is_create = true; + /* TODO: Support LEFT boundary option with partition function */ + stmt->is_right = true; + + List *arg_list = NIL; + if (ctx->expression_list()) + { + for (auto expr : ctx->expression_list()->exp) + { + arg_list = lappend(arg_list, makeTsqlExpr(expr, true)); + } + + } + stmt->args = arg_list; + + attachPLtsql_fragment(ctx, (PLtsql_stmt *) stmt); +return (PLtsql_stmt *) stmt; +} + +PLtsql_stmt * +makeDropPartitionFunction(TSqlParser::Drop_partition_functionContext *ctx) +{ + PLtsql_stmt_partition_function *stmt = (PLtsql_stmt_partition_function *) palloc(sizeof(PLtsql_stmt_partition_function)); + stmt->function_name = pstrdup(stripQuoteFromId(ctx->id()).c_str()); + stmt->lineno = getLineNo(ctx); + stmt->cmd_type = PLTSQL_STMT_PARTITION_FUNCTION; + stmt->is_create = false; + + attachPLtsql_fragment(ctx, (PLtsql_stmt *) stmt); + return (PLtsql_stmt *) stmt; +} + +PLtsql_stmt * +makeCreatePartitionScheme(TSqlParser::Create_partition_schemeContext *ctx) +{ + PLtsql_stmt_partition_scheme *stmt = (PLtsql_stmt_partition_scheme *) palloc(sizeof(PLtsql_stmt_partition_scheme)); + stmt->scheme_name = pstrdup(stripQuoteFromId(ctx->id()[0]).c_str()); + stmt->function_name = pstrdup(stripQuoteFromId(ctx->id()[1]).c_str()); + stmt->is_create = true; + stmt->lineno = getLineNo(ctx); + stmt->cmd_type = PLTSQL_STMT_PARTITION_SCHEME; + + if (ctx->ALL()) + stmt->filegroups = -1; + else + stmt->filegroups = ctx->filegroup_type().size(); + + attachPLtsql_fragment(ctx, (PLtsql_stmt *) stmt); + return (PLtsql_stmt *) stmt; +} + +PLtsql_stmt * +makeDropPartitionScheme(TSqlParser::Drop_partition_schemeContext *ctx) +{ + PLtsql_stmt_partition_scheme *stmt = (PLtsql_stmt_partition_scheme *) palloc(sizeof(PLtsql_stmt_partition_scheme)); + stmt->is_create = false; + stmt->scheme_name = pstrdup(stripQuoteFromId(ctx->id()).c_str()); + stmt->lineno = getLineNo(ctx); + stmt->cmd_type = PLTSQL_STMT_PARTITION_SCHEME; + + attachPLtsql_fragment(ctx, (PLtsql_stmt *) stmt); + return (PLtsql_stmt *) stmt; +} + PLtsql_stmt * makeCreateFulltextIndexStmt(TSqlParser::Create_fulltext_indexContext *ctx) { @@ -7168,12 +7446,6 @@ makeDropFulltextIndexStmt(TSqlParser::Drop_fulltext_indexContext *ctx) static bool post_process_create_index(TSqlParser::Create_indexContext *ctx, PLtsql_stmt_execsql *stmt, TSqlParser::Ddl_statementContext *baseCtx) { - if (ctx->storage_partition_clause()) - { - removeTokenStringFromQuery(stmt->sqlstmt, ctx->ON().back(), baseCtx); /* remove last ON */ - removeCtxStringFromQuery(stmt->sqlstmt, ctx->storage_partition_clause(), baseCtx); - } - if (ctx->clustered() && ctx->clustered()->CLUSTERED()) removeTokenStringFromQuery(stmt->sqlstmt, ctx->clustered()->CLUSTERED(), baseCtx); if (ctx->clustered() && ctx->clustered()->NONCLUSTERED()) @@ -7919,16 +8191,50 @@ rewrite_information_schema_to_information_schema_tsql(T ctx, GetCtxFunc getSc /* if no rewriting necessary, return empty string */ template std::string -rewrite_object_name_with_omitted_db_and_schema_name(T ctx, GetCtxFunc getDatabase, GetCtxFunc getSchema) +rewrite_object_name_with_omitted_db_and_schema_name(T ctx, GetCtxFunc getDatabase, GetCtxFunc getSchema, GetCtxFunc getObject) { + auto schema = getSchema(ctx); + std::string objName = ""; + bool schema_is_dbo_or_sys = false; + bool catalog_need_sys_schema = false; + bool must_rewrite = false; // Handles case of .dbname..sometable for a non-catalog table + + if (getObject != nullptr) + { + std::string objNameStripped = ""; + std::string schemaNameStripped = ""; + size_t schemaNameLen; + objName = ::getFullText(getObject(ctx)); + objNameStripped = stripQuoteFromId(objName); + schemaNameStripped = stripQuoteFromId(::getFullText(schema)); + schemaNameLen = schemaNameStripped.length(); + schema_is_dbo_or_sys = ((schemaNameLen == 3) && (pg_strncasecmp(schemaNameStripped.c_str(), "dbo", schemaNameLen) == 0)) || + ((schemaNameLen == 3) && (pg_strncasecmp(schemaNameStripped.c_str(), "sys", schemaNameLen) == 0)) || + (!schema); + bool classic_catalog = is_classic_catalog(objNameStripped.c_str()); + + // Only need to rewrite with 'sys' schema when it's a classic-style catalog AND is currently + // using 'dbo' schema. + // Some cases with 'sys' schema also need to be rewritten (eg. '.master.sys.syslogins') + catalog_need_sys_schema = classic_catalog && schema_is_dbo_or_sys; + + // Pass the flag to set the 'sys' schema in the final PLtsql_stmt_execsql struct + if (catalog_need_sys_schema) + setSysSchema = true; + } + if (ctx->DOT().size() == 1) { - auto schema = getSchema(ctx); + // dbo.object -> sys.object for classic catalogs + // .object -> sys.object for classic catalogs + if (catalog_need_sys_schema) + return "sys." + objName; - // .object -> dbo.object - if (!schema) - return "dbo" + ::getFullText(ctx); + // .object -> object : executing user's default schema will be applied at run time + else if (!schema) + return objName; else + // no rewrite needed return ""; } if (ctx->DOT().size() >= 2) @@ -7936,31 +8242,51 @@ rewrite_object_name_with_omitted_db_and_schema_name(T ctx, GetCtxFunc getData std::string name = ::getFullText(ctx); if (ctx->DOT().size() == 3) { - // we can assume servername is null because unsupported-feature error should be thrown - // so we can remove the first leading dot. the remaining name should be handled with the same with two dots case + // We can assume servername is null (because tsqlCommonMutator::exitFull_object_name handles that case) + // so we can remove the first leading dot. The remaining name should be handled the same way as with two dots. name = name.substr(1); + must_rewrite = true; // Make sure to rewrite because we stripped off the initial dot } auto database = getDatabase(ctx); - auto schema = getSchema(ctx); // ..object -> object if (!database && !schema) + // ..object -> object : executing user's default schema will be applied at run time return name.substr(2); - // db..object -> db.dbo.object + + // db..object -> db.dbo.object --> though this should really use the defualt schema instead of dbo + // db..object -> db.sys.object for classic catalogs else if (database && !schema) { - size_t first_dot_index = name.find('.'); - Assert(first_dot_index != std::string::npos); - Assert(name[first_dot_index+1] == '.'); /* next character should be also '.' */ - return name.substr(0,first_dot_index + 1) + "dbo" + name.substr(first_dot_index + 1); + // To be fixed: for non-catalogs, this needs to use the executing user's default schema, which may not be 'dbo' (can be determined only at execution time) + return ::getFullText(database) + "." + (catalog_need_sys_schema ? "sys" : "dbo") + "." + objName; } + // .schema.object -> schema.object else if (!database && schema) - return name.substr(1); + { + // .dbo.object -> sys.object for classic catalogs + if (catalog_need_sys_schema) + return "sys." + objName; + else + // remove the leading dot + return name.substr(1); + } + + // database.dbo.object -> database.sys.object for classic catalogs + else if (database && catalog_need_sys_schema) + { + return ::getFullText(database) + ".sys." + objName; + } + else if (must_rewrite) + return name; else + // no rewrite needed return ""; } + + // no rewrite needed return ""; } @@ -7994,6 +8320,42 @@ rewrite_column_name_with_omitted_schema_name(T ctx, GetCtxFunc getSchema, Get return ""; } +/* + * In this function we Rewrite the Query for STRING_AGG function as follows + * Query: STRING_AGG '(' expr=expression ',' separator=expression ')' WITHIN GROUP '(' order_by_clause ')' + * will be rewritten to + * Query: STRING_AGG '(' expr=expression ',' separator=expression order_by_clause ')' + */ +static void +rewrite_string_agg_query(TSqlParser::STRING_AGGContext *ctx) +{ + if (ctx->WITHIN() && ctx->order_by_clause()) + { + rewritten_query_fragment.emplace(std::make_pair(ctx->RR_BRACKET()[0]->getSymbol()->getStartIndex(), std::make_pair(::getFullText(ctx->RR_BRACKET()[0]), std::string(" ") + ::getFullText(ctx->order_by_clause()) + ::getFullText(ctx->RR_BRACKET()[0])))); + + /* remove block (WITHIN GROUP LR_BRACKET order_by_clause RR_BRACKET) */ + rewritten_query_fragment.emplace(std::make_pair(ctx->WITHIN()->getSymbol()->getStartIndex(), std::make_pair(::getFullText(ctx->WITHIN()), ""))); + rewritten_query_fragment.emplace(std::make_pair(ctx->GROUP()->getSymbol()->getStartIndex(), std::make_pair(::getFullText(ctx->GROUP()), ""))); + rewritten_query_fragment.emplace(std::make_pair(ctx->LR_BRACKET()[1]->getSymbol()->getStartIndex(), std::make_pair(::getFullText(ctx->LR_BRACKET()[1]), ""))); + rewritten_query_fragment.emplace(std::make_pair(ctx->order_by_clause()->start->getStartIndex(), std::make_pair(::getFullText(ctx->order_by_clause()), ""))); + rewritten_query_fragment.emplace(std::make_pair(ctx->RR_BRACKET()[1]->getSymbol()->getStartIndex(), std::make_pair(::getFullText(ctx->RR_BRACKET()[1]), ""))); + } +} + +/* + * In this function we Rewrite the Query for Trim function as follows + * TRIM '(' expression from expression ')' -> sys.TRIM '(' expression , expression ')' + */ +static void +rewrite_function_trim_to_sys_trim(TSqlParser::TRIMContext *ctx) +{ + if (ctx->trim_from()) + { + rewritten_query_fragment.emplace(std::make_pair(ctx->trim_from()->start->getStartIndex(), std::make_pair(::getFullText(ctx->trim_from()), " , "))); + } + rewritten_query_fragment.emplace(std::make_pair(ctx->TRIM()->getSymbol()->getStartIndex(), std::make_pair(::getFullText(ctx->TRIM()), "sys.trim"))); +} + /////////////////////////////////////////////////////////////////////////////// // Spatial Query Helper //////////////////////////////////////////////////////////////////////////////// diff --git a/contrib/babelfishpg_tsql/src/tsqlNodes.h b/contrib/babelfishpg_tsql/src/tsqlNodes.h index a63cb626d0c..e898732d75f 100644 --- a/contrib/babelfishpg_tsql/src/tsqlNodes.h +++ b/contrib/babelfishpg_tsql/src/tsqlNodes.h @@ -2,109 +2,6 @@ #include "executor/spi.h" #include "pltsql.h" -#if 0 -typedef enum pltsql_stmt_type -{ - PLTSQL_STMT_BLOCK, - PLTSQL_STMT_ASSIGN, - PLTSQL_STMT_IF, - PLTSQL_STMT_CASE, - PLTSQL_STMT_LOOP, - PLTSQL_STMT_WHILE, - PLTSQL_STMT_FORI, - PLTSQL_STMT_FORS, - PLTSQL_STMT_FORC, - PLTSQL_STMT_FOREACH_A, - PLTSQL_STMT_EXIT, - PLTSQL_STMT_RETURN, - PLTSQL_STMT_RETURN_NEXT, - PLTSQL_STMT_RETURN_QUERY, - PLTSQL_STMT_RAISE, - PLTSQL_STMT_ASSERT, - PLTSQL_STMT_EXECSQL, - PLTSQL_STMT_DYNEXECUTE, - PLTSQL_STMT_DYNFORS, - PLTSQL_STMT_GETDIAG, - PLTSQL_STMT_OPEN, - PLTSQL_STMT_FETCH, - PLTSQL_STMT_CLOSE, - PLTSQL_STMT_PERFORM, - PLTSQL_STMT_CALL, - PLTSQL_STMT_COMMIT, - PLTSQL_STMT_ROLLBACK, - PLTSQL_STMT_SET, - /* TSQL-only statement types follow */ - PLTSQL_STMT_GOTO, - PLTSQL_STMT_PRINT, - PLTSQL_STMT_INIT, - PLTSQL_STMT_SELECT_SET, - PLTSQL_STMT_TRY_CATCH, - PLTSQL_STMT_PUSH_RESULT, - PLTSQL_STMT_EXEC, - PLTSQL_STMT_DECL_TABLE, - PLTSQL_STMT_RETURN_TABLE, - PLTSQL_STMT_EXEC_BATCH, - PLTSQL_STMT_EXEC_SPEXECUTESQL, - PLTSQL_STMT_ASSIGN_CURVAR, - PLTSQL_STMT_DEALLOCATE, - PLTSQL_STMT_INSERT_BULK, - PLTSQL_STMT_GRANTDB, - PLTSQL_STMT_CHANGE_DBOWNER, - PLTSQL_STMT_DBCC, - PLTSQL_STMT_ALTER_DB, - PLTSQL_STMT_FULLTEXTINDEX - PLTSQL_STMT_GRANTSCHEMA -} PLtsql_stmt_type; - -typedef struct PLtsql_expr -{ - char *query; - SPIPlanPtr plan; - Bitmapset *paramnos; /* all dnos referenced by this query */ - int rwparam; /* dno of read/write param, or -1 if none */ - - /* function containing this expr (not set until we first parse query) */ - struct PLpgSQL_function *func; - - /* namespace chain visible to this expr */ - struct PLpgSQL_nsitem *ns; - - /* fields for "simple expression" fast-path execution: */ - Expr *expr_simple_expr; /* NULL means not a simple expr */ - int expr_simple_generation; /* plancache generation we checked */ - Oid expr_simple_type; /* result type Oid, if simple */ - int32 expr_simple_typmod; /* result typmod, if simple */ - - /* - * if expr is simple AND prepared in current transaction, - * expr_simple_state and expr_simple_in_use are valid. Test validity by - * seeing if expr_simple_lxid matches current LXID. (If not, - * expr_simple_state probably points at garbage!) - */ - ExprState *expr_simple_state; /* eval tree for expr_simple_expr */ - bool expr_simple_in_use; /* true if eval tree is active */ - LocalTransactionId expr_simple_lxid; - - /* tsql table variables */ - List *tsql_tablevars; - /* here for itvf? queries with all idents replaced with NULLs */ - char *itvf_query; - /* make sure always set to NULL */ -} PLtsql_expr; - -typedef struct -{ - PLtsql_stmt_type cmd_type; - int lineno; - PLtsql_expr *cond; - List *then_body; - List *elsif_list; - List *else_body; -} PLtsql_stmt_if; - -/* ////////////////////////////////////////////////////////////////////////////// */ -#endif - PLtsql_stmt_print *makePrintStmt(PLtsql_expr *expr); PLtsql_expr *makeTsqlExpr(const char *src); PLtsql_stmt_while *makeWhileStmt(PLtsql_expr *expr); diff --git a/contrib/babelfishpg_tsql/src/tsqlUnsupportedFeatureHandler.cpp b/contrib/babelfishpg_tsql/src/tsqlUnsupportedFeatureHandler.cpp index cbc40739916..f5be400969b 100644 --- a/contrib/babelfishpg_tsql/src/tsqlUnsupportedFeatureHandler.cpp +++ b/contrib/babelfishpg_tsql/src/tsqlUnsupportedFeatureHandler.cpp @@ -192,7 +192,7 @@ class TsqlUnsupportedFeatureHandlerImpl : public TsqlUnsupportedFeatureHandler antlrcpp::Any visitFreetext_function(TSqlParser::Freetext_functionContext *ctx) override { handle(INSTR_UNSUPPORTED_TSQL_FREETEXT, "FREETEXT", getLineAndPos(ctx)); return visitChildren(ctx); } antlrcpp::Any visitFreetext_predicate(TSqlParser::Freetext_predicateContext *ctx) override { handle(INSTR_UNSUPPORTED_TSQL_FREETEXT, "CONTAINS/FREETEXT predicate", &st_escape_hatch_fulltext, getLineAndPos(ctx)); return visitChildren(ctx); } antlrcpp::Any visitOdbc_scalar_function(TSqlParser::Odbc_scalar_functionContext *ctx) override { handle(INSTR_UNSUPPORTED_TSQL_ODBC_SCALAR_FUNCTION, "ODBC scalar functions", getLineAndPos(ctx)); return visitChildren(ctx); } - antlrcpp::Any visitPartition_function_call(TSqlParser::Partition_function_callContext *ctx) override { handle(INSTR_UNSUPPORTED_TSQL_PARTITION_FUNCTION, "partition function", getLineAndPos(ctx)); return visitChildren(ctx); } + antlrcpp::Any visitPartition_function_call(TSqlParser::Partition_function_callContext *ctx) override; antlrcpp::Any visitHierarchyid_coloncolon(TSqlParser::Hierarchyid_coloncolonContext *ctx) override { handle(INSTR_UNSUPPORTED_TSQL_EXPRESSION_HIERARCHID, "hierarchid", getLineAndPos(ctx)); return visitChildren(ctx); } antlrcpp::Any visitOdbc_literal_expr(TSqlParser::Odbc_literal_exprContext *ctx) override { handle(INSTR_UNSUPPORTED_TSQL_EXPRESSION_ODBC_LITERAL, "odbc literal", getLineAndPos(ctx)); return visitChildren(ctx); } @@ -736,7 +736,10 @@ antlrcpp::Any TsqlUnsupportedFeatureHandlerImpl::visitCreate_table(TSqlParser::C for (auto cctx : ctx->create_table_options()) { - if (cctx->ON() || cctx->TEXTIMAGE_ON() || cctx->FILESTREAM_ON()) + if (cctx->TEXTIMAGE_ON() || cctx->FILESTREAM_ON()) + handle_storage_partition(cctx->storage_partition_clause()); + /* handle storage_partition_clause only if it's not partitioning clause */ + if (cctx->ON() && cctx->storage_partition_clause()->id().size() < 2) handle_storage_partition(cctx->storage_partition_clause()); } @@ -808,7 +811,9 @@ antlrcpp::Any TsqlUnsupportedFeatureHandlerImpl::visitAlter_table(TSqlParser::Al antlrcpp::Any TsqlUnsupportedFeatureHandlerImpl::visitCreate_index(TSqlParser::Create_indexContext *ctx) { - handle_storage_partition(ctx->storage_partition_clause()); + /* handle storage_partition_clause only if it's not partitioning clause */ + if (ctx->storage_partition_clause() && ctx->storage_partition_clause()->id().size() < 2) + handle_storage_partition(ctx->storage_partition_clause()); if (ctx->clustered() && ctx->clustered()->CLUSTERED()) handle(INSTR_UNSUPPORTED_TSQL_COLUMN_OPTION_CLUSTERED, ctx->clustered()->CLUSTERED(), &st_escape_hatch_index_clustering); @@ -1080,6 +1085,24 @@ antlrcpp::Any TsqlUnsupportedFeatureHandlerImpl::visitDdl_statement(TSqlParser:: } } } + if (ctx->create_partition_scheme()) + { + auto ps_ctx = ctx->create_partition_scheme(); + if (ps_ctx->ALL() && ps_ctx->filegroup_type().size() > 1) + { + throw PGErrorWrapperException(ERROR, ERRCODE_SYNTAX_ERROR, + "Only a single filegroup can be specified while creating partition scheme using option ALL to specify all the filegroups.", getLineAndPos(ctx)); + } + for (auto filegroup: ps_ctx->filegroup_type()) + { + if(filegroup->id()) + handle(INSTR_UNSUPPORTED_TSQL_FILEGROUP, "user filegroup", &st_escape_hatch_storage_options, getLineAndPos(ctx)); + } + } + if (ctx->create_partition_function() && !(ctx->create_partition_function()->RIGHT())) + { + handle(INSTR_UNSUPPORTED_TSQL_PARTITION_FUNCTION, "PARTIION FUNCTION with LEFT option", getLineAndPos(ctx)); + } /* * We have more than 100 DDLs but support a few of them. @@ -1126,6 +1149,10 @@ antlrcpp::Any TsqlUnsupportedFeatureHandlerImpl::visitDdl_statement(TSqlParser:: || ctx->truncate_table() || ctx->enable_trigger() || ctx->disable_trigger() + || ctx->create_partition_function() + || ctx->drop_partition_function() + || ctx->create_partition_scheme() + || ctx->drop_partition_scheme() ) { // supported DDL or DDL which need special handling @@ -1457,6 +1484,11 @@ antlrcpp::Any TsqlUnsupportedFeatureHandlerImpl::visitTrigger_column_updated(TSq return visitChildren(ctx); } +antlrcpp::Any TsqlUnsupportedFeatureHandlerImpl::visitPartition_function_call(TSqlParser::Partition_function_callContext *ctx) +{ + return visitChildren(ctx); +} + antlrcpp::Any TsqlUnsupportedFeatureHandlerImpl::visitFunc_proc_name_schema(TSqlParser::Func_proc_name_schemaContext *ctx) { if (ctx->DOT().empty()) @@ -1757,7 +1789,7 @@ void TsqlUnsupportedFeatureHandlerImpl::checkSupportedGrantStmt(TSqlParser::Gran if (grant->permission_object()) { auto perm_obj = grant->permission_object(); - auto obj_type = perm_obj->object_type(); + auto obj_type = perm_obj->permission_object_type(); if (obj_type && obj_type->SCHEMA()) { if (grant->ALL()) @@ -1860,7 +1892,7 @@ void TsqlUnsupportedFeatureHandlerImpl::checkSupportedRevokeStmt(TSqlParser::Rev if (revoke->permission_object()) { auto perm_obj = revoke->permission_object(); - auto obj_type = perm_obj->object_type(); + auto obj_type = perm_obj->permission_object_type(); if (obj_type && obj_type->SCHEMA()) { if (revoke->ALL()) diff --git a/contrib/babelfishpg_tsql/src/utils/README b/contrib/babelfishpg_tsql/src/utils/README new file mode 100644 index 00000000000..663f0a74ada --- /dev/null +++ b/contrib/babelfishpg_tsql/src/utils/README @@ -0,0 +1,46 @@ +Generate remove accents mappings +================================ + +Use the below plpgsql script to generate the contents of pltsql_remove_accent_map. +The output from this script should be replaced in utils/removeaccent.map. +The mappings are only used when the version being used by the engine matches to +the one used to generate the mappings. Below script will also expose ICU version +used to generate the mappings. + +-- Setup +CREATE TABLE all_utf8_chars(col1 BYTEA, col2 TEXT); + +-- Insert all possible UNICODE and UTF-8 valid characters into table +DO $$ +DECLARE + cnt INT:= 1; + var TEXT; +BEGIN + WHILE cnt <= 1114112 LOOP + BEGIN + var := chr(cnt); + IF var <> '\' THEN + INSERT INTO all_utf8_chars VALUES (cast(var as bytea), var); + ELSE + INSERT INTO all_utf8_chars VALUES (cast('\\' as bytea), '\'); + END IF; + EXCEPTION + WHEN program_limit_exceeded THEN + END; + cnt := cnt + 1; + END LOOP; +END; +$$; + +-- Generate macros +SELECT CONCAT('#define pltsql_remove_accent_map_icu_major_version ', sys.get_icu_major_version()); +SELECT CONCAT('#define pltsql_remove_accent_map_icu_min_version ', sys.get_icu_minor_version()); + +-- Generate a mapping for every required character +-- ex: /* Æ */ {0xc386, 0x4145} /* AE */ +SELECT REPLACE(FORMAT('/* %s */ {%s, %s}, /* %s */',col2, col1, cast(sys.remove_accents_internal(col2) as bytea), sys.remove_accents_internal(col2)), '\', '0') + FROM all_utf8_chars + WHERE col2 != sys.remove_accents_internal(col2); + +-- Cleanup +DROP TABLE all_utf8_chars; diff --git a/contrib/babelfishpg_tsql/src/utils/removeaccent.map b/contrib/babelfishpg_tsql/src/utils/removeaccent.map new file mode 100644 index 00000000000..2d3ce406493 --- /dev/null +++ b/contrib/babelfishpg_tsql/src/utils/removeaccent.map @@ -0,0 +1,819 @@ +/* TRANSFORMATION_RULE "[[:Latin:][:Nd:]]; Latin-ASCII" */ + +#define pltsql_remove_accent_map_icu_major_version 60 +#define pltsql_remove_accent_map_icu_min_version 2 + +static const remove_accent_map_pair pltsql_remove_accent_map[] = +{ + /* À */ {0xc380, 0x41}, /* A */ + /* Á */ {0xc381, 0x41}, /* A */ + /* Â */ {0xc382, 0x41}, /* A */ + /* Ã */ {0xc383, 0x41}, /* A */ + /* Ä */ {0xc384, 0x41}, /* A */ + /* Å */ {0xc385, 0x41}, /* A */ + /* Æ */ {0xc386, 0x4145}, /* AE */ + /* Ç */ {0xc387, 0x43}, /* C */ + /* È */ {0xc388, 0x45}, /* E */ + /* É */ {0xc389, 0x45}, /* E */ + /* Ê */ {0xc38a, 0x45}, /* E */ + /* Ë */ {0xc38b, 0x45}, /* E */ + /* Ì */ {0xc38c, 0x49}, /* I */ + /* Í */ {0xc38d, 0x49}, /* I */ + /* Î */ {0xc38e, 0x49}, /* I */ + /* Ï */ {0xc38f, 0x49}, /* I */ + /* Ð */ {0xc390, 0x44}, /* D */ + /* Ñ */ {0xc391, 0x4e}, /* N */ + /* Ò */ {0xc392, 0x4f}, /* O */ + /* Ó */ {0xc393, 0x4f}, /* O */ + /* Ô */ {0xc394, 0x4f}, /* O */ + /* Õ */ {0xc395, 0x4f}, /* O */ + /* Ö */ {0xc396, 0x4f}, /* O */ + /* Ø */ {0xc398, 0x4f}, /* O */ + /* Ù */ {0xc399, 0x55}, /* U */ + /* Ú */ {0xc39a, 0x55}, /* U */ + /* Û */ {0xc39b, 0x55}, /* U */ + /* Ü */ {0xc39c, 0x55}, /* U */ + /* Ý */ {0xc39d, 0x59}, /* Y */ + /* Þ */ {0xc39e, 0x5448}, /* TH */ + /* ß */ {0xc39f, 0x7373}, /* ss */ + /* à */ {0xc3a0, 0x61}, /* a */ + /* á */ {0xc3a1, 0x61}, /* a */ + /* â */ {0xc3a2, 0x61}, /* a */ + /* ã */ {0xc3a3, 0x61}, /* a */ + /* ä */ {0xc3a4, 0x61}, /* a */ + /* å */ {0xc3a5, 0x61}, /* a */ + /* æ */ {0xc3a6, 0x6165}, /* ae */ + /* ç */ {0xc3a7, 0x63}, /* c */ + /* è */ {0xc3a8, 0x65}, /* e */ + /* é */ {0xc3a9, 0x65}, /* e */ + /* ê */ {0xc3aa, 0x65}, /* e */ + /* ë */ {0xc3ab, 0x65}, /* e */ + /* ì */ {0xc3ac, 0x69}, /* i */ + /* í */ {0xc3ad, 0x69}, /* i */ + /* î */ {0xc3ae, 0x69}, /* i */ + /* ï */ {0xc3af, 0x69}, /* i */ + /* ð */ {0xc3b0, 0x64}, /* d */ + /* ñ */ {0xc3b1, 0x6e}, /* n */ + /* ò */ {0xc3b2, 0x6f}, /* o */ + /* ó */ {0xc3b3, 0x6f}, /* o */ + /* ô */ {0xc3b4, 0x6f}, /* o */ + /* õ */ {0xc3b5, 0x6f}, /* o */ + /* ö */ {0xc3b6, 0x6f}, /* o */ + /* ø */ {0xc3b8, 0x6f}, /* o */ + /* ù */ {0xc3b9, 0x75}, /* u */ + /* ú */ {0xc3ba, 0x75}, /* u */ + /* û */ {0xc3bb, 0x75}, /* u */ + /* ü */ {0xc3bc, 0x75}, /* u */ + /* ý */ {0xc3bd, 0x79}, /* y */ + /* þ */ {0xc3be, 0x7468}, /* th */ + /* ÿ */ {0xc3bf, 0x79}, /* y */ + /* Ā */ {0xc480, 0x41}, /* A */ + /* ā */ {0xc481, 0x61}, /* a */ + /* Ă */ {0xc482, 0x41}, /* A */ + /* ă */ {0xc483, 0x61}, /* a */ + /* Ą */ {0xc484, 0x41}, /* A */ + /* ą */ {0xc485, 0x61}, /* a */ + /* Ć */ {0xc486, 0x43}, /* C */ + /* ć */ {0xc487, 0x63}, /* c */ + /* Ĉ */ {0xc488, 0x43}, /* C */ + /* ĉ */ {0xc489, 0x63}, /* c */ + /* Ċ */ {0xc48a, 0x43}, /* C */ + /* ċ */ {0xc48b, 0x63}, /* c */ + /* Č */ {0xc48c, 0x43}, /* C */ + /* č */ {0xc48d, 0x63}, /* c */ + /* Ď */ {0xc48e, 0x44}, /* D */ + /* ď */ {0xc48f, 0x64}, /* d */ + /* Đ */ {0xc490, 0x44}, /* D */ + /* đ */ {0xc491, 0x64}, /* d */ + /* Ē */ {0xc492, 0x45}, /* E */ + /* ē */ {0xc493, 0x65}, /* e */ + /* Ĕ */ {0xc494, 0x45}, /* E */ + /* ĕ */ {0xc495, 0x65}, /* e */ + /* Ė */ {0xc496, 0x45}, /* E */ + /* ė */ {0xc497, 0x65}, /* e */ + /* Ę */ {0xc498, 0x45}, /* E */ + /* ę */ {0xc499, 0x65}, /* e */ + /* Ě */ {0xc49a, 0x45}, /* E */ + /* ě */ {0xc49b, 0x65}, /* e */ + /* Ĝ */ {0xc49c, 0x47}, /* G */ + /* ĝ */ {0xc49d, 0x67}, /* g */ + /* Ğ */ {0xc49e, 0x47}, /* G */ + /* ğ */ {0xc49f, 0x67}, /* g */ + /* Ġ */ {0xc4a0, 0x47}, /* G */ + /* ġ */ {0xc4a1, 0x67}, /* g */ + /* Ģ */ {0xc4a2, 0x47}, /* G */ + /* ģ */ {0xc4a3, 0x67}, /* g */ + /* Ĥ */ {0xc4a4, 0x48}, /* H */ + /* ĥ */ {0xc4a5, 0x68}, /* h */ + /* Ħ */ {0xc4a6, 0x48}, /* H */ + /* ħ */ {0xc4a7, 0x68}, /* h */ + /* Ĩ */ {0xc4a8, 0x49}, /* I */ + /* ĩ */ {0xc4a9, 0x69}, /* i */ + /* Ī */ {0xc4aa, 0x49}, /* I */ + /* ī */ {0xc4ab, 0x69}, /* i */ + /* Ĭ */ {0xc4ac, 0x49}, /* I */ + /* ĭ */ {0xc4ad, 0x69}, /* i */ + /* Į */ {0xc4ae, 0x49}, /* I */ + /* į */ {0xc4af, 0x69}, /* i */ + /* İ */ {0xc4b0, 0x49}, /* I */ + /* ı */ {0xc4b1, 0x69}, /* i */ + /* IJ */ {0xc4b2, 0x494a}, /* IJ */ + /* ij */ {0xc4b3, 0x696a}, /* ij */ + /* Ĵ */ {0xc4b4, 0x4a}, /* J */ + /* ĵ */ {0xc4b5, 0x6a}, /* j */ + /* Ķ */ {0xc4b6, 0x4b}, /* K */ + /* ķ */ {0xc4b7, 0x6b}, /* k */ + /* ĸ */ {0xc4b8, 0x71}, /* q */ + /* Ĺ */ {0xc4b9, 0x4c}, /* L */ + /* ĺ */ {0xc4ba, 0x6c}, /* l */ + /* Ļ */ {0xc4bb, 0x4c}, /* L */ + /* ļ */ {0xc4bc, 0x6c}, /* l */ + /* Ľ */ {0xc4bd, 0x4c}, /* L */ + /* ľ */ {0xc4be, 0x6c}, /* l */ + /* Ŀ */ {0xc4bf, 0x4c}, /* L */ + /* ŀ */ {0xc580, 0x6c}, /* l */ + /* Ł */ {0xc581, 0x4c}, /* L */ + /* ł */ {0xc582, 0x6c}, /* l */ + /* Ń */ {0xc583, 0x4e}, /* N */ + /* ń */ {0xc584, 0x6e}, /* n */ + /* Ņ */ {0xc585, 0x4e}, /* N */ + /* ņ */ {0xc586, 0x6e}, /* n */ + /* Ň */ {0xc587, 0x4e}, /* N */ + /* ň */ {0xc588, 0x6e}, /* n */ + /* ʼn */ {0xc589, 0x276e}, /* 'n */ + /* Ŋ */ {0xc58a, 0x4e}, /* N */ + /* ŋ */ {0xc58b, 0x6e}, /* n */ + /* Ō */ {0xc58c, 0x4f}, /* O */ + /* ō */ {0xc58d, 0x6f}, /* o */ + /* Ŏ */ {0xc58e, 0x4f}, /* O */ + /* ŏ */ {0xc58f, 0x6f}, /* o */ + /* Ő */ {0xc590, 0x4f}, /* O */ + /* ő */ {0xc591, 0x6f}, /* o */ + /* Œ */ {0xc592, 0x4f45}, /* OE */ + /* œ */ {0xc593, 0x6f65}, /* oe */ + /* Ŕ */ {0xc594, 0x52}, /* R */ + /* ŕ */ {0xc595, 0x72}, /* r */ + /* Ŗ */ {0xc596, 0x52}, /* R */ + /* ŗ */ {0xc597, 0x72}, /* r */ + /* Ř */ {0xc598, 0x52}, /* R */ + /* ř */ {0xc599, 0x72}, /* r */ + /* Ś */ {0xc59a, 0x53}, /* S */ + /* ś */ {0xc59b, 0x73}, /* s */ + /* Ŝ */ {0xc59c, 0x53}, /* S */ + /* ŝ */ {0xc59d, 0x73}, /* s */ + /* Ş */ {0xc59e, 0x53}, /* S */ + /* ş */ {0xc59f, 0x73}, /* s */ + /* Š */ {0xc5a0, 0x53}, /* S */ + /* š */ {0xc5a1, 0x73}, /* s */ + /* Ţ */ {0xc5a2, 0x54}, /* T */ + /* ţ */ {0xc5a3, 0x74}, /* t */ + /* Ť */ {0xc5a4, 0x54}, /* T */ + /* ť */ {0xc5a5, 0x74}, /* t */ + /* Ŧ */ {0xc5a6, 0x54}, /* T */ + /* ŧ */ {0xc5a7, 0x74}, /* t */ + /* Ũ */ {0xc5a8, 0x55}, /* U */ + /* ũ */ {0xc5a9, 0x75}, /* u */ + /* Ū */ {0xc5aa, 0x55}, /* U */ + /* ū */ {0xc5ab, 0x75}, /* u */ + /* Ŭ */ {0xc5ac, 0x55}, /* U */ + /* ŭ */ {0xc5ad, 0x75}, /* u */ + /* Ů */ {0xc5ae, 0x55}, /* U */ + /* ů */ {0xc5af, 0x75}, /* u */ + /* Ű */ {0xc5b0, 0x55}, /* U */ + /* ű */ {0xc5b1, 0x75}, /* u */ + /* Ų */ {0xc5b2, 0x55}, /* U */ + /* ų */ {0xc5b3, 0x75}, /* u */ + /* Ŵ */ {0xc5b4, 0x57}, /* W */ + /* ŵ */ {0xc5b5, 0x77}, /* w */ + /* Ŷ */ {0xc5b6, 0x59}, /* Y */ + /* ŷ */ {0xc5b7, 0x79}, /* y */ + /* Ÿ */ {0xc5b8, 0x59}, /* Y */ + /* Ź */ {0xc5b9, 0x5a}, /* Z */ + /* ź */ {0xc5ba, 0x7a}, /* z */ + /* Ż */ {0xc5bb, 0x5a}, /* Z */ + /* ż */ {0xc5bc, 0x7a}, /* z */ + /* Ž */ {0xc5bd, 0x5a}, /* Z */ + /* ž */ {0xc5be, 0x7a}, /* z */ + /* ſ */ {0xc5bf, 0x73}, /* s */ + /* ƀ */ {0xc680, 0x62}, /* b */ + /* Ɓ */ {0xc681, 0x42}, /* B */ + /* Ƃ */ {0xc682, 0x42}, /* B */ + /* ƃ */ {0xc683, 0x62}, /* b */ + /* Ƈ */ {0xc687, 0x43}, /* C */ + /* ƈ */ {0xc688, 0x63}, /* c */ + /* Ɖ */ {0xc689, 0x44}, /* D */ + /* Ɗ */ {0xc68a, 0x44}, /* D */ + /* Ƌ */ {0xc68b, 0x44}, /* D */ + /* ƌ */ {0xc68c, 0x64}, /* d */ + /* Ɛ */ {0xc690, 0x45}, /* E */ + /* Ƒ */ {0xc691, 0x46}, /* F */ + /* ƒ */ {0xc692, 0x66}, /* f */ + /* Ɠ */ {0xc693, 0x47}, /* G */ + /* ƕ */ {0xc695, 0x6876}, /* hv */ + /* Ɩ */ {0xc696, 0x49}, /* I */ + /* Ɨ */ {0xc697, 0x49}, /* I */ + /* Ƙ */ {0xc698, 0x4b}, /* K */ + /* ƙ */ {0xc699, 0x6b}, /* k */ + /* ƚ */ {0xc69a, 0x6c}, /* l */ + /* Ɲ */ {0xc69d, 0x4e}, /* N */ + /* ƞ */ {0xc69e, 0x6e}, /* n */ + /* Ơ */ {0xc6a0, 0x4f}, /* O */ + /* ơ */ {0xc6a1, 0x6f}, /* o */ + /* Ƣ */ {0xc6a2, 0x4f49}, /* OI */ + /* ƣ */ {0xc6a3, 0x6f69}, /* oi */ + /* Ƥ */ {0xc6a4, 0x50}, /* P */ + /* ƥ */ {0xc6a5, 0x70}, /* p */ + /* ƫ */ {0xc6ab, 0x74}, /* t */ + /* Ƭ */ {0xc6ac, 0x54}, /* T */ + /* ƭ */ {0xc6ad, 0x74}, /* t */ + /* Ʈ */ {0xc6ae, 0x54}, /* T */ + /* Ư */ {0xc6af, 0x55}, /* U */ + /* ư */ {0xc6b0, 0x75}, /* u */ + /* Ʋ */ {0xc6b2, 0x56}, /* V */ + /* Ƴ */ {0xc6b3, 0x59}, /* Y */ + /* ƴ */ {0xc6b4, 0x79}, /* y */ + /* Ƶ */ {0xc6b5, 0x5a}, /* Z */ + /* ƶ */ {0xc6b6, 0x7a}, /* z */ + /* DŽ */ {0xc784, 0x445a}, /* DZ */ + /* Dž */ {0xc785, 0x447a}, /* Dz */ + /* dž */ {0xc786, 0x647a}, /* dz */ + /* LJ */ {0xc787, 0x4c4a}, /* LJ */ + /* Lj */ {0xc788, 0x4c6a}, /* Lj */ + /* lj */ {0xc789, 0x6c6a}, /* lj */ + /* NJ */ {0xc78a, 0x4e4a}, /* NJ */ + /* Nj */ {0xc78b, 0x4e6a}, /* Nj */ + /* nj */ {0xc78c, 0x6e6a}, /* nj */ + /* Ǎ */ {0xc78d, 0x41}, /* A */ + /* ǎ */ {0xc78e, 0x61}, /* a */ + /* Ǐ */ {0xc78f, 0x49}, /* I */ + /* ǐ */ {0xc790, 0x69}, /* i */ + /* Ǒ */ {0xc791, 0x4f}, /* O */ + /* ǒ */ {0xc792, 0x6f}, /* o */ + /* Ǔ */ {0xc793, 0x55}, /* U */ + /* ǔ */ {0xc794, 0x75}, /* u */ + /* Ǖ */ {0xc795, 0x55}, /* U */ + /* ǖ */ {0xc796, 0x75}, /* u */ + /* Ǘ */ {0xc797, 0x55}, /* U */ + /* ǘ */ {0xc798, 0x75}, /* u */ + /* Ǚ */ {0xc799, 0x55}, /* U */ + /* ǚ */ {0xc79a, 0x75}, /* u */ + /* Ǜ */ {0xc79b, 0x55}, /* U */ + /* ǜ */ {0xc79c, 0x75}, /* u */ + /* Ǟ */ {0xc79e, 0x41}, /* A */ + /* ǟ */ {0xc79f, 0x61}, /* a */ + /* Ǡ */ {0xc7a0, 0x41}, /* A */ + /* ǡ */ {0xc7a1, 0x61}, /* a */ + /* Ǣ */ {0xc7a2, 0x4145}, /* AE */ + /* ǣ */ {0xc7a3, 0x6165}, /* ae */ + /* Ǥ */ {0xc7a4, 0x47}, /* G */ + /* ǥ */ {0xc7a5, 0x67}, /* g */ + /* Ǧ */ {0xc7a6, 0x47}, /* G */ + /* ǧ */ {0xc7a7, 0x67}, /* g */ + /* Ǩ */ {0xc7a8, 0x4b}, /* K */ + /* ǩ */ {0xc7a9, 0x6b}, /* k */ + /* Ǫ */ {0xc7aa, 0x4f}, /* O */ + /* ǫ */ {0xc7ab, 0x6f}, /* o */ + /* Ǭ */ {0xc7ac, 0x4f}, /* O */ + /* ǭ */ {0xc7ad, 0x6f}, /* o */ + /* Ǯ */ {0xc7ae, 0xc6b7}, /* Ʒ */ + /* ǯ */ {0xc7af, 0xca92}, /* ʒ */ + /* ǰ */ {0xc7b0, 0x6a}, /* j */ + /* DZ */ {0xc7b1, 0x445a}, /* DZ */ + /* Dz */ {0xc7b2, 0x447a}, /* Dz */ + /* dz */ {0xc7b3, 0x647a}, /* dz */ + /* Ǵ */ {0xc7b4, 0x47}, /* G */ + /* ǵ */ {0xc7b5, 0x67}, /* g */ + /* Ǹ */ {0xc7b8, 0x4e}, /* N */ + /* ǹ */ {0xc7b9, 0x6e}, /* n */ + /* Ǻ */ {0xc7ba, 0x41}, /* A */ + /* ǻ */ {0xc7bb, 0x61}, /* a */ + /* Ǽ */ {0xc7bc, 0x4145}, /* AE */ + /* ǽ */ {0xc7bd, 0x6165}, /* ae */ + /* Ǿ */ {0xc7be, 0x4f}, /* O */ + /* ǿ */ {0xc7bf, 0x6f}, /* o */ + /* Ȁ */ {0xc880, 0x41}, /* A */ + /* ȁ */ {0xc881, 0x61}, /* a */ + /* Ȃ */ {0xc882, 0x41}, /* A */ + /* ȃ */ {0xc883, 0x61}, /* a */ + /* Ȅ */ {0xc884, 0x45}, /* E */ + /* ȅ */ {0xc885, 0x65}, /* e */ + /* Ȇ */ {0xc886, 0x45}, /* E */ + /* ȇ */ {0xc887, 0x65}, /* e */ + /* Ȉ */ {0xc888, 0x49}, /* I */ + /* ȉ */ {0xc889, 0x69}, /* i */ + /* Ȋ */ {0xc88a, 0x49}, /* I */ + /* ȋ */ {0xc88b, 0x69}, /* i */ + /* Ȍ */ {0xc88c, 0x4f}, /* O */ + /* ȍ */ {0xc88d, 0x6f}, /* o */ + /* Ȏ */ {0xc88e, 0x4f}, /* O */ + /* ȏ */ {0xc88f, 0x6f}, /* o */ + /* Ȑ */ {0xc890, 0x52}, /* R */ + /* ȑ */ {0xc891, 0x72}, /* r */ + /* Ȓ */ {0xc892, 0x52}, /* R */ + /* ȓ */ {0xc893, 0x72}, /* r */ + /* Ȕ */ {0xc894, 0x55}, /* U */ + /* ȕ */ {0xc895, 0x75}, /* u */ + /* Ȗ */ {0xc896, 0x55}, /* U */ + /* ȗ */ {0xc897, 0x75}, /* u */ + /* Ș */ {0xc898, 0x53}, /* S */ + /* ș */ {0xc899, 0x73}, /* s */ + /* Ț */ {0xc89a, 0x54}, /* T */ + /* ț */ {0xc89b, 0x74}, /* t */ + /* Ȟ */ {0xc89e, 0x48}, /* H */ + /* ȟ */ {0xc89f, 0x68}, /* h */ + /* ȡ */ {0xc8a1, 0x64}, /* d */ + /* Ȥ */ {0xc8a4, 0x5a}, /* Z */ + /* ȥ */ {0xc8a5, 0x7a}, /* z */ + /* Ȧ */ {0xc8a6, 0x41}, /* A */ + /* ȧ */ {0xc8a7, 0x61}, /* a */ + /* Ȩ */ {0xc8a8, 0x45}, /* E */ + /* ȩ */ {0xc8a9, 0x65}, /* e */ + /* Ȫ */ {0xc8aa, 0x4f}, /* O */ + /* ȫ */ {0xc8ab, 0x6f}, /* o */ + /* Ȭ */ {0xc8ac, 0x4f}, /* O */ + /* ȭ */ {0xc8ad, 0x6f}, /* o */ + /* Ȯ */ {0xc8ae, 0x4f}, /* O */ + /* ȯ */ {0xc8af, 0x6f}, /* o */ + /* Ȱ */ {0xc8b0, 0x4f}, /* O */ + /* ȱ */ {0xc8b1, 0x6f}, /* o */ + /* Ȳ */ {0xc8b2, 0x59}, /* Y */ + /* ȳ */ {0xc8b3, 0x79}, /* y */ + /* ȴ */ {0xc8b4, 0x6c}, /* l */ + /* ȵ */ {0xc8b5, 0x6e}, /* n */ + /* ȶ */ {0xc8b6, 0x74}, /* t */ + /* ȷ */ {0xc8b7, 0x6a}, /* j */ + /* ȸ */ {0xc8b8, 0x6462}, /* db */ + /* ȹ */ {0xc8b9, 0x7170}, /* qp */ + /* Ⱥ */ {0xc8ba, 0x41}, /* A */ + /* Ȼ */ {0xc8bb, 0x43}, /* C */ + /* ȼ */ {0xc8bc, 0x63}, /* c */ + /* Ƚ */ {0xc8bd, 0x4c}, /* L */ + /* Ⱦ */ {0xc8be, 0x54}, /* T */ + /* ȿ */ {0xc8bf, 0x73}, /* s */ + /* ɀ */ {0xc980, 0x7a}, /* z */ + /* Ƀ */ {0xc983, 0x42}, /* B */ + /* Ʉ */ {0xc984, 0x55}, /* U */ + /* Ɇ */ {0xc986, 0x45}, /* E */ + /* ɇ */ {0xc987, 0x65}, /* e */ + /* Ɉ */ {0xc988, 0x4a}, /* J */ + /* ɉ */ {0xc989, 0x6a}, /* j */ + /* Ɍ */ {0xc98c, 0x52}, /* R */ + /* ɍ */ {0xc98d, 0x72}, /* r */ + /* Ɏ */ {0xc98e, 0x59}, /* Y */ + /* ɏ */ {0xc98f, 0x79}, /* y */ + /* ɓ */ {0xc993, 0x62}, /* b */ + /* ɕ */ {0xc995, 0x63}, /* c */ + /* ɖ */ {0xc996, 0x64}, /* d */ + /* ɗ */ {0xc997, 0x64}, /* d */ + /* ɛ */ {0xc99b, 0x65}, /* e */ + /* ɟ */ {0xc99f, 0x6a}, /* j */ + /* ɠ */ {0xc9a0, 0x67}, /* g */ + /* ɡ */ {0xc9a1, 0x67}, /* g */ + /* ɢ */ {0xc9a2, 0x47}, /* G */ + /* ɦ */ {0xc9a6, 0x68}, /* h */ + /* ɧ */ {0xc9a7, 0x68}, /* h */ + /* ɨ */ {0xc9a8, 0x69}, /* i */ + /* ɪ */ {0xc9aa, 0x49}, /* I */ + /* ɫ */ {0xc9ab, 0x6c}, /* l */ + /* ɬ */ {0xc9ac, 0x6c}, /* l */ + /* ɭ */ {0xc9ad, 0x6c}, /* l */ + /* ɱ */ {0xc9b1, 0x6d}, /* m */ + /* ɲ */ {0xc9b2, 0x6e}, /* n */ + /* ɳ */ {0xc9b3, 0x6e}, /* n */ + /* ɴ */ {0xc9b4, 0x4e}, /* N */ + /* ɶ */ {0xc9b6, 0x4f45}, /* OE */ + /* ɼ */ {0xc9bc, 0x72}, /* r */ + /* ɽ */ {0xc9bd, 0x72}, /* r */ + /* ɾ */ {0xc9be, 0x72}, /* r */ + /* ʀ */ {0xca80, 0x52}, /* R */ + /* ʂ */ {0xca82, 0x73}, /* s */ + /* ʈ */ {0xca88, 0x74}, /* t */ + /* ʉ */ {0xca89, 0x75}, /* u */ + /* ʋ */ {0xca8b, 0x76}, /* v */ + /* ʏ */ {0xca8f, 0x59}, /* Y */ + /* ʐ */ {0xca90, 0x7a}, /* z */ + /* ʑ */ {0xca91, 0x7a}, /* z */ + /* ʙ */ {0xca99, 0x42}, /* B */ + /* ʛ */ {0xca9b, 0x47}, /* G */ + /* ʜ */ {0xca9c, 0x48}, /* H */ + /* ʝ */ {0xca9d, 0x6a}, /* j */ + /* ʟ */ {0xca9f, 0x4c}, /* L */ + /* ʠ */ {0xcaa0, 0x71}, /* q */ + /* ʣ */ {0xcaa3, 0x647a}, /* dz */ + /* ʥ */ {0xcaa5, 0x647a}, /* dz */ + /* ʦ */ {0xcaa6, 0x7473}, /* ts */ + /* ʪ */ {0xcaaa, 0x6c73}, /* ls */ + /* ʫ */ {0xcaab, 0x6c7a}, /* lz */ + /* ᴀ */ {0xe1b480, 0x41}, /* A */ + /* ᴁ */ {0xe1b481, 0x4145}, /* AE */ + /* ᴃ */ {0xe1b483, 0x42}, /* B */ + /* ᴄ */ {0xe1b484, 0x43}, /* C */ + /* ᴅ */ {0xe1b485, 0x44}, /* D */ + /* ᴆ */ {0xe1b486, 0x44}, /* D */ + /* ᴇ */ {0xe1b487, 0x45}, /* E */ + /* ᴊ */ {0xe1b48a, 0x4a}, /* J */ + /* ᴋ */ {0xe1b48b, 0x4b}, /* K */ + /* ᴌ */ {0xe1b48c, 0x4c}, /* L */ + /* ᴍ */ {0xe1b48d, 0x4d}, /* M */ + /* ᴏ */ {0xe1b48f, 0x4f}, /* O */ + /* ᴘ */ {0xe1b498, 0x50}, /* P */ + /* ᴛ */ {0xe1b49b, 0x54}, /* T */ + /* ᴜ */ {0xe1b49c, 0x55}, /* U */ + /* ᴠ */ {0xe1b4a0, 0x56}, /* V */ + /* ᴡ */ {0xe1b4a1, 0x57}, /* W */ + /* ᴢ */ {0xe1b4a2, 0x5a}, /* Z */ + /* ᵫ */ {0xe1b5ab, 0x7565}, /* ue */ + /* ᵬ */ {0xe1b5ac, 0x62}, /* b */ + /* ᵭ */ {0xe1b5ad, 0x64}, /* d */ + /* ᵮ */ {0xe1b5ae, 0x66}, /* f */ + /* ᵯ */ {0xe1b5af, 0x6d}, /* m */ + /* ᵰ */ {0xe1b5b0, 0x6e}, /* n */ + /* ᵱ */ {0xe1b5b1, 0x70}, /* p */ + /* ᵲ */ {0xe1b5b2, 0x72}, /* r */ + /* ᵳ */ {0xe1b5b3, 0x72}, /* r */ + /* ᵴ */ {0xe1b5b4, 0x73}, /* s */ + /* ᵵ */ {0xe1b5b5, 0x74}, /* t */ + /* ᵶ */ {0xe1b5b6, 0x7a}, /* z */ + /* ᵺ */ {0xe1b5ba, 0x7468}, /* th */ + /* ᵻ */ {0xe1b5bb, 0x49}, /* I */ + /* ᵽ */ {0xe1b5bd, 0x70}, /* p */ + /* ᵾ */ {0xe1b5be, 0x55}, /* U */ + /* ᶀ */ {0xe1b680, 0x62}, /* b */ + /* ᶁ */ {0xe1b681, 0x64}, /* d */ + /* ᶂ */ {0xe1b682, 0x66}, /* f */ + /* ᶃ */ {0xe1b683, 0x67}, /* g */ + /* ᶄ */ {0xe1b684, 0x6b}, /* k */ + /* ᶅ */ {0xe1b685, 0x6c}, /* l */ + /* ᶆ */ {0xe1b686, 0x6d}, /* m */ + /* ᶇ */ {0xe1b687, 0x6e}, /* n */ + /* ᶈ */ {0xe1b688, 0x70}, /* p */ + /* ᶉ */ {0xe1b689, 0x72}, /* r */ + /* ᶊ */ {0xe1b68a, 0x73}, /* s */ + /* ᶌ */ {0xe1b68c, 0x76}, /* v */ + /* ᶍ */ {0xe1b68d, 0x78}, /* x */ + /* ᶎ */ {0xe1b68e, 0x7a}, /* z */ + /* ᶏ */ {0xe1b68f, 0x61}, /* a */ + /* ᶑ */ {0xe1b691, 0x64}, /* d */ + /* ᶒ */ {0xe1b692, 0x65}, /* e */ + /* ᶓ */ {0xe1b693, 0x65}, /* e */ + /* ᶖ */ {0xe1b696, 0x69}, /* i */ + /* ᶙ */ {0xe1b699, 0x75}, /* u */ + /* Ḁ */ {0xe1b880, 0x41}, /* A */ + /* ḁ */ {0xe1b881, 0x61}, /* a */ + /* Ḃ */ {0xe1b882, 0x42}, /* B */ + /* ḃ */ {0xe1b883, 0x62}, /* b */ + /* Ḅ */ {0xe1b884, 0x42}, /* B */ + /* ḅ */ {0xe1b885, 0x62}, /* b */ + /* Ḇ */ {0xe1b886, 0x42}, /* B */ + /* ḇ */ {0xe1b887, 0x62}, /* b */ + /* Ḉ */ {0xe1b888, 0x43}, /* C */ + /* ḉ */ {0xe1b889, 0x63}, /* c */ + /* Ḋ */ {0xe1b88a, 0x44}, /* D */ + /* ḋ */ {0xe1b88b, 0x64}, /* d */ + /* Ḍ */ {0xe1b88c, 0x44}, /* D */ + /* ḍ */ {0xe1b88d, 0x64}, /* d */ + /* Ḏ */ {0xe1b88e, 0x44}, /* D */ + /* ḏ */ {0xe1b88f, 0x64}, /* d */ + /* Ḑ */ {0xe1b890, 0x44}, /* D */ + /* ḑ */ {0xe1b891, 0x64}, /* d */ + /* Ḓ */ {0xe1b892, 0x44}, /* D */ + /* ḓ */ {0xe1b893, 0x64}, /* d */ + /* Ḕ */ {0xe1b894, 0x45}, /* E */ + /* ḕ */ {0xe1b895, 0x65}, /* e */ + /* Ḗ */ {0xe1b896, 0x45}, /* E */ + /* ḗ */ {0xe1b897, 0x65}, /* e */ + /* Ḙ */ {0xe1b898, 0x45}, /* E */ + /* ḙ */ {0xe1b899, 0x65}, /* e */ + /* Ḛ */ {0xe1b89a, 0x45}, /* E */ + /* ḛ */ {0xe1b89b, 0x65}, /* e */ + /* Ḝ */ {0xe1b89c, 0x45}, /* E */ + /* ḝ */ {0xe1b89d, 0x65}, /* e */ + /* Ḟ */ {0xe1b89e, 0x46}, /* F */ + /* ḟ */ {0xe1b89f, 0x66}, /* f */ + /* Ḡ */ {0xe1b8a0, 0x47}, /* G */ + /* ḡ */ {0xe1b8a1, 0x67}, /* g */ + /* Ḣ */ {0xe1b8a2, 0x48}, /* H */ + /* ḣ */ {0xe1b8a3, 0x68}, /* h */ + /* Ḥ */ {0xe1b8a4, 0x48}, /* H */ + /* ḥ */ {0xe1b8a5, 0x68}, /* h */ + /* Ḧ */ {0xe1b8a6, 0x48}, /* H */ + /* ḧ */ {0xe1b8a7, 0x68}, /* h */ + /* Ḩ */ {0xe1b8a8, 0x48}, /* H */ + /* ḩ */ {0xe1b8a9, 0x68}, /* h */ + /* Ḫ */ {0xe1b8aa, 0x48}, /* H */ + /* ḫ */ {0xe1b8ab, 0x68}, /* h */ + /* Ḭ */ {0xe1b8ac, 0x49}, /* I */ + /* ḭ */ {0xe1b8ad, 0x69}, /* i */ + /* Ḯ */ {0xe1b8ae, 0x49}, /* I */ + /* ḯ */ {0xe1b8af, 0x69}, /* i */ + /* Ḱ */ {0xe1b8b0, 0x4b}, /* K */ + /* ḱ */ {0xe1b8b1, 0x6b}, /* k */ + /* Ḳ */ {0xe1b8b2, 0x4b}, /* K */ + /* ḳ */ {0xe1b8b3, 0x6b}, /* k */ + /* Ḵ */ {0xe1b8b4, 0x4b}, /* K */ + /* ḵ */ {0xe1b8b5, 0x6b}, /* k */ + /* Ḷ */ {0xe1b8b6, 0x4c}, /* L */ + /* ḷ */ {0xe1b8b7, 0x6c}, /* l */ + /* Ḹ */ {0xe1b8b8, 0x4c}, /* L */ + /* ḹ */ {0xe1b8b9, 0x6c}, /* l */ + /* Ḻ */ {0xe1b8ba, 0x4c}, /* L */ + /* ḻ */ {0xe1b8bb, 0x6c}, /* l */ + /* Ḽ */ {0xe1b8bc, 0x4c}, /* L */ + /* ḽ */ {0xe1b8bd, 0x6c}, /* l */ + /* Ḿ */ {0xe1b8be, 0x4d}, /* M */ + /* ḿ */ {0xe1b8bf, 0x6d}, /* m */ + /* Ṁ */ {0xe1b980, 0x4d}, /* M */ + /* ṁ */ {0xe1b981, 0x6d}, /* m */ + /* Ṃ */ {0xe1b982, 0x4d}, /* M */ + /* ṃ */ {0xe1b983, 0x6d}, /* m */ + /* Ṅ */ {0xe1b984, 0x4e}, /* N */ + /* ṅ */ {0xe1b985, 0x6e}, /* n */ + /* Ṇ */ {0xe1b986, 0x4e}, /* N */ + /* ṇ */ {0xe1b987, 0x6e}, /* n */ + /* Ṉ */ {0xe1b988, 0x4e}, /* N */ + /* ṉ */ {0xe1b989, 0x6e}, /* n */ + /* Ṋ */ {0xe1b98a, 0x4e}, /* N */ + /* ṋ */ {0xe1b98b, 0x6e}, /* n */ + /* Ṍ */ {0xe1b98c, 0x4f}, /* O */ + /* ṍ */ {0xe1b98d, 0x6f}, /* o */ + /* Ṏ */ {0xe1b98e, 0x4f}, /* O */ + /* ṏ */ {0xe1b98f, 0x6f}, /* o */ + /* Ṑ */ {0xe1b990, 0x4f}, /* O */ + /* ṑ */ {0xe1b991, 0x6f}, /* o */ + /* Ṓ */ {0xe1b992, 0x4f}, /* O */ + /* ṓ */ {0xe1b993, 0x6f}, /* o */ + /* Ṕ */ {0xe1b994, 0x50}, /* P */ + /* ṕ */ {0xe1b995, 0x70}, /* p */ + /* Ṗ */ {0xe1b996, 0x50}, /* P */ + /* ṗ */ {0xe1b997, 0x70}, /* p */ + /* Ṙ */ {0xe1b998, 0x52}, /* R */ + /* ṙ */ {0xe1b999, 0x72}, /* r */ + /* Ṛ */ {0xe1b99a, 0x52}, /* R */ + /* ṛ */ {0xe1b99b, 0x72}, /* r */ + /* Ṝ */ {0xe1b99c, 0x52}, /* R */ + /* ṝ */ {0xe1b99d, 0x72}, /* r */ + /* Ṟ */ {0xe1b99e, 0x52}, /* R */ + /* ṟ */ {0xe1b99f, 0x72}, /* r */ + /* Ṡ */ {0xe1b9a0, 0x53}, /* S */ + /* ṡ */ {0xe1b9a1, 0x73}, /* s */ + /* Ṣ */ {0xe1b9a2, 0x53}, /* S */ + /* ṣ */ {0xe1b9a3, 0x73}, /* s */ + /* Ṥ */ {0xe1b9a4, 0x53}, /* S */ + /* ṥ */ {0xe1b9a5, 0x73}, /* s */ + /* Ṧ */ {0xe1b9a6, 0x53}, /* S */ + /* ṧ */ {0xe1b9a7, 0x73}, /* s */ + /* Ṩ */ {0xe1b9a8, 0x53}, /* S */ + /* ṩ */ {0xe1b9a9, 0x73}, /* s */ + /* Ṫ */ {0xe1b9aa, 0x54}, /* T */ + /* ṫ */ {0xe1b9ab, 0x74}, /* t */ + /* Ṭ */ {0xe1b9ac, 0x54}, /* T */ + /* ṭ */ {0xe1b9ad, 0x74}, /* t */ + /* Ṯ */ {0xe1b9ae, 0x54}, /* T */ + /* ṯ */ {0xe1b9af, 0x74}, /* t */ + /* Ṱ */ {0xe1b9b0, 0x54}, /* T */ + /* ṱ */ {0xe1b9b1, 0x74}, /* t */ + /* Ṳ */ {0xe1b9b2, 0x55}, /* U */ + /* ṳ */ {0xe1b9b3, 0x75}, /* u */ + /* Ṵ */ {0xe1b9b4, 0x55}, /* U */ + /* ṵ */ {0xe1b9b5, 0x75}, /* u */ + /* Ṷ */ {0xe1b9b6, 0x55}, /* U */ + /* ṷ */ {0xe1b9b7, 0x75}, /* u */ + /* Ṹ */ {0xe1b9b8, 0x55}, /* U */ + /* ṹ */ {0xe1b9b9, 0x75}, /* u */ + /* Ṻ */ {0xe1b9ba, 0x55}, /* U */ + /* ṻ */ {0xe1b9bb, 0x75}, /* u */ + /* Ṽ */ {0xe1b9bc, 0x56}, /* V */ + /* ṽ */ {0xe1b9bd, 0x76}, /* v */ + /* Ṿ */ {0xe1b9be, 0x56}, /* V */ + /* ṿ */ {0xe1b9bf, 0x76}, /* v */ + /* Ẁ */ {0xe1ba80, 0x57}, /* W */ + /* ẁ */ {0xe1ba81, 0x77}, /* w */ + /* Ẃ */ {0xe1ba82, 0x57}, /* W */ + /* ẃ */ {0xe1ba83, 0x77}, /* w */ + /* Ẅ */ {0xe1ba84, 0x57}, /* W */ + /* ẅ */ {0xe1ba85, 0x77}, /* w */ + /* Ẇ */ {0xe1ba86, 0x57}, /* W */ + /* ẇ */ {0xe1ba87, 0x77}, /* w */ + /* Ẉ */ {0xe1ba88, 0x57}, /* W */ + /* ẉ */ {0xe1ba89, 0x77}, /* w */ + /* Ẋ */ {0xe1ba8a, 0x58}, /* X */ + /* ẋ */ {0xe1ba8b, 0x78}, /* x */ + /* Ẍ */ {0xe1ba8c, 0x58}, /* X */ + /* ẍ */ {0xe1ba8d, 0x78}, /* x */ + /* Ẏ */ {0xe1ba8e, 0x59}, /* Y */ + /* ẏ */ {0xe1ba8f, 0x79}, /* y */ + /* Ẑ */ {0xe1ba90, 0x5a}, /* Z */ + /* ẑ */ {0xe1ba91, 0x7a}, /* z */ + /* Ẓ */ {0xe1ba92, 0x5a}, /* Z */ + /* ẓ */ {0xe1ba93, 0x7a}, /* z */ + /* Ẕ */ {0xe1ba94, 0x5a}, /* Z */ + /* ẕ */ {0xe1ba95, 0x7a}, /* z */ + /* ẖ */ {0xe1ba96, 0x68}, /* h */ + /* ẗ */ {0xe1ba97, 0x74}, /* t */ + /* ẘ */ {0xe1ba98, 0x77}, /* w */ + /* ẙ */ {0xe1ba99, 0x79}, /* y */ + /* ẚ */ {0xe1ba9a, 0x61}, /* a */ + /* ẛ */ {0xe1ba9b, 0x73}, /* s */ + /* ẜ */ {0xe1ba9c, 0x73}, /* s */ + /* ẝ */ {0xe1ba9d, 0x73}, /* s */ + /* ẞ */ {0xe1ba9e, 0x5353}, /* SS */ + /* Ạ */ {0xe1baa0, 0x41}, /* A */ + /* ạ */ {0xe1baa1, 0x61}, /* a */ + /* Ả */ {0xe1baa2, 0x41}, /* A */ + /* ả */ {0xe1baa3, 0x61}, /* a */ + /* Ấ */ {0xe1baa4, 0x41}, /* A */ + /* ấ */ {0xe1baa5, 0x61}, /* a */ + /* Ầ */ {0xe1baa6, 0x41}, /* A */ + /* ầ */ {0xe1baa7, 0x61}, /* a */ + /* Ẩ */ {0xe1baa8, 0x41}, /* A */ + /* ẩ */ {0xe1baa9, 0x61}, /* a */ + /* Ẫ */ {0xe1baaa, 0x41}, /* A */ + /* ẫ */ {0xe1baab, 0x61}, /* a */ + /* Ậ */ {0xe1baac, 0x41}, /* A */ + /* ậ */ {0xe1baad, 0x61}, /* a */ + /* Ắ */ {0xe1baae, 0x41}, /* A */ + /* ắ */ {0xe1baaf, 0x61}, /* a */ + /* Ằ */ {0xe1bab0, 0x41}, /* A */ + /* ằ */ {0xe1bab1, 0x61}, /* a */ + /* Ẳ */ {0xe1bab2, 0x41}, /* A */ + /* ẳ */ {0xe1bab3, 0x61}, /* a */ + /* Ẵ */ {0xe1bab4, 0x41}, /* A */ + /* ẵ */ {0xe1bab5, 0x61}, /* a */ + /* Ặ */ {0xe1bab6, 0x41}, /* A */ + /* ặ */ {0xe1bab7, 0x61}, /* a */ + /* Ẹ */ {0xe1bab8, 0x45}, /* E */ + /* ẹ */ {0xe1bab9, 0x65}, /* e */ + /* Ẻ */ {0xe1baba, 0x45}, /* E */ + /* ẻ */ {0xe1babb, 0x65}, /* e */ + /* Ẽ */ {0xe1babc, 0x45}, /* E */ + /* ẽ */ {0xe1babd, 0x65}, /* e */ + /* Ế */ {0xe1babe, 0x45}, /* E */ + /* ế */ {0xe1babf, 0x65}, /* e */ + /* Ề */ {0xe1bb80, 0x45}, /* E */ + /* ề */ {0xe1bb81, 0x65}, /* e */ + /* Ể */ {0xe1bb82, 0x45}, /* E */ + /* ể */ {0xe1bb83, 0x65}, /* e */ + /* Ễ */ {0xe1bb84, 0x45}, /* E */ + /* ễ */ {0xe1bb85, 0x65}, /* e */ + /* Ệ */ {0xe1bb86, 0x45}, /* E */ + /* ệ */ {0xe1bb87, 0x65}, /* e */ + /* Ỉ */ {0xe1bb88, 0x49}, /* I */ + /* ỉ */ {0xe1bb89, 0x69}, /* i */ + /* Ị */ {0xe1bb8a, 0x49}, /* I */ + /* ị */ {0xe1bb8b, 0x69}, /* i */ + /* Ọ */ {0xe1bb8c, 0x4f}, /* O */ + /* ọ */ {0xe1bb8d, 0x6f}, /* o */ + /* Ỏ */ {0xe1bb8e, 0x4f}, /* O */ + /* ỏ */ {0xe1bb8f, 0x6f}, /* o */ + /* Ố */ {0xe1bb90, 0x4f}, /* O */ + /* ố */ {0xe1bb91, 0x6f}, /* o */ + /* Ồ */ {0xe1bb92, 0x4f}, /* O */ + /* ồ */ {0xe1bb93, 0x6f}, /* o */ + /* Ổ */ {0xe1bb94, 0x4f}, /* O */ + /* ổ */ {0xe1bb95, 0x6f}, /* o */ + /* Ỗ */ {0xe1bb96, 0x4f}, /* O */ + /* ỗ */ {0xe1bb97, 0x6f}, /* o */ + /* Ộ */ {0xe1bb98, 0x4f}, /* O */ + /* ộ */ {0xe1bb99, 0x6f}, /* o */ + /* Ớ */ {0xe1bb9a, 0x4f}, /* O */ + /* ớ */ {0xe1bb9b, 0x6f}, /* o */ + /* Ờ */ {0xe1bb9c, 0x4f}, /* O */ + /* ờ */ {0xe1bb9d, 0x6f}, /* o */ + /* Ở */ {0xe1bb9e, 0x4f}, /* O */ + /* ở */ {0xe1bb9f, 0x6f}, /* o */ + /* Ỡ */ {0xe1bba0, 0x4f}, /* O */ + /* ỡ */ {0xe1bba1, 0x6f}, /* o */ + /* Ợ */ {0xe1bba2, 0x4f}, /* O */ + /* ợ */ {0xe1bba3, 0x6f}, /* o */ + /* Ụ */ {0xe1bba4, 0x55}, /* U */ + /* ụ */ {0xe1bba5, 0x75}, /* u */ + /* Ủ */ {0xe1bba6, 0x55}, /* U */ + /* ủ */ {0xe1bba7, 0x75}, /* u */ + /* Ứ */ {0xe1bba8, 0x55}, /* U */ + /* ứ */ {0xe1bba9, 0x75}, /* u */ + /* Ừ */ {0xe1bbaa, 0x55}, /* U */ + /* ừ */ {0xe1bbab, 0x75}, /* u */ + /* Ử */ {0xe1bbac, 0x55}, /* U */ + /* ử */ {0xe1bbad, 0x75}, /* u */ + /* Ữ */ {0xe1bbae, 0x55}, /* U */ + /* ữ */ {0xe1bbaf, 0x75}, /* u */ + /* Ự */ {0xe1bbb0, 0x55}, /* U */ + /* ự */ {0xe1bbb1, 0x75}, /* u */ + /* Ỳ */ {0xe1bbb2, 0x59}, /* Y */ + /* ỳ */ {0xe1bbb3, 0x79}, /* y */ + /* Ỵ */ {0xe1bbb4, 0x59}, /* Y */ + /* ỵ */ {0xe1bbb5, 0x79}, /* y */ + /* Ỷ */ {0xe1bbb6, 0x59}, /* Y */ + /* ỷ */ {0xe1bbb7, 0x79}, /* y */ + /* Ỹ */ {0xe1bbb8, 0x59}, /* Y */ + /* ỹ */ {0xe1bbb9, 0x79}, /* y */ + /* Ỻ */ {0xe1bbba, 0x4c4c}, /* LL */ + /* ỻ */ {0xe1bbbb, 0x6c6c}, /* ll */ + /* Ỽ */ {0xe1bbbc, 0x56}, /* V */ + /* ỽ */ {0xe1bbbd, 0x76}, /* v */ + /* Ỿ */ {0xe1bbbe, 0x59}, /* Y */ + /* ỿ */ {0xe1bbbf, 0x79}, /* y */ + /* K */ {0xe284aa, 0x4b}, /* K */ + /* Å */ {0xe284ab, 0x41}, /* A */ + /* Ⅰ */ {0xe285a0, 0x49}, /* I */ + /* Ⅱ */ {0xe285a1, 0x4949}, /* II */ + /* Ⅲ */ {0xe285a2, 0x494949}, /* III */ + /* Ⅳ */ {0xe285a3, 0x4956}, /* IV */ + /* Ⅴ */ {0xe285a4, 0x56}, /* V */ + /* Ⅵ */ {0xe285a5, 0x5649}, /* VI */ + /* Ⅶ */ {0xe285a6, 0x564949}, /* VII */ + /* Ⅷ */ {0xe285a7, 0x56494949}, /* VIII */ + /* Ⅸ */ {0xe285a8, 0x4958}, /* IX */ + /* Ⅹ */ {0xe285a9, 0x58}, /* X */ + /* Ⅺ */ {0xe285aa, 0x5849}, /* XI */ + /* Ⅻ */ {0xe285ab, 0x584949}, /* XII */ + /* Ⅼ */ {0xe285ac, 0x4c}, /* L */ + /* Ⅽ */ {0xe285ad, 0x43}, /* C */ + /* Ⅾ */ {0xe285ae, 0x44}, /* D */ + /* Ⅿ */ {0xe285af, 0x4d}, /* M */ + /* ⅰ */ {0xe285b0, 0x69}, /* i */ + /* ⅱ */ {0xe285b1, 0x6969}, /* ii */ + /* ⅲ */ {0xe285b2, 0x696969}, /* iii */ + /* ⅳ */ {0xe285b3, 0x6976}, /* iv */ + /* ⅴ */ {0xe285b4, 0x76}, /* v */ + /* ⅵ */ {0xe285b5, 0x7669}, /* vi */ + /* ⅶ */ {0xe285b6, 0x766969}, /* vii */ + /* ⅷ */ {0xe285b7, 0x76696969}, /* viii */ + /* ⅸ */ {0xe285b8, 0x6978}, /* ix */ + /* ⅹ */ {0xe285b9, 0x78}, /* x */ + /* ⅺ */ {0xe285ba, 0x7869}, /* xi */ + /* ⅻ */ {0xe285bb, 0x786969}, /* xii */ + /* ⅼ */ {0xe285bc, 0x6c}, /* l */ + /* ⅽ */ {0xe285bd, 0x63}, /* c */ + /* ⅾ */ {0xe285be, 0x64}, /* d */ + /* ⅿ */ {0xe285bf, 0x6d}, /* m */ + /* ff */ {0xefac80, 0x6666}, /* ff */ + /* fi */ {0xefac81, 0x6669}, /* fi */ + /* fl */ {0xefac82, 0x666c}, /* fl */ + /* ffi */ {0xefac83, 0x666669}, /* ffi */ + /* ffl */ {0xefac84, 0x66666c}, /* ffl */ + /* ſt */ {0xefac85, 0x7374}, /* st */ + /* st */ {0xefac86, 0x7374}, /* st */ + /* 0 */ {0xefbc90, 0x30}, /* 0 */ + /* 1 */ {0xefbc91, 0x31}, /* 1 */ + /* 2 */ {0xefbc92, 0x32}, /* 2 */ + /* 3 */ {0xefbc93, 0x33}, /* 3 */ + /* 4 */ {0xefbc94, 0x34}, /* 4 */ + /* 5 */ {0xefbc95, 0x35}, /* 5 */ + /* 6 */ {0xefbc96, 0x36}, /* 6 */ + /* 7 */ {0xefbc97, 0x37}, /* 7 */ + /* 8 */ {0xefbc98, 0x38}, /* 8 */ + /* 9 */ {0xefbc99, 0x39}, /* 9 */ + /* A */ {0xefbca1, 0x41}, /* A */ + /* B */ {0xefbca2, 0x42}, /* B */ + /* C */ {0xefbca3, 0x43}, /* C */ + /* D */ {0xefbca4, 0x44}, /* D */ + /* E */ {0xefbca5, 0x45}, /* E */ + /* F */ {0xefbca6, 0x46}, /* F */ + /* G */ {0xefbca7, 0x47}, /* G */ + /* H */ {0xefbca8, 0x48}, /* H */ + /* I */ {0xefbca9, 0x49}, /* I */ + /* J */ {0xefbcaa, 0x4a}, /* J */ + /* K */ {0xefbcab, 0x4b}, /* K */ + /* L */ {0xefbcac, 0x4c}, /* L */ + /* M */ {0xefbcad, 0x4d}, /* M */ + /* N */ {0xefbcae, 0x4e}, /* N */ + /* O */ {0xefbcaf, 0x4f}, /* O */ + /* P */ {0xefbcb0, 0x50}, /* P */ + /* Q */ {0xefbcb1, 0x51}, /* Q */ + /* R */ {0xefbcb2, 0x52}, /* R */ + /* S */ {0xefbcb3, 0x53}, /* S */ + /* T */ {0xefbcb4, 0x54}, /* T */ + /* U */ {0xefbcb5, 0x55}, /* U */ + /* V */ {0xefbcb6, 0x56}, /* V */ + /* W */ {0xefbcb7, 0x57}, /* W */ + /* X */ {0xefbcb8, 0x58}, /* X */ + /* Y */ {0xefbcb9, 0x59}, /* Y */ + /* Z */ {0xefbcba, 0x5a}, /* Z */ + /* a */ {0xefbd81, 0x61}, /* a */ + /* b */ {0xefbd82, 0x62}, /* b */ + /* c */ {0xefbd83, 0x63}, /* c */ + /* d */ {0xefbd84, 0x64}, /* d */ + /* e */ {0xefbd85, 0x65}, /* e */ + /* f */ {0xefbd86, 0x66}, /* f */ + /* g */ {0xefbd87, 0x67}, /* g */ + /* h */ {0xefbd88, 0x68}, /* h */ + /* i */ {0xefbd89, 0x69}, /* i */ + /* j */ {0xefbd8a, 0x6a}, /* j */ + /* k */ {0xefbd8b, 0x6b}, /* k */ + /* l */ {0xefbd8c, 0x6c}, /* l */ + /* m */ {0xefbd8d, 0x6d}, /* m */ + /* n */ {0xefbd8e, 0x6e}, /* n */ + /* o */ {0xefbd8f, 0x6f}, /* o */ + /* p */ {0xefbd90, 0x70}, /* p */ + /* q */ {0xefbd91, 0x71}, /* q */ + /* r */ {0xefbd92, 0x72}, /* r */ + /* s */ {0xefbd93, 0x73}, /* s */ + /* t */ {0xefbd94, 0x74}, /* t */ + /* u */ {0xefbd95, 0x75}, /* u */ + /* v */ {0xefbd96, 0x76}, /* v */ + /* w */ {0xefbd97, 0x77}, /* w */ + /* x */ {0xefbd98, 0x78}, /* x */ + /* y */ {0xefbd99, 0x79}, /* y */ + /* z */ {0xefbd9a, 0x7a} /* z */ +}; \ No newline at end of file diff --git a/test/JDBC/expected/13_4__preparation__sys-columns-dep-vu-prepare.out b/test/JDBC/expected/13_4__preparation__sys-columns-dep-vu-prepare.out index 922d9a930a9..b83a00a4c21 100644 --- a/test/JDBC/expected/13_4__preparation__sys-columns-dep-vu-prepare.out +++ b/test/JDBC/expected/13_4__preparation__sys-columns-dep-vu-prepare.out @@ -2,11 +2,11 @@ create table sys_columns_dep_vu_prepare_t1(a int, b float, c bigint, d numeric, go create procedure sys_columns_dep_vu_prepare_p1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create view sys_columns_dep_vu_prepare_v1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create function sys_columns_dep_vu_prepare_f1() diff --git a/test/JDBC/expected/13_5__preparation__sys-columns-dep-vu-prepare.out b/test/JDBC/expected/13_5__preparation__sys-columns-dep-vu-prepare.out index 922d9a930a9..b83a00a4c21 100644 --- a/test/JDBC/expected/13_5__preparation__sys-columns-dep-vu-prepare.out +++ b/test/JDBC/expected/13_5__preparation__sys-columns-dep-vu-prepare.out @@ -2,11 +2,11 @@ create table sys_columns_dep_vu_prepare_t1(a int, b float, c bigint, d numeric, go create procedure sys_columns_dep_vu_prepare_p1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create view sys_columns_dep_vu_prepare_v1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create function sys_columns_dep_vu_prepare_f1() diff --git a/test/JDBC/expected/13_6__preparation__sys-columns-dep-vu-prepare.out b/test/JDBC/expected/13_6__preparation__sys-columns-dep-vu-prepare.out index 922d9a930a9..b83a00a4c21 100644 --- a/test/JDBC/expected/13_6__preparation__sys-columns-dep-vu-prepare.out +++ b/test/JDBC/expected/13_6__preparation__sys-columns-dep-vu-prepare.out @@ -2,11 +2,11 @@ create table sys_columns_dep_vu_prepare_t1(a int, b float, c bigint, d numeric, go create procedure sys_columns_dep_vu_prepare_p1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create view sys_columns_dep_vu_prepare_v1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create function sys_columns_dep_vu_prepare_f1() diff --git a/test/JDBC/expected/13_7__preparation__sys-columns-dep-vu-prepare.out b/test/JDBC/expected/13_7__preparation__sys-columns-dep-vu-prepare.out index 922d9a930a9..b83a00a4c21 100644 --- a/test/JDBC/expected/13_7__preparation__sys-columns-dep-vu-prepare.out +++ b/test/JDBC/expected/13_7__preparation__sys-columns-dep-vu-prepare.out @@ -2,11 +2,11 @@ create table sys_columns_dep_vu_prepare_t1(a int, b float, c bigint, d numeric, go create procedure sys_columns_dep_vu_prepare_p1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create view sys_columns_dep_vu_prepare_v1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create function sys_columns_dep_vu_prepare_f1() diff --git a/test/JDBC/expected/13_8__preparation__sys-columns-dep-vu-prepare.out b/test/JDBC/expected/13_8__preparation__sys-columns-dep-vu-prepare.out index 922d9a930a9..b83a00a4c21 100644 --- a/test/JDBC/expected/13_8__preparation__sys-columns-dep-vu-prepare.out +++ b/test/JDBC/expected/13_8__preparation__sys-columns-dep-vu-prepare.out @@ -2,11 +2,11 @@ create table sys_columns_dep_vu_prepare_t1(a int, b float, c bigint, d numeric, go create procedure sys_columns_dep_vu_prepare_p1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create view sys_columns_dep_vu_prepare_v1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create function sys_columns_dep_vu_prepare_f1() diff --git a/test/JDBC/expected/13_9__preparation__sys-columns-dep-vu-prepare.out b/test/JDBC/expected/13_9__preparation__sys-columns-dep-vu-prepare.out index 922d9a930a9..b83a00a4c21 100644 --- a/test/JDBC/expected/13_9__preparation__sys-columns-dep-vu-prepare.out +++ b/test/JDBC/expected/13_9__preparation__sys-columns-dep-vu-prepare.out @@ -2,11 +2,11 @@ create table sys_columns_dep_vu_prepare_t1(a int, b float, c bigint, d numeric, go create procedure sys_columns_dep_vu_prepare_p1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create view sys_columns_dep_vu_prepare_v1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create function sys_columns_dep_vu_prepare_f1() diff --git a/test/JDBC/expected/AUTO_ANALYZE-vu-prepare.out b/test/JDBC/expected/AUTO_ANALYZE-vu-prepare.out index d569a9922d3..a77f0b4178e 100644 --- a/test/JDBC/expected/AUTO_ANALYZE-vu-prepare.out +++ b/test/JDBC/expected/AUTO_ANALYZE-vu-prepare.out @@ -22,6 +22,9 @@ babelfish_extended_properties babelfish_function_ext babelfish_helpcollation babelfish_namespace_ext +babelfish_partition_depend +babelfish_partition_function +babelfish_partition_scheme babelfish_schema_permissions babelfish_server_options babelfish_sysdatabases diff --git a/test/JDBC/expected/BABEL-1193.out b/test/JDBC/expected/BABEL-1193.out index d376ef627c9..848a004b30b 100644 --- a/test/JDBC/expected/BABEL-1193.out +++ b/test/JDBC/expected/BABEL-1193.out @@ -247,7 +247,7 @@ char#!#char#!#char#!#char#!#char#!#char#!#char#!#char select upper(cast (1 as smallint)), upper(cast (1 as int)), upper(cast (1 as bigint)), upper(cast (1 as real)), upper(cast (1 as float)), upper(cast (2.1 as numeric(2,1))), upper(cast (1 as smallmoney)), upper(cast (1 as money)); GO ~~START~~ -text#!#text#!#text#!#text#!#text#!#text#!#text#!#text +varchar#!#varchar#!#varchar#!#varchar#!#varchar#!#varchar#!#varchar#!#varchar 1#!#1#!#1#!#1#!#1#!#2.1#!#1.0000#!#1.0000 ~~END~~ diff --git a/test/JDBC/expected/BABEL-1994-CHAR-vu-verify.out b/test/JDBC/expected/BABEL-1994-CHAR-vu-verify.out index 245f7077a98..41a9438cd9c 100644 --- a/test/JDBC/expected/BABEL-1994-CHAR-vu-verify.out +++ b/test/JDBC/expected/BABEL-1994-CHAR-vu-verify.out @@ -160,7 +160,7 @@ select ; go ~~START~~ -int#!#text#!#nvarchar#!#bigint#!#text +int#!#varchar#!#nvarchar#!#bigint#!#varchar 97#!# a#!#[a[]] b ]#!#1#!#a ~~END~~ @@ -176,7 +176,7 @@ select ; go ~~START~~ -text#!#text#!#int#!#int#!#int#!#int#!#int +varchar#!#varchar#!#int#!#int#!#int#!#int#!#int a #!#a #!#0#!#97#!#5#!#5#!#3 ~~END~~ diff --git a/test/JDBC/expected/BABEL-1994-CHAR.out b/test/JDBC/expected/BABEL-1994-CHAR.out index f5339bda4b2..4635fe88ead 100644 --- a/test/JDBC/expected/BABEL-1994-CHAR.out +++ b/test/JDBC/expected/BABEL-1994-CHAR.out @@ -191,7 +191,7 @@ select ; go ~~START~~ -int#!#text#!#nvarchar#!#bigint#!#text +int#!#varchar#!#nvarchar#!#bigint#!#varchar 97#!# a#!#[a[]] b ]#!#1#!#a ~~END~~ @@ -207,7 +207,7 @@ select ; go ~~START~~ -text#!#text#!#int#!#int#!#int#!#int#!#int +varchar#!#varchar#!#int#!#int#!#int#!#int#!#int a #!#a #!#0#!#97#!#5#!#5#!#3 ~~END~~ diff --git a/test/JDBC/expected/BABEL-1994-VARCHAR-vu-verify.out b/test/JDBC/expected/BABEL-1994-VARCHAR-vu-verify.out index 6aa88ddadc1..c3e1dfadca6 100644 --- a/test/JDBC/expected/BABEL-1994-VARCHAR-vu-verify.out +++ b/test/JDBC/expected/BABEL-1994-VARCHAR-vu-verify.out @@ -165,7 +165,7 @@ select ; go ~~START~~ -int#!#text#!#nvarchar#!#bigint#!#text +int#!#varchar#!#nvarchar#!#bigint#!#varchar 97#!# a#!#[a[]] b ]#!#1#!#a ~~END~~ @@ -181,7 +181,7 @@ select ; go ~~START~~ -text#!#text#!#int#!#int#!#int#!#int#!#int +varchar#!#varchar#!#int#!#int#!#int#!#int#!#int a #!#a #!#1#!#97#!#4#!#4#!#3 ~~END~~ diff --git a/test/JDBC/expected/BABEL-1994-VARCHAR.out b/test/JDBC/expected/BABEL-1994-VARCHAR.out index f53a9a4392d..8237baf561f 100644 --- a/test/JDBC/expected/BABEL-1994-VARCHAR.out +++ b/test/JDBC/expected/BABEL-1994-VARCHAR.out @@ -189,7 +189,7 @@ select ; go ~~START~~ -int#!#text#!#nvarchar#!#bigint#!#text +int#!#varchar#!#nvarchar#!#bigint#!#varchar 97#!# a#!#[a[]] b ]#!#1#!#a ~~END~~ @@ -205,7 +205,7 @@ select ; go ~~START~~ -text#!#text#!#int#!#int#!#int#!#int#!#int +varchar#!#varchar#!#int#!#int#!#int#!#int#!#int a #!#a #!#1#!#97#!#4#!#4#!#3 ~~END~~ diff --git a/test/JDBC/expected/BABEL-2349.out b/test/JDBC/expected/BABEL-2349.out index 2a4de0e6c0f..5a3d3859331 100644 --- a/test/JDBC/expected/BABEL-2349.out +++ b/test/JDBC/expected/BABEL-2349.out @@ -93,9 +93,10 @@ int SELECT count(*) FROM db1.dbo.SySInDeXes where id=OBJECT_ID('t1'); go -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: Cross-DB system view query is not currently supported in Babelfish.)~~ +~~START~~ +int +0 +~~END~~ -- clean up diff --git a/test/JDBC/expected/BABEL-2455.out b/test/JDBC/expected/BABEL-2455.out index 17c0bb6b5d0..e813b86ee61 100644 --- a/test/JDBC/expected/BABEL-2455.out +++ b/test/JDBC/expected/BABEL-2455.out @@ -261,16 +261,8 @@ go -- trigger CREATE TRIGGER .tr2455 on t2455_base AFTER INSERT AS print 'triggered'; go -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: Cannot create trigger 'dbo.tr2455' because its schema is different from the schema of the target table or view.)~~ - DROP TRIGGER .tr2455; go -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: trigger "dbo.tr2455" does not exist)~~ - CREATE TRIGGER ..tr2455 on t2455_base AFTER INSERT AS print 'triggered'; go diff --git a/test/JDBC/expected/BABEL-2515.out b/test/JDBC/expected/BABEL-2515.out deleted file mode 100644 index a065c204e2d..00000000000 --- a/test/JDBC/expected/BABEL-2515.out +++ /dev/null @@ -1,36 +0,0 @@ -use master; -GO - -CREATE TABLE [BABEL-2515] -( - [PartitionId] [smallint] NOT NULL, - CONSTRAINT [PK_DataRecord2056] PRIMARY KEY CLUSTERED ( [PartitionId] ASC ) - WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) - ON [XFPS_DataRecord2056]([PartitionId]) -) -ON [XFPS_DataRecord2056]([PartitionId]); -GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: 'partition scheme' is not currently supported in Babelfish. please use babelfishpg_tsql.escape_hatch_storage_on_partition to ignore)~~ - - -EXEC sp_babelfish_configure 'babelfishpg_tsql.escape_hatch_storage_on_partition', 'ignore'; -GO - -CREATE TABLE [BABEL-2515] -( - [PartitionId] [smallint] NOT NULL, - CONSTRAINT [PK_DataRecord2056] PRIMARY KEY CLUSTERED ( [PartitionId] ASC ) - WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) - ON [XFPS_DataRecord2056]([PartitionId]) -) -ON [XFPS_DataRecord2056]([PartitionId]); -GO - -DROP TABLE [BABEL-2515] -GO - --- reset to default -EXEC sp_babelfish_configure 'babelfishpg_tsql.escape_hatch_storage_on_partition', 'strict'; -GO diff --git a/test/JDBC/expected/BABEL-2829.out b/test/JDBC/expected/BABEL-2829.out index 1cebc43a8c7..85b4a5ee778 100644 --- a/test/JDBC/expected/BABEL-2829.out +++ b/test/JDBC/expected/BABEL-2829.out @@ -66,7 +66,7 @@ SELECT DISTINCT db_name(dbid), loginname FROM db_2829.dbo.sysprocesses WHERE spi GO ~~START~~ nvarchar#!#nchar -master#!#jdbc_user +db_2829#!#jdbc_user ~~END~~ diff --git a/test/JDBC/expected/BABEL-3215-vu-verify.out b/test/JDBC/expected/BABEL-3215-vu-verify.out index cc1793c0b4d..daa7622e0b1 100644 --- a/test/JDBC/expected/BABEL-3215-vu-verify.out +++ b/test/JDBC/expected/BABEL-3215-vu-verify.out @@ -585,7 +585,7 @@ inner join babel4210_t3 on babel4210_t1.id = babel4210_t3.t1_id ORDER BY upper(babel4210_t3.val); go ~~START~~ -int#!#varchar#!#text +int#!#varchar#!#varchar 1#!#x#!#A 2#!#Y#!#B 3#!#z#!#C diff --git a/test/JDBC/expected/BABEL-3820-vu-cleanup.out b/test/JDBC/expected/BABEL-3820-vu-cleanup.out new file mode 100644 index 00000000000..f2457bf3db7 --- /dev/null +++ b/test/JDBC/expected/BABEL-3820-vu-cleanup.out @@ -0,0 +1,33 @@ +drop procedure openjson_3820_p1 +go + +drop procedure openjson_3820_p2 +go + +drop procedure openjson_3820_p3 +go + +drop procedure openjson_3820_p4 +go + +drop procedure openjson_3820_p5 +go + +drop procedure openjson_3820_p6 +go + +drop procedure openjson_3820_p7 +go + +drop procedure openjson_3820_p8 +go + +drop procedure openjson_3820_p9 +go + + +drop procedure openjson_3820_p10 +go + +drop procedure openjson_3820_p11 +go diff --git a/test/JDBC/expected/BABEL-3820-vu-prepare.out b/test/JDBC/expected/BABEL-3820-vu-prepare.out new file mode 100644 index 00000000000..e5cd3542a26 --- /dev/null +++ b/test/JDBC/expected/BABEL-3820-vu-prepare.out @@ -0,0 +1,106 @@ +-- Test strict mode where path does not exist +-- Expect error +CREATE PROCEDURE openjson_3820_p1 +AS +BEGIN + SELECT * FROM OPENJSON('{}') WITH(field int 'strict$.field') +END; +GO + +-- Test lax mode where path does not exist +-- Expect empty result and no error +CREATE PROCEDURE openjson_3820_p2 +AS +BEGIN + DECLARE @json_p2 NVarChar(max)=N'{"someKey" : "someValue"}'; + SELECT * from OPENJSON(@json_p2,'$.somePathWhichDoesNotExists') WITH (id VARCHAR(100) '$') +END; +GO + +-- Test strict mode where path does not exist +-- Expect an error for no path +CREATE PROCEDURE openjson_3820_p3 +AS +BEGIN + DECLARE @json_p3 NVarChar(max)=N'{"someKey" : "someValue"}'; + SELECT * from OPENJSON(@json_p3,'strict $.somePathWhichDoesNotExists') WITH (id VARCHAR(100) '$') +END; +GO + +-- Test standard OPENJSON call +-- Expect result +CREATE PROCEDURE openjson_3820_p4 +AS +BEGIN + DECLARE @json_p4 NVarChar(max)=N'{"obj":{"a":1}}'; + SELECT * FROM OPENJSON(@json_p4, 'strict $.obj') WITH (a char(20)) +END; +GO + +-- Test strict mode where path does not exist +-- Expect error in strict mode +CREATE PROCEDURE openjson_3820_p5 +AS +BEGIN + SELECT * FROM OPENJSON(N'[{"Item": {"Price":2024.9940}}]') WITH(field int 'strict $.field') +END; +GO + +-- Test lax mode where path does not exist +-- Expect empty result because path does not exist +CREATE PROCEDURE openjson_3820_p6 +AS +BEGIN + DECLARE @json_p6 NVARCHAR(4000) = N'{"to":{"sub-object":["en-GB", "en-UK","de-AT","es-AR","sr-Cyrl"]}}'; + SELECT [key], value FROM OPENJSON(@json_p6,'lax$.path.to."sub-object"') +END; +GO + +-- Test OPENJSON strict call where path exists +-- Expect json result +CREATE PROCEDURE openjson_3820_p7 +AS +BEGIN + DECLARE @json_p7 NVARCHAR(4000) = N'{"path": {"to":{"sub-object":["en-GB", "en-UK","de-AT","es-AR","sr-Cyrl"]}}}'; + SELECT [key], value FROM OPENJSON(@json_p7,'strict $.path.to."sub-object"') +END; +GO + +-- Test OPENJSON strict call where path exists, strict is mixed case, +-- and no space between "strict" and the path. Expect json result +CREATE PROCEDURE openjson_3820_p8 +AS +BEGIN + DECLARE @json_p8 NVARCHAR(4000) = N'{"path": {"to":{"sub-object":["en-GB", "en-UK","de-AT","es-AR","sr-Cyrl"]}}}'; + SELECT [key], value FROM OPENJSON(@json_p8,'sTrIct$.path.to."sub-object"') +END; +GO + +-- Test OPENJSON strict with incorrect path +-- Expect error +CREATE PROCEDURE openjson_3820_p9 +AS +BEGIN + DECLARE @json_p9 NVARCHAR(4000) = N'{"to":{"sub-object":["en-GB", "en-UK","de-AT","es-AR","sr-Cyrl"]}}'; + SELECT [key], value FROM OPENJSON(@json_p9,'strict $.path.to."sub-object"') +END; +GO + +-- Test OPENJSON with incorrect path +-- Expect empty result +CREATE PROCEDURE openjson_3820_p10 +AS +BEGIN + DECLARE @json_p10 NVARCHAR(4000) = N'{"to":{"sub-object":["en-GB", "en-UK","de-AT","es-AR","sr-Cyrl"]}}'; + SELECT [key], value FROM OPENJSON(@json_p10,'$.path.to."sub-object"') +END; +GO + +-- Test strict mode where path does not exist +-- Expect error in strict mode +CREATE PROCEDURE openjson_3820_p11 +AS +BEGIN + SELECT * FROM OPENJSON(N'{}') WITH(field int 'strict $.field') +END; +GO diff --git a/test/JDBC/expected/BABEL-3820-vu-verify.out b/test/JDBC/expected/BABEL-3820-vu-verify.out new file mode 100644 index 00000000000..6ac0257d337 --- /dev/null +++ b/test/JDBC/expected/BABEL-3820-vu-verify.out @@ -0,0 +1,120 @@ +-- Test strict mode where path does not exist +-- Expect error +exec openjson_3820_p1 +go +~~START~~ +int +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: JSON object does not contain key "field")~~ + + +-- Test lax mode where path does not exist +-- Expect empty result and no error +exec openjson_3820_p2 +go +~~START~~ +varchar + +~~END~~ + + +-- Test strict mode where path does not exist +-- Expect an error for no path +exec openjson_3820_p3 +go +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: JSON object does not contain key "somePathWhichDoesNotExists")~~ + + +-- Test standard OPENJSON call +-- Expect result +exec openjson_3820_p4 +go +~~START~~ +char +1 +~~END~~ + + +-- Test strict mode where path does not exist +-- Expect error in strict mode +exec openjson_3820_p5 +go +~~START~~ +int +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: JSON object does not contain key "field")~~ + + +-- Test lax mode where path does not exist +-- Expect empty result because path does not exist +exec openjson_3820_p6 +go +~~START~~ +nvarchar#!#nvarchar +~~END~~ + + +-- Test OPENJSON strict call where path exists +-- Expect json result +exec openjson_3820_p7 +go +~~START~~ +nvarchar#!#nvarchar +0#!#en-GB +1#!#en-UK +2#!#de-AT +3#!#es-AR +4#!#sr-Cyrl +~~END~~ + + +-- Test OPENJSON strict call where path exists, strict is mixed case, +-- and no space between "strict" and the path. Expect json result +exec openjson_3820_p8 +go +~~START~~ +nvarchar#!#nvarchar +0#!#en-GB +1#!#en-UK +2#!#de-AT +3#!#es-AR +4#!#sr-Cyrl +~~END~~ + + +-- Test OPENJSON strict with incorrect path +-- Expect error +exec openjson_3820_p9 +go +~~START~~ +nvarchar#!#nvarchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: JSON object does not contain key "path")~~ + + +-- Test OPENJSON with incorrect path +-- Expect empty result +exec openjson_3820_p10 +go +~~START~~ +nvarchar#!#nvarchar +~~END~~ + + +-- Test strict mode where path does not exist +-- Expect error in strict mode +exec openjson_3820_p11 +go +~~START~~ +int +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: JSON object does not contain key "field")~~ + diff --git a/test/JDBC/expected/BABEL-3844-vu-cleanup.out b/test/JDBC/expected/BABEL-3844-vu-cleanup.out index 2f51052245d..9dd45e64624 100644 --- a/test/JDBC/expected/BABEL-3844-vu-cleanup.out +++ b/test/JDBC/expected/BABEL-3844-vu-cleanup.out @@ -6,7 +6,7 @@ drop user test_user; GO ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: role "master_test_user" does not exist)~~ +~~ERROR (Message: Cannot drop the user 'test_user', because it does not exist or you do not have permission.)~~ drop login [babel\aduser1]; diff --git a/test/JDBC/expected/BABEL-4046-vu-verify.out b/test/JDBC/expected/BABEL-4046-vu-verify.out index f1095286e8b..91510e98407 100644 --- a/test/JDBC/expected/BABEL-4046-vu-verify.out +++ b/test/JDBC/expected/BABEL-4046-vu-verify.out @@ -51,7 +51,7 @@ AAA#!#A% INNER JOIN t4 SR ON DM.baseloc = SR.loc AND DM.deptno = SR.deptno order by DM.empno; GO ~~START~~ -int#!#nvarchar#!#text +int#!#nvarchar#!#nvarchar 7782#!#CLARK#!#NEW YORK ~~END~~ @@ -60,7 +60,7 @@ int#!#nvarchar#!#text select DM.empno, DM.ename, DM.baseloc from EMP_T DM where DM.baseloc in (select baseloc from t4) order by DM.empno GO ~~START~~ -int#!#nvarchar#!#text +int#!#nvarchar#!#nvarchar 7369#!#SMITH#!#BOSTON 7499#!#ALLEN#!#CHICAGO 7521#!#WARD#!#CHICAGO diff --git a/test/JDBC/expected/BABEL-4279.out b/test/JDBC/expected/BABEL-4279.out index ca35e2bfd5f..14d54ffe81b 100644 --- a/test/JDBC/expected/BABEL-4279.out +++ b/test/JDBC/expected/BABEL-4279.out @@ -1,3 +1,27 @@ +-- tsql +CREATE TABLE babelfish_migration_mode_table (id_num INT IDENTITY(1,1), mig_mode VARCHAR(10)) +GO +INSERT INTO babelfish_migration_mode_table SELECT current_setting('babelfishpg_tsql.migration_mode') +GO +~~ROW COUNT: 1~~ + + +-- test multi-db mode +SELECT set_config('role', 'jdbc_user', false); +GO +~~START~~ +text +jdbc_user +~~END~~ + +SELECT set_config('babelfishpg_tsql.migration_mode', 'multi-db', false); +GO +~~START~~ +text +multi-db +~~END~~ + + -- tsql CREATE TABLE test_babel_4279_t1([ABC.nfds] INT, [DEf.j] INT); GO @@ -80,7 +104,7 @@ SELECT pg_catalog.pg_get_viewdef(oid, true) FROM pg_class WHERE relname = 'test_ GO ~~START~~ text - SELECT "abc.nfds" AS "ABC.nfds" FROM test_babel_4279_s1.test_babel_4279_st1; + SELECT "abc.nfds" AS "ABC.nfds" FROM """test_babel_4279_d.1""_test_babel_4279_s1".test_babel_4279_st1; ~~END~~ @@ -88,7 +112,7 @@ SELECT pg_catalog.pg_get_viewdef(oid, true) FROM pg_class WHERE relname = 'test_ GO ~~START~~ text - SELECT "abc.nfds" AS "ABC.nfds" FROM test_babel_4279_s1.test_babel_4279_st1; + SELECT "abc.nfds" AS "ABC.nfds" FROM """test_babel_4279_d.1""_test_babel_4279_s1".test_babel_4279_st1; ~~END~~ @@ -235,3 +259,24 @@ GO DROP TABLE t3 GO +SELECT set_config('role', 'jdbc_user', false); +GO +~~START~~ +text +jdbc_user +~~END~~ + + +-- Reset migration mode to default +DECLARE @mig_mode VARCHAR(10) +SET @mig_mode = (SELECT mig_mode FROM babelfish_migration_mode_table WHERE id_num = 1) +SELECT CASE WHEN (SELECT set_config('babelfishpg_tsql.migration_mode', @mig_mode, false)) IS NOT NULL THEN 1 ELSE 0 END +GO +~~START~~ +int +1 +~~END~~ + + +Drop Table IF EXISTS babelfish_migration_mode_table +GO diff --git a/test/JDBC/expected/BABEL-4484-vu-verify.out b/test/JDBC/expected/BABEL-4484-vu-verify.out index b3961349aa8..4ef1b538d34 100644 --- a/test/JDBC/expected/BABEL-4484-vu-verify.out +++ b/test/JDBC/expected/BABEL-4484-vu-verify.out @@ -26,3 +26,43 @@ GO varchar ~~END~~ + +SELECT test_babel_4484_t1.ced--table1.REPGETTEXT( +FROM test_babel_4484_t1 +GO +~~START~~ +varchar +~~END~~ + + +select test_babel_4484_t1.您您--table1.a.b.c +from test_babel_4484_t1 +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: column test_babel_4484_t1.您您 does not exist)~~ + + +select test_babel_4484_t2.您您--table1.a.b.c +from test_babel_4484_t2 +GO +~~START~~ +varchar +~~END~~ + + +select test_babel_4484_t1.您您 as kk--table1.a.b.c +from test_babel_4484_t1 +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: column test_babel_4484_t1.您您 does not exist)~~ + + +select test_babel_4484_t2.您您 as kk--table1.a.b.c +from test_babel_4484_t2 +GO +~~START~~ +varchar +~~END~~ + diff --git a/test/JDBC/expected/BABEL-4547.out b/test/JDBC/expected/BABEL-4547.out index 3f83243c31a..1d4e81f31b7 100644 --- a/test/JDBC/expected/BABEL-4547.out +++ b/test/JDBC/expected/BABEL-4547.out @@ -104,7 +104,7 @@ select @b; go ~~START~~ varbinary -30783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031 +01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101 ~~END~~ @@ -112,7 +112,7 @@ select cast(REPLICATE(0x01, 60001) as varbinary(max)); GO ~~START~~ varbinary -30783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031 +01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101 ~~END~~ @@ -139,9 +139,9 @@ select c from babel4547t3; go ~~START~~ varbinary -30783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031 -30783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031 -30783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031307830313078303130783031 +01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101 +01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101 +01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101 ~~END~~ diff --git a/test/JDBC/expected/BABEL-4888-vu-cleanup.out b/test/JDBC/expected/BABEL-4888-vu-cleanup.out new file mode 100644 index 00000000000..33ac0890066 --- /dev/null +++ b/test/JDBC/expected/BABEL-4888-vu-cleanup.out @@ -0,0 +1,2 @@ +DROP TABLE babel_4888_t1, babel_4888_t2, babel_4888_t3, babel_4888_t4; +GO diff --git a/test/JDBC/expected/BABEL-4888-vu-prepare.out b/test/JDBC/expected/BABEL-4888-vu-prepare.out new file mode 100644 index 00000000000..e307372a0ef --- /dev/null +++ b/test/JDBC/expected/BABEL-4888-vu-prepare.out @@ -0,0 +1,8 @@ +CREATE TABLE babel_4888_t1 (id1 INT UNIQUE(id1 DESC), id2 VARCHAR(30) UNIQUE(id2 ASC), id3 VARBINARY(30)) +GO +CREATE TABLE babel_4888_t2 (id1 INT, id2 VARCHAR(30), id3 VARBINARY(30), UNIQUE(id1 ASC, id2 DESC)) +GO +CREATE TABLE babel_4888_t3 (id1 INT PRIMARY KEY(id1 DESC), id2 VARCHAR(30) UNIQUE(id2), id3 VARBINARY(30)) +GO +CREATE TABLE babel_4888_t4 (id1 INT, id2 VARCHAR(30), id3 VARBINARY(30), PRIMARY KEY(id1 ASC, id2 DESC)) +GO diff --git a/test/JDBC/expected/BABEL-4888-vu-verify.out b/test/JDBC/expected/BABEL-4888-vu-verify.out new file mode 100644 index 00000000000..d63a8eec16f --- /dev/null +++ b/test/JDBC/expected/BABEL-4888-vu-verify.out @@ -0,0 +1,145 @@ + +-- table 1 id1 & id2 should be individually unique +INSERT INTO babel_4888_t1 VALUES (-1, '-a', 0x0001), (1, '+a', 0x1001), (NULL, '', NULL), (0, NULL, NULL) +GO +~~ROW COUNT: 4~~ + + +INSERT INTO babel_4888_t1 VALUES (NULL, 'random', 0x9999) +GO +~~ERROR (Code: 2627)~~ + +~~ERROR (Message: duplicate key value violates unique constraint "babel_4888_t1_id1_key")~~ + + +INSERT INTO babel_4888_t1 VALUES (9999, NULL, 0x9999) +GO +~~ERROR (Code: 2627)~~ + +~~ERROR (Message: duplicate key value violates unique constraint "babel_4888_t1_id2_key")~~ + + +INSERT INTO babel_4888_t1 VALUES (9999, 'random', NULL) +GO +~~ROW COUNT: 1~~ + + + +-- table 2 Combination of id1 & id2 should be unique +INSERT INTO babel_4888_t2 VALUES (-1, '-a', 0x0001), (1, '+a', 0x1001), (NULL, '', NULL), (0, NULL, NULL) +GO +~~ROW COUNT: 4~~ + + +INSERT INTO babel_4888_t2 VALUES (NULL, '', 0x9999) +GO +~~ERROR (Code: 2627)~~ + +~~ERROR (Message: duplicate key value violates unique constraint "babel_4888_t2_id1_id2_key")~~ + + +INSERT INTO babel_4888_t2 VALUES (0, NULL, 0x9999) +GO +~~ERROR (Code: 2627)~~ + +~~ERROR (Message: duplicate key value violates unique constraint "babel_4888_t2_id1_id2_key")~~ + + +INSERT INTO babel_4888_t2 VALUES (NULL, NULL, NULL) +GO +~~ROW COUNT: 1~~ + + +INSERT INTO babel_4888_t2 VALUES (NULL, NULL, 0x9999) +GO +~~ERROR (Code: 2627)~~ + +~~ERROR (Message: duplicate key value violates unique constraint "babel_4888_t2_id1_id2_key")~~ + + + +-- table 3 id1 & id2 should be individually unique +INSERT INTO babel_4888_t3 VALUES (-1, '-a', 0x0001), (1, '+a', 0x1001), (NULL, '', NULL), (0, NULL, NULL) +GO +~~ERROR (Code: 515)~~ + +~~ERROR (Message: null value in column "id1" of relation "babel_4888_t3" violates not-null constraint)~~ + + +INSERT INTO babel_4888_t3 VALUES (NULL, '', 0x9999) +GO +~~ERROR (Code: 515)~~ + +~~ERROR (Message: null value in column "id1" of relation "babel_4888_t3" violates not-null constraint)~~ + + +INSERT INTO babel_4888_t3 VALUES (0, NULL, 0x9999) +GO +~~ROW COUNT: 1~~ + + +INSERT INTO babel_4888_t3 VALUES (NULL, NULL, NULL) +GO +~~ERROR (Code: 515)~~ + +~~ERROR (Message: null value in column "id1" of relation "babel_4888_t3" violates not-null constraint)~~ + + +INSERT INTO babel_4888_t3 VALUES (NULL, NULL, 0x9999) +GO +~~ERROR (Code: 515)~~ + +~~ERROR (Message: null value in column "id1" of relation "babel_4888_t3" violates not-null constraint)~~ + + + +-- table 4 Combination of id1 & id2 should be unique +INSERT INTO babel_4888_t4 VALUES (-1, '-a', 0x0001), (1, '+a', 0x1001), (NULL, '', NULL), (0, NULL, NULL) +GO +~~ERROR (Code: 515)~~ + +~~ERROR (Message: null value in column "id1" of relation "babel_4888_t4" violates not-null constraint)~~ + + +INSERT INTO babel_4888_t4 VALUES (NULL, '', 0x9999) +GO +~~ERROR (Code: 515)~~ + +~~ERROR (Message: null value in column "id1" of relation "babel_4888_t4" violates not-null constraint)~~ + + +INSERT INTO babel_4888_t4 VALUES (0, NULL, 0x9999) +GO +~~ERROR (Code: 515)~~ + +~~ERROR (Message: null value in column "id2" of relation "babel_4888_t4" violates not-null constraint)~~ + + +INSERT INTO babel_4888_t4 VALUES (NULL, NULL, NULL) +GO +~~ERROR (Code: 515)~~ + +~~ERROR (Message: null value in column "id1" of relation "babel_4888_t4" violates not-null constraint)~~ + + +INSERT INTO babel_4888_t4 VALUES (NULL, NULL, 0x9999) +GO +~~ERROR (Code: 515)~~ + +~~ERROR (Message: null value in column "id1" of relation "babel_4888_t4" violates not-null constraint)~~ + + +SELECT indexdef FROM pg_indexes +WHERE tablename LIKE '%babel_4888%' +ORDER BY indexdef +GO +~~START~~ +text +CREATE UNIQUE INDEX babel_4888_t1_id1_key ON master_dbo.babel_4888_t1 USING btree (id1 DESC NULLS LAST) NULLS NOT DISTINCT +CREATE UNIQUE INDEX babel_4888_t1_id2_key ON master_dbo.babel_4888_t1 USING btree (id2 NULLS FIRST) NULLS NOT DISTINCT +CREATE UNIQUE INDEX babel_4888_t2_id1_id2_key ON master_dbo.babel_4888_t2 USING btree (id1 NULLS FIRST, id2 DESC NULLS LAST) NULLS NOT DISTINCT +CREATE UNIQUE INDEX babel_4888_t3_id2_key ON master_dbo.babel_4888_t3 USING btree (id2 NULLS FIRST) NULLS NOT DISTINCT +CREATE UNIQUE INDEX babel_4888_t3_pkey ON master_dbo.babel_4888_t3 USING btree (id1 DESC NULLS LAST) +CREATE UNIQUE INDEX babel_4888_t4_pkey ON master_dbo.babel_4888_t4 USING btree (id1 NULLS FIRST, id2 DESC NULLS LAST) +~~END~~ + diff --git a/test/JDBC/expected/BABEL-5071-vu-cleanup.out b/test/JDBC/expected/BABEL-5071-vu-cleanup.out new file mode 100644 index 00000000000..937a89de8b6 --- /dev/null +++ b/test/JDBC/expected/BABEL-5071-vu-cleanup.out @@ -0,0 +1,15 @@ +drop trigger trig5071_1 +go + +drop table tab5071_1 +go + +DROP TRIGGER tab4992_1deleteOperation +GO + +DROP TABLE tab4992_1 +GO + +DROP TABLE tab4992_2 +GO + diff --git a/test/JDBC/expected/BABEL-5071-vu-prepare.out b/test/JDBC/expected/BABEL-5071-vu-prepare.out new file mode 100644 index 00000000000..70cc243b457 --- /dev/null +++ b/test/JDBC/expected/BABEL-5071-vu-prepare.out @@ -0,0 +1,35 @@ +create table tab5071_1 (a int) +go + +create trigger trig5071_1 on tab5071_1 for insert as begin +create table #temp_tst (a int) +insert #temp_tst select a*-1 from inserted; +select * from #temp_tst; +drop table #temp_tst +end +go + +CREATE TABLE tab4992_1 (c1 int, c2 int) +GO + +CREATE TABLE tab4992_2 (c1 int, c2 int) +GO + +INSERT INTO tab4992_1 VALUES(1, 2) +GO +~~ROW COUNT: 1~~ + + +CREATE TRIGGER tab4992_1deleteOperation on [dbo].[tab4992_1] +after delete AS +BEGIN + CREATE TABLE #tmp + ( + c1 INT PRIMARY KEY, + c2 INT, + c3 VARCHAR(64) NOT NULL DEFAULT '' + ) + INSERT INTO #tmp VALUES (1, 2, '') + INSERT INTO tab4992_2 SELECT c1,c2 FROM #tmp --> Crash +END +GO diff --git a/test/JDBC/expected/BABEL-5071-vu-verify.out b/test/JDBC/expected/BABEL-5071-vu-verify.out new file mode 100644 index 00000000000..cba06a6003a --- /dev/null +++ b/test/JDBC/expected/BABEL-5071-vu-verify.out @@ -0,0 +1,31 @@ + +-- Test case found in 5071 +insert tab5071_1 values (123) +go +~~ROW COUNT: 1~~ + +~~START~~ +int +-123 +~~END~~ + +~~ROW COUNT: 1~~ + + + +-- Test case found in 4992 +DELETE FROM tab4992_1 +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +SELECT * FROM tab4992_1 +GO +~~START~~ +int#!#int +~~END~~ + diff --git a/test/JDBC/expected/BABEL-942.out b/test/JDBC/expected/BABEL-942.out index f48d7d8cd0f..24ff0799feb 100644 --- a/test/JDBC/expected/BABEL-942.out +++ b/test/JDBC/expected/BABEL-942.out @@ -58,7 +58,7 @@ ELSE GO ~~START~~ int -0 +1 ~~END~~ if CAST(0x01 AS binary(1)) <= CAST(0x02 AS binary(1)) diff --git a/test/JDBC/expected/BABEL-CROSS-DB.out b/test/JDBC/expected/BABEL-CROSS-DB.out index 36c32036ab4..2dfe297e91c 100644 --- a/test/JDBC/expected/BABEL-CROSS-DB.out +++ b/test/JDBC/expected/BABEL-CROSS-DB.out @@ -541,6 +541,209 @@ GO DROP DATABASE db2; GO +-- BABEL-4934 Test blocking cross-db SELECT-INTO statement +CREATE DATABASE db_4934_1; +GO + +CREATE DATABASE db_4934_2; +GO + +USE master; +GO + +CREATE TABLE t1(a int); +GO + +CREATE TABLE t2(b int); +GO + +USE db_4934_1; +GO + +CREATE TABLE t1(a int); +GO + +CREATE TABLE t2(b int); +GO + +USE db_4934_2; +GO + +CREATE TABLE t1(a int); +GO + +CREATE TABLE t2(b int); +GO + +USE db_4934_1; +GO + +-- #4934.1 It should be blocked +SELECT * INTO t222 FROM master.dbo.t1; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cross-db 'SELECT INTO' statement is not supported in Babelfish. As a workaround, consider running CREATE TABLE and INSERT-SELECT statements.)~~ + + +SELECT * INTO t222 FROM master..t1; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cross-db 'SELECT INTO' statement is not supported in Babelfish. As a workaround, consider running CREATE TABLE and INSERT-SELECT statements.)~~ + + +SELECT * INTO t222 FROM db_4934_2..t1; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cross-db 'SELECT INTO' statement is not supported in Babelfish. As a workaround, consider running CREATE TABLE and INSERT-SELECT statements.)~~ + + +SELECT * INTO t222 FROM db_4934_2.dbo.t1; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cross-db 'SELECT INTO' statement is not supported in Babelfish. As a workaround, consider running CREATE TABLE and INSERT-SELECT statements.)~~ + + +SELECT * INTO t222 FROM db_4934_2..t1, t1; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cross-db 'SELECT INTO' statement is not supported in Babelfish. As a workaround, consider running CREATE TABLE and INSERT-SELECT statements.)~~ + + +SELECT * INTO t222 FROM t1, db_4934_1..t2; +GO + +SELECT * INTO t222 FROM master..t1, db_4934_2..t1; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cross-db 'SELECT INTO' statement is not supported in Babelfish. As a workaround, consider running CREATE TABLE and INSERT-SELECT statements.)~~ + + +SELECT * INTO t222 FROM (SELECT * FROM master..t1); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cross-db 'SELECT INTO' statement is not supported in Babelfish. As a workaround, consider running CREATE TABLE and INSERT-SELECT statements.)~~ + + +SELECT * INTO t222 FROM (SELECT * FROM t1, master..t1); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cross-db 'SELECT INTO' statement is not supported in Babelfish. As a workaround, consider running CREATE TABLE and INSERT-SELECT statements.)~~ + + +SELECT * INTO t222 FROM (SELECT *, (SELECT * FROM master..t1) FROM t1); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cross-db 'SELECT INTO' statement is not supported in Babelfish. As a workaround, consider running CREATE TABLE and INSERT-SELECT statements.)~~ + + +SELECT * INTO t222 FROM (SELECT *, (SELECT * FROM t1) FROM master..t3); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cross-db 'SELECT INTO' statement is not supported in Babelfish. As a workaround, consider running CREATE TABLE and INSERT-SELECT statements.)~~ + + +SELECT * INTO master..t222 FROM db_4934_2..t1; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cross-db 'SELECT INTO' statement is not supported in Babelfish. As a workaround, consider running CREATE TABLE and INSERT-SELECT statements.)~~ + + +SELECT * INTO db_4934_1..t222 FROM db_4934_2..t1; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cross-db 'SELECT INTO' statement is not supported in Babelfish. As a workaround, consider running CREATE TABLE and INSERT-SELECT statements.)~~ + + +SELECT * INTO master..t222 FROM master..t1; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cross-db 'SELECT INTO' statement is not supported in Babelfish. As a workaround, consider running CREATE TABLE and INSERT-SELECT statements.)~~ + + +-- #4934.2 Following statements will succeed across same database +SELECT * INTO t3 FROM db_4934_1.dbo.t1; +GO + +SELECT * INTO t4 FROM dbo.t1; +GO + +SELECT * INTO t5 FROM db_4934_1..t1; +GO + +SELECT * INTO t6 FROM db_4934_1..t1, db_4934_1..t2; +GO + +SELECT * INTO t7 FROM (SELECT * FROM db_4934_1..t1); +GO + +SELECT * INTO t8 FROM (SELECT *, (SELECT * FROM db_4934_1..t2) FROM db_4934_1..t1); +GO + +-- validate the access +SELECT * FROM t3, t4, t5, t6, t7, t8; +GO +~~START~~ +int#!#int#!#int#!#int#!#int#!#int#!#int#!#int +~~END~~ + + +DROP TABLE t3, t4, t5, t6, t7, t8; +GO + +-- #4934.3 Temporary table should not be blocked +SELECT * INTO #t1 FROM db_4934_1.dbo.t1; +GO + +SELECT * INTO #t2 FROM (SELECT * FROM db_4934_1.dbo.t1); +GO + +-- validate the access +SELECT * FROM #t1, #t2; +GO +~~START~~ +int#!#int +~~END~~ + + +DROP TABLE #t1, #t2; +GO + +-- Even though this is same as above statement, this will still fail since +-- internally it considers as cross-db statement (This behaviour is general to +-- all of the applicable DMLs) +SELECT * INTO tempdb..#t3 FROM db_4934_1.dbo.t1; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cross-db 'SELECT INTO' statement is not supported in Babelfish. As a workaround, consider running CREATE TABLE and INSERT-SELECT statements.)~~ + + + +USE master; +GO + +DROP TABLE t1, t2; +GO + +DROP DATABASE db_4934_1; +GO + +DROP DATABASE db_4934_2; +GO + -- psql ALTER SYSTEM SET babelfishpg_tsql.migration_mode = 'single-db'; SELECT pg_reload_conf(); diff --git a/test/JDBC/expected/BABEL-GRANT.out b/test/JDBC/expected/BABEL-GRANT.out index 2a59cf3dead..1e216428472 100644 --- a/test/JDBC/expected/BABEL-GRANT.out +++ b/test/JDBC/expected/BABEL-GRANT.out @@ -220,14 +220,14 @@ GRANT SELECT ON table::t1 TO guest; -- unsupported object GO ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: 'GRANT ON TABLE' is not currently supported in Babelfish)~~ +~~ERROR (Message: syntax error near 'table' at line 1 and character position 16)~~ REVOKE SELECT ON table::t1 FROM guest; -- unsupported object GO ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: 'REVOKE ON TABLE' is not currently supported in Babelfish)~~ +~~ERROR (Message: syntax error near 'table' at line 1 and character position 17)~~ GRANT ALL ON OBJECT::t1 TO guest WITH GRANT OPTION AS superuser; @@ -257,6 +257,519 @@ GO +--- +--- Check for supported and unsupported GRANT syntax +--- +GRANT EXECUTE ON APPLICATION ROLE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON APPLICATIONROLE' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON ASSEMBLY::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON ASSEMBLY' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON ASYMMETRIC KEY::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON ASYMMETRICKEY' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON AVAILABILITY GROUP::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON AVAILABILITYGROUP' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON CERTIFICATE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON CERTIFICATE' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON CONTRACT::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON CONTRACT' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON DATABASE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON DATABASE' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON DATABASE SCOPED CREDENTIAL::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON DATABASESCOPEDCREDENTIAL' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON ENDPOINT::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON ENDPOINT' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON FULLTEXT CATALOG::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON FULLTEXTCATALOG' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON FULLTEXT STOPLIST::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON FULLTEXTSTOPLIST' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON LOGIN::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON LOGIN' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON MESSAGE TYPE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON MESSAGETYPE' is not currently supported in Babelfish)~~ + + +GRANT SELECT ON OBJECT::t1 TO public; +GO + +GRANT EXECUTE ON REMOTE SERVICE BINDING::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON REMOTESERVICEBINDING' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON ROLE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON ROLE' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON ROUTE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON ROUTE' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON SCHEMA::scm TO public; +GO + +GRANT EXECUTE ON SEARCH PROPERTY LIST::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON SEARCHPROPERTYLIST' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON SERVER ROLE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON SERVERROLE' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON SERVICE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON SERVICE' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON SYMMETRIC KEY::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON SYMMETRICKEY' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON TYPE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON TYPE' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON USER::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'GRANT ON USER' is not currently supported in Babelfish)~~ + + +GRANT EXECUTE ON XML SCHEMA COLLECTION::scm TO public; +GO + + +--- +--- Check for supported and unsupported REVOKE syntax +--- +REVOKE EXECUTE ON APPLICATION ROLE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON APPLICATIONROLE' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON ASSEMBLY::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON ASSEMBLY' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON ASYMMETRIC KEY::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON ASYMMETRICKEY' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON AVAILABILITY GROUP::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON AVAILABILITYGROUP' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON CERTIFICATE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON CERTIFICATE' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON CONTRACT::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON CONTRACT' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON DATABASE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON DATABASE' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON DATABASE SCOPED CREDENTIAL::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON DATABASESCOPEDCREDENTIAL' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON ENDPOINT::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON ENDPOINT' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON FULLTEXT CATALOG::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON FULLTEXTCATALOG' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON FULLTEXT STOPLIST::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON FULLTEXTSTOPLIST' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON LOGIN::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON LOGIN' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON MESSAGE TYPE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON MESSAGETYPE' is not currently supported in Babelfish)~~ + + +REVOKE SELECT ON OBJECT::t1 TO public; +GO + +REVOKE EXECUTE ON REMOTE SERVICE BINDING::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON REMOTESERVICEBINDING' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON ROLE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON ROLE' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON ROUTE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON ROUTE' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON SCHEMA::scm TO public; +GO + +REVOKE EXECUTE ON SEARCH PROPERTY LIST::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON SEARCHPROPERTYLIST' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON SERVER ROLE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON SERVERROLE' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON SERVICE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON SERVICE' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON SYMMETRIC KEY::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON SYMMETRICKEY' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON TYPE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON TYPE' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON USER::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'REVOKE ON USER' is not currently supported in Babelfish)~~ + + +REVOKE EXECUTE ON XML SCHEMA COLLECTION::scm TO public; +GO + + +--- +--- Check for supported and unsupported DENY syntax +--- +DENY EXECUTE ON APPLICATION ROLE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON ASSEMBLY::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON ASYMMETRIC KEY::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON AVAILABILITY GROUP::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON CERTIFICATE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON CONTRACT::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON DATABASE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON DATABASE SCOPED CREDENTIAL::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON ENDPOINT::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON FULLTEXT CATALOG::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON FULLTEXT STOPLIST::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON LOGIN::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON MESSAGE TYPE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY SELECT ON OBJECT::t1 TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON REMOTE SERVICE BINDING::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON ROLE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON ROUTE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON SCHEMA::scm TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON SEARCH PROPERTY LIST::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON SERVER ROLE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON SERVICE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON SYMMETRIC KEY::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON TYPE::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON USER::test TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + +DENY EXECUTE ON XML SCHEMA COLLECTION::scm TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DENY' is not currently supported in Babelfish)~~ + + + --- --- Clean Up --- diff --git a/test/JDBC/expected/BABEL-LOGIN-USER-EXT.out b/test/JDBC/expected/BABEL-LOGIN-USER-EXT.out index ff48fb129f9..78b174aca3a 100644 --- a/test/JDBC/expected/BABEL-LOGIN-USER-EXT.out +++ b/test/JDBC/expected/BABEL-LOGIN-USER-EXT.out @@ -1399,3 +1399,148 @@ void ~~END~~ + +-- tsql +CREATE DATABASE babel_4935_db +GO + +USE babel_4935_db +GO + +-- Login that is member sysadmin +CREATE LOGIN babel_4935_sysadmin WITH PASSWORD = '123' +GO + +ALTER ROLE sysadmin ADD MEMBER babel_4935_sysadmin +GO + +-- Logins that are not a member of sysadmin but have users associated +CREATE LOGIN babel_4935_no_sysadmin1 WITH PASSWORD = '123' +CREATE LOGIN babel_4935_no_sysadmin2 WITH PASSWORD = '123' +GO + +CREATE USER babel_4935_no_sysadmin1 +CREATE USER babel_4935_no_sysadmin2 +GO + +-- Login that is not a member of sysadmin and has no user associated +CREATE LOGIN babel_4935_guest WITH PASSWORD = '123' +GO + +GRANT CONNECT TO guest +GO + +-- jdbc_user is superuser so should see all the users +SELECT name FROM sys.database_principals ORDER BY name +GO +~~START~~ +varchar +babel_4935_no_sysadmin1 +babel_4935_no_sysadmin2 +db_owner +dbo +guest +INFORMATION_SCHEMA +public +sys +~~END~~ + + +-- tsql user=babel_4935_sysadmin password=123 database=babel_4935_db +-- login is member of sysadmin so should see all the users +SELECT name FROM sys.database_principals ORDER BY name +GO +~~START~~ +varchar +babel_4935_no_sysadmin1 +babel_4935_no_sysadmin2 +db_owner +dbo +guest +INFORMATION_SCHEMA +public +sys +~~END~~ + + +-- tsql user=babel_4935_no_sysadmin1 password=123 database=babel_4935_db +-- login is not member of sysadmin so should see all the system users and only it's own user +SELECT name FROM sys.database_principals ORDER BY name +GO +~~START~~ +varchar +babel_4935_no_sysadmin1 +db_owner +dbo +guest +INFORMATION_SCHEMA +public +sys +~~END~~ + + +-- tsql user=babel_4935_guest password=123 database=babel_4935_db +-- login is not member of sysadmin and no user associated so should only see system users +SELECT name FROM sys.database_principals ORDER BY name +GO +~~START~~ +varchar +db_owner +dbo +guest +INFORMATION_SCHEMA +public +sys +~~END~~ + + +-- psql +-- Need to terminate active session before cleaning up the login +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'babel_4935_sysadmin' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +GO +~~START~~ +bool +t +~~END~~ + + +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'babel_4935_no_sysadmin1' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +GO +~~START~~ +bool +t +~~END~~ + + +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'babel_4935_guest' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +GO +~~START~~ +bool +t +~~END~~ + + +-- Wait to sync with another session +SELECT pg_sleep(1); +GO +~~START~~ +void + +~~END~~ + + +-- tsql +USE master +GO + +DROP DATABASE babel_4935_db +GO + +DROP LOGIN babel_4935_sysadmin +DROP LOGIN babel_4935_no_sysadmin1 +DROP LOGIN babel_4935_no_sysadmin2 +DROP LOGIN babel_4935_guest +GO diff --git a/test/JDBC/expected/BABEL-ROLE-MEMBER-vu-verify.out b/test/JDBC/expected/BABEL-ROLE-MEMBER-vu-verify.out index 3d55340c26e..140c76a56ec 100644 --- a/test/JDBC/expected/BABEL-ROLE-MEMBER-vu-verify.out +++ b/test/JDBC/expected/BABEL-ROLE-MEMBER-vu-verify.out @@ -262,12 +262,12 @@ int ~~END~~ --- Given role name is not a real role, should return NULL +-- Given name is a real user but not associated with login, should return 0 SELECT IS_MEMBER('BABEL_ROLE_MEMBER_vu_prepare_user1') GO ~~START~~ int - +0 ~~END~~ SELECT IS_ROLEMEMBER('BABEL_ROLE_MEMBER_vu_prepare_user1') diff --git a/test/JDBC/expected/BABEL-ROLE-MEMBER.out b/test/JDBC/expected/BABEL-ROLE-MEMBER.out index 57f7c3c47e9..b1a1a06467c 100644 --- a/test/JDBC/expected/BABEL-ROLE-MEMBER.out +++ b/test/JDBC/expected/BABEL-ROLE-MEMBER.out @@ -49,6 +49,13 @@ GO CREATE USER test_user3 FOR LOGIN test_login3 GO +-- check for roles with name > 64 characters +CREATE ROLE thisroleisaveryuniquerolewhereitsnamelengthisveryveryverylongandspansonehundredandelevencharacterswhichis__111 +GO + +CREATE ROLE thisroleisaveryuniquerolewhereitsnamelengthisveryveryverylongandspansonehundredandelevencharacterswhichis__111_dup +GO + -- role1 -> role2 -> role3 -> role4 ALTER ROLE test_role1 ADD MEMBER test_role2 GO @@ -66,6 +73,9 @@ GO ALTER ROLE test_role3 ADD MEMBER test_user3 GO +ALTER ROLE thisroleisaveryuniquerolewhereitsnamelengthisveryveryverylongandspansonehundredandelevencharacterswhichis__111 ADD MEMBER test_user3 +GO + -- Print the current membership status EXEC babel_role_members GO @@ -78,6 +88,7 @@ test_role2#!#R#!#test_role3#!#R test_role2#!#R#!#test_user2#!#S test_role3#!#R#!#test_role4#!#R test_role3#!#R#!#test_user3#!#S +thisroleisaveryuniquerolewhereitsnamelengthisveryveryverylongandspansonehundredandelevencharacterswhichis__111#!#R#!#test_user3#!#S ~~END~~ @@ -204,6 +215,32 @@ int ~~END~~ +-- Return NULL for server roles other than public +SELECT IS_MEMBER('sysadmin') +GO +~~START~~ +int + +~~END~~ + + +-- Return NULL for SQL logins and users +SELECT IS_MEMBER('test_login1') +GO +~~START~~ +int + +~~END~~ + + +SELECT IS_MEMBER('test_user1') +GO +~~START~~ +int +0 +~~END~~ + + -- Should return 0 SELECT IS_ROLEMEMBER('db_owner', 'test_role1') GO @@ -269,7 +306,7 @@ SELECT IS_MEMBER('test_user1') GO ~~START~~ int - +0 ~~END~~ SELECT IS_ROLEMEMBER('test_user1') @@ -550,6 +587,13 @@ int 1 ~~END~~ +SELECT IS_MEMBER('thisroleisaveryuniquerolewhereitsnamelengthisveryveryverylongandspansonehundredandelevencharacterswhichis__111') +GO +~~START~~ +int +1 +~~END~~ + -- Should return 0 SELECT IS_MEMBER('test_role4') @@ -559,6 +603,13 @@ int 0 ~~END~~ +SELECT IS_MEMBER('thisroleisaveryuniquerolewhereitsnamelengthisveryveryverylongandspansonehundredandelevencharacterswhichis__111_dup') +GO +~~START~~ +int +0 +~~END~~ + -- Doesn't have permission, should return NULL SELECT IS_ROLEMEMBER('test_role3', 'test_role4') @@ -615,6 +666,10 @@ DROP ROLE test_role2 GO DROP ROLE test_role1 GO +DROP ROLE thisroleisaveryuniquerolewhereitsnamelengthisveryveryverylongandspansonehundredandelevencharacterswhichis__111 +GO +DROP ROLE thisroleisaveryuniquerolewhereitsnamelengthisveryveryverylongandspansonehundredandelevencharacterswhichis__111_dup +GO -- psql -- Need to terminate active session before cleaning up the login diff --git a/test/JDBC/expected/BABEL-UNSUPPORTED.out b/test/JDBC/expected/BABEL-UNSUPPORTED.out index 760c26510ec..7148ee8a041 100644 --- a/test/JDBC/expected/BABEL-UNSUPPORTED.out +++ b/test/JDBC/expected/BABEL-UNSUPPORTED.out @@ -437,13 +437,6 @@ ignore -- escape hatch: storage_on_partition. -- 'strict' is default -CREATE TABLE t_unsupported_sop1(a int) ON partition(a); -GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: 'partition scheme' is not currently supported in Babelfish. please use babelfishpg_tsql.escape_hatch_storage_on_partition to ignore)~~ - - CREATE TABLE t_unsupported_sop2(a int) FILESTREAM_ON partition(a); GO ~~ERROR (Code: 33557097)~~ @@ -459,11 +452,6 @@ ignore ~~END~~ -CREATE TABLE t_unsupported_sop1(a int) ON partition(a); -GO -DROP TABLE t_unsupported_sop1; -GO - CREATE TABLE t_unsupported_sop2(a int) FILESTREAM_ON partition(a); GO DROP TABLE t_unsupported_sop2 @@ -2370,13 +2358,6 @@ GO -- test automatically generated message for unsupported DDL -CREATE PARTITION FUNCTION f_unsupported_1(datetime) AS RANGE RIGHT FOR VALUES (N'2017-07-11T00:00:00.000', N'2017-07-12T00:00:00.000', N'2017-07-13T00:00:00.000'); -GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: 'CREATE PARTITION FUNCTION' is not currently supported in Babelfish)~~ - - ALTER AUTHORIZATION ON a1 TO SCHEMA OWNER; GO ~~ERROR (Code: 33557097)~~ diff --git a/test/JDBC/expected/BABEL_3571-vu-verify.out b/test/JDBC/expected/BABEL_3571-vu-verify.out index 622b9115bf7..143cbb4df86 100644 --- a/test/JDBC/expected/BABEL_3571-vu-verify.out +++ b/test/JDBC/expected/BABEL_3571-vu-verify.out @@ -96,9 +96,9 @@ ORDER BY indexdef GO ~~START~~ text -CREATE UNIQUE INDEX babel_3571_1_id1_key ON master_dbo.babel_3571_1 USING btree (id1) NULLS NOT DISTINCT -CREATE UNIQUE INDEX babel_3571_1_id2_key ON master_dbo.babel_3571_1 USING btree (id2) NULLS NOT DISTINCT -CREATE UNIQUE INDEX babel_3571_2_id1_id2_key ON master_dbo.babel_3571_2 USING btree (id1, id2) NULLS NOT DISTINCT +CREATE UNIQUE INDEX babel_3571_1_id1_key ON master_dbo.babel_3571_1 USING btree (id1 NULLS FIRST) NULLS NOT DISTINCT +CREATE UNIQUE INDEX babel_3571_1_id2_key ON master_dbo.babel_3571_1 USING btree (id2 NULLS FIRST) NULLS NOT DISTINCT +CREATE UNIQUE INDEX babel_3571_2_id1_id2_key ON master_dbo.babel_3571_2 USING btree (id1 NULLS FIRST, id2 NULLS FIRST) NULLS NOT DISTINCT CREATE UNIQUE INDEX babel_3571_3_unique_idxbabel_35df79da2a42216884edca5a4a798829ce ON master_dbo.babel_3571_3 USING btree (id1 NULLS FIRST, id2 NULLS FIRST) NULLS NOT DISTINCT ~~END~~ diff --git a/test/JDBC/expected/BABEL_4330-before-15_8-or-16_4-vu-prepare.out b/test/JDBC/expected/BABEL_4330-before-15_8-or-16_4-vu-prepare.out new file mode 100644 index 00000000000..185775d5f55 --- /dev/null +++ b/test/JDBC/expected/BABEL_4330-before-15_8-or-16_4-vu-prepare.out @@ -0,0 +1,19 @@ + +CREATE TABLE babel_4330_vu_prepare_t1(a varchar(50) NULL); +GO + +INSERT INTO babel_4330_vu_prepare_t1 VALUES('ababa'); +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_4330_vu_prepare_v1 AS +SELECT replace(a, 'a', 'c') FROM babel_4330_vu_prepare_t1 +GO + +CREATE FUNCTION babel_4330_vu_prepare_f1() returns table as return +SELECT replace(a, 'a', 'c') FROM babel_4330_vu_prepare_t1 +GO + +CREATE PROCEDURE babel_4330_vu_prepare_p1 AS SELECT replace(a, 'a', 'c') FROM babel_4330_vu_prepare_t1 +GO diff --git a/test/JDBC/expected/BABEL_4330-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/BABEL_4330-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..939fa04ec0e --- /dev/null +++ b/test/JDBC/expected/BABEL_4330-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,45 @@ +SELECT replace(a, 'a', 'c') FROM babel_4330_vu_prepare_t1; +go +~~START~~ +varchar +cbcbc +~~END~~ + + +SELECT * FROM babel_4330_vu_prepare_v1; +go +~~START~~ +text +cbcbc +~~END~~ + + + +SELECT * FROM babel_4330_vu_prepare_f1(); +go +~~START~~ +text +cbcbc +~~END~~ + + +EXEC babel_4330_vu_prepare_p1; +GO +~~START~~ +varchar +cbcbc +~~END~~ + + + +DROP PROCEDURE babel_4330_vu_prepare_p1; +GO + +DROP FUNCTION babel_4330_vu_prepare_f1; +GO + +DROP VIEW babel_4330_vu_prepare_v1; +GO + +DROP TABLE babel_4330_vu_prepare_t1; +GO diff --git a/test/JDBC/expected/BABEL_4330-vu-verify.out b/test/JDBC/expected/BABEL_4330-vu-verify.out index f800e74998a..8acac02a736 100644 --- a/test/JDBC/expected/BABEL_4330-vu-verify.out +++ b/test/JDBC/expected/BABEL_4330-vu-verify.out @@ -1,7 +1,7 @@ SELECT replace(a, 'a', 'c') FROM babel_4330_vu_prepare_t1; go ~~START~~ -text +varchar cbcbc ~~END~~ @@ -9,7 +9,7 @@ cbcbc SELECT * FROM babel_4330_vu_prepare_v1; go ~~START~~ -text +varchar cbcbc ~~END~~ @@ -18,7 +18,7 @@ cbcbc SELECT * FROM babel_4330_vu_prepare_f1(); go ~~START~~ -text +varchar cbcbc ~~END~~ @@ -26,7 +26,7 @@ cbcbc EXEC babel_4330_vu_prepare_p1; GO ~~START~~ -text +varchar cbcbc ~~END~~ diff --git a/test/JDBC/expected/BABEL_4330.out b/test/JDBC/expected/BABEL_4330.out index 184baaa2411..c05a9494eb4 100644 --- a/test/JDBC/expected/BABEL_4330.out +++ b/test/JDBC/expected/BABEL_4330.out @@ -11,7 +11,7 @@ GO SELECT * FROM babel_4330_t1 GO ~~START~~ -varchar#!#text +varchar#!#varchar 13131#!#23232 ~~END~~ @@ -24,7 +24,7 @@ GO SELECT * FROM babel_4330_t1 GO ~~START~~ -varchar#!#text +varchar#!#varchar 14141#!#24242 ~~END~~ @@ -35,7 +35,7 @@ GO SELECT * FROM babel_4330_t1 GO ~~START~~ -varchar#!#text#!#text +varchar#!#varchar#!#varchar 14141#!#24242#!#54545 ~~END~~ @@ -52,7 +52,7 @@ GO SELECT * FROM babel_4330_t2 GO ~~START~~ -varchar#!#text +varchar#!#varchar 13131#!# ~~END~~ @@ -68,7 +68,7 @@ GO SELECT * FROM babel_4330_t3 GO ~~START~~ -varchar#!#text +varchar#!#varchar 13131#!# ~~END~~ diff --git a/test/JDBC/expected/BABEL_4982.out b/test/JDBC/expected/BABEL_4982.out new file mode 100644 index 00000000000..653f527a48b --- /dev/null +++ b/test/JDBC/expected/BABEL_4982.out @@ -0,0 +1,95 @@ +-- psql +CREATE SCHEMA s1 +GO + +CREATE TABLE s1.babel_4982_t (id VARCHAR(100)) +GO + + + +CREATE FUNCTION babel_4982_ddl_trigger() +RETURNS event_trigger AS +$$ +BEGIN +INSERT INTO babel_4982_t VALUES (current_setting('search_path')); +END; +$$ +SECURITY DEFINER +SET search_path = s1, pg_catalog, pg_temp +LANGUAGE plpgsql; +CREATE EVENT TRIGGER babel_4982_ddl_trigger + ON ddl_command_end + EXECUTE PROCEDURE babel_4982_ddl_trigger(); +SELECT set_config('search_path', 'master_dbo, sys, '||current_setting('search_path'), false); +GO +~~START~~ +text +master_dbo, sys, "$user", public +~~END~~ + + +SHOW search_path +GO +~~START~~ +text +master_dbo, sys, "$user", public +~~END~~ + + +CREATE TABLE babel_4982_t2 (id INT) +GO + +SHOW search_path +GO +~~START~~ +text +master_dbo, sys, "$user", public +~~END~~ + + +BEGIN +GO + +SHOW search_path +GO +~~START~~ +text +master_dbo, sys, "$user", public +~~END~~ + + +DROP TABLE babel_4982_t2 +GO + +SHOW search_path +GO +~~START~~ +text +master_dbo, sys, "$user", public +~~END~~ + + +COMMIT +GO + +-- two entries since two DDLs after trigger was created +SELECT * FROM s1.babel_4982_t +GO +~~START~~ +varchar +s1, pg_catalog, pg_temp +s1, pg_catalog, pg_temp +~~END~~ + + +DROP EVENT TRIGGER babel_4982_ddl_trigger +GO + +DROP FUNCTION babel_4982_ddl_trigger +GO + +DROP TABLE s1.babel_4982_t +GO + +DROP SCHEMA s1 +GO diff --git a/test/JDBC/expected/BABEL_OBJECT_DEFINITION-vu-verify.out b/test/JDBC/expected/BABEL_OBJECT_DEFINITION-vu-verify.out index 3ece58968d5..b3b7509ef1e 100644 --- a/test/JDBC/expected/BABEL_OBJECT_DEFINITION-vu-verify.out +++ b/test/JDBC/expected/BABEL_OBJECT_DEFINITION-vu-verify.out @@ -74,13 +74,11 @@ CREATE FUNCTION object_definition_fc1(@fc1_a nvarchar) RETURNS nvarchar AS BEGIN -- DML trigger --- TODO: After BABEL-3927 is fixed, we get the correct trigger definition. --- Now, it shows NULL. SELECT OBJECT_DEFINITION(OBJECT_ID('object_definition_tr1')) GO ~~START~~ nvarchar - +CREATE TRIGGER object_definition_tr1 ON object_definition_t1 INSTEAD OF INSERTASBEGINSELECT * FROM object_definition_t1;END ~~END~~ diff --git a/test/JDBC/expected/GRANT_SCHEMA.out b/test/JDBC/expected/GRANT_SCHEMA.out index 227e258f607..2fc1148d1be 100644 --- a/test/JDBC/expected/GRANT_SCHEMA.out +++ b/test/JDBC/expected/GRANT_SCHEMA.out @@ -4639,3 +4639,19 @@ go "sys"."varchar"#!#"sys"."varchar"#!#int4#!#"sys"."varchar" ~~END~~ + +-- tsql +-- should properly throw an error when schema does not exist +GRANT SELECT on doesnt_exist.tbl TO public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: schema "master_doesnt_exist" does not exist)~~ + + +grant execute on xyz.babel_4344_p to public; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: schema "master_xyz" does not exist)~~ + diff --git a/test/JDBC/expected/ISC-Check-Constraints-vu-verify.out b/test/JDBC/expected/ISC-Check-Constraints-vu-verify.out index 7539b8e54d9..67bd93d647c 100644 --- a/test/JDBC/expected/ISC-Check-Constraints-vu-verify.out +++ b/test/JDBC/expected/ISC-Check-Constraints-vu-verify.out @@ -74,7 +74,7 @@ isc_check_constraints_db1#!#dbo#!#test_tsql_const_c_varbinary_check#!#((c_varbin isc_check_constraints_db1#!#dbo#!#test_udd_c_udd_check#!#((c_udd < 133.230182309832423)) isc_check_constraints_db1#!#dbo#!#test_udd_c_udd1_check#!#((c_udd1 < '2020-10-20 09:00:00')) isc_check_constraints_db1#!#dbo#!#test_udd_c_udd2_check#!#((c_udd2 < '09:00:00')) -isc_check_constraints_db1#!#dbo#!#test_upper_a_check#!#((upper(a) IN ('A', 'B'))) +isc_check_constraints_db1#!#dbo#!#test_upper_a_check#!#((sys.upper(a) IN ('A', 'B'))) ~~END~~ diff --git a/test/JDBC/expected/ISC-Tables-before_16_4_or_15_8_or_14_13-vu-cleanup.out b/test/JDBC/expected/ISC-Tables-before_16_4_or_15_8_or_14_13-vu-cleanup.out new file mode 100644 index 00000000000..b2a1c38e3d1 --- /dev/null +++ b/test/JDBC/expected/ISC-Tables-before_16_4_or_15_8_or_14_13-vu-cleanup.out @@ -0,0 +1,28 @@ +DROP TABLE isc_tables_sc1.t2 +DROP TABLE [ISC_TABLES_TABLE_SCHEMA].[ISC_TABLES_TABLE] +DROP TABLE [ISC_TABLES SCHEMA . WITH .. DOTS].[ISC_TABLES TABLE . WITH .. DOTS2] +GO + +DROP TYPE isc_tables_sc1.isc_table_type2 +GO + +DROP SCHEMA isc_tables_sc1 +DROP SCHEMA [ISC_TABLES_TABLE_SCHEMA] +DROP SCHEMA [ISC_TABLES SCHEMA . WITH .. DOTS] +GO + +DROP VIEW isc_tables_vu_prepare_v1 +GO + +DROP FUNCTION isc_tables_vu_prepare_f2 +DROP FUNCTION isc_tables_vu_prepare_f1 +GO + +DROP PROCEDURE isc_tables_vu_prepare_p1 +GO + +DROP TABLE isc_tables_vu_prepare_t1 +GO + +DROP TYPE isc_table_type1 +GO diff --git a/test/JDBC/expected/ISC-Tables-before_16_4_or_15_8_or_14_13-vu-prepare.out b/test/JDBC/expected/ISC-Tables-before_16_4_or_15_8_or_14_13-vu-prepare.out new file mode 100644 index 00000000000..806a0e3c9d7 --- /dev/null +++ b/test/JDBC/expected/ISC-Tables-before_16_4_or_15_8_or_14_13-vu-prepare.out @@ -0,0 +1,56 @@ +CREATE TABLE isc_tables_vu_prepare_t1(a INT,b INT) +GO + +CREATE TYPE isc_table_type1 AS TABLE(a INT) +GO + +-- test different schema +CREATE SCHEMA isc_tables_sc1 +GO + +CREATE SCHEMA [ISC_TABLES_TABLE_SCHEMA] +GO + +CREATE SCHEMA [ISC_TABLES SCHEMA . WITH .. DOTS] +GO + +CREATE TABLE isc_tables_sc1.t2(a INT,b INT) +GO + +-- Table name which is prefix of schema name +CREATE TABLE [ISC_TABLES_TABLE_SCHEMA] . [ISC_TABLES_TABLE] (a INT, b INT) +GO + +CREATE TABLE [ISC_TABLES SCHEMA . WITH .. DOTS] . [ISC_TABLES TABLE . WITH .. DOTS] (a INT, b INT) +GO + +CREATE TYPE isc_tables_sc1.isc_table_type2 AS TABLE(a INT) +GO + +--Dep Proc +CREATE PROCEDURE isc_tables_vu_prepare_p1 AS +SELECT * FROM information_schema.tables WHERE TABLE_NAME = 'isc_tables_vu_prepare_t1' +SELECT * FROM information_schema.tables WHERE TABLE_NAME = 'ISC_TABLES_VU_PREPARE_T1' +GO + +-- Dep Funcs +CREATE FUNCTION isc_tables_vu_prepare_f1() +RETURNS INT +AS +BEGIN + RETURN (SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_NAME LIKE 'isc_tables%') +end +GO + +CREATE FUNCTION isc_tables_vu_prepare_f2() +RETURNS INT +AS +BEGIN + RETURN (SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_NAME LIKE 'ISC_TABLES%') +end +GO + +-- Dep View +CREATE VIEW isc_tables_vu_prepare_v1 AS + SELECT * FROM information_schema.tables WHERE TABLE_NAME LIKE 'ISC_TABLES%' ORDER BY TABLE_NAME +GO diff --git a/test/JDBC/expected/ISC-Tables-before_16_4_or_15_8_or_14_13-vu-verify.out b/test/JDBC/expected/ISC-Tables-before_16_4_or_15_8_or_14_13-vu-verify.out new file mode 100644 index 00000000000..6e72ed8e0fa --- /dev/null +++ b/test/JDBC/expected/ISC-Tables-before_16_4_or_15_8_or_14_13-vu-verify.out @@ -0,0 +1,125 @@ +SELECT * FROM information_schema.tables WHERE TABLE_NAME LIKE 'ISC_TABLES%' ORDER BY TABLE_NAME +GO +~~START~~ +nvarchar#!#nvarchar#!#varchar#!#varchar +master#!#ISC_TABLES SCHEMA . WITH .. DOTS#!#isc_tables table . with .. dots#!#BASE TABLE +master#!#ISC_TABLES_TABLE_SCHEMA#!#ISC_TABLES_TABLE_SCHEMA#!#BASE TABLE +master#!#dbo#!#isc_tables_vu_prepare_t1#!#BASE TABLE +master#!#dbo#!#isc_tables_vu_prepare_v1#!#VIEW +~~END~~ + + +-- Rename the existing tables to fix the originally stored incorrect bbf_original_rel_name +EXEC sp_rename 'ISC_TABLES_TABLE_SCHEMA.ISC_TABLES_TABLE', 'ISC_TABLES_TABLE2', 'OBJECT' +GO + +EXEC sp_rename '"ISC_TABLES SCHEMA . WITH .. DOTS"."ISC_TABLES TABLE . WITH .. DOTS"', 'ISC_TABLES TABLE . WITH .. DOTS2', 'OBJECT' +GO + +-- create a new table with name which is prefix of schema name to verify new behavior +CREATE TABLE [ISC_TABLES_TABLE_SCHEMA] . [ISC_TABLES_TABLE] (a INT, b INT) +GO + +SELECT * FROM information_schema.tables WHERE TABLE_NAME LIKE 'isc_tables%' ORDER BY TABLE_NAME +SELECT * FROM information_schema.tables WHERE TABLE_NAME LIKE 'ISC_TABLES%' ORDER BY TABLE_NAME +GO +~~START~~ +nvarchar#!#nvarchar#!#varchar#!#varchar +master#!#ISC_TABLES SCHEMA . WITH .. DOTS#!#ISC_TABLES TABLE . WITH .. DOTS2#!#BASE TABLE +master#!#ISC_TABLES_TABLE_SCHEMA#!#ISC_TABLES_TABLE#!#BASE TABLE +master#!#ISC_TABLES_TABLE_SCHEMA#!#ISC_TABLES_TABLE2#!#BASE TABLE +master#!#dbo#!#isc_tables_vu_prepare_t1#!#BASE TABLE +master#!#dbo#!#isc_tables_vu_prepare_v1#!#VIEW +~~END~~ + +~~START~~ +nvarchar#!#nvarchar#!#varchar#!#varchar +master#!#ISC_TABLES SCHEMA . WITH .. DOTS#!#ISC_TABLES TABLE . WITH .. DOTS2#!#BASE TABLE +master#!#ISC_TABLES_TABLE_SCHEMA#!#ISC_TABLES_TABLE#!#BASE TABLE +master#!#ISC_TABLES_TABLE_SCHEMA#!#ISC_TABLES_TABLE2#!#BASE TABLE +master#!#dbo#!#isc_tables_vu_prepare_t1#!#BASE TABLE +master#!#dbo#!#isc_tables_vu_prepare_v1#!#VIEW +~~END~~ + + +-- Table types should not be a result +-- Should not return any rows. +SELECT * FROM information_schema.tables WHERE TABLE_NAME = 'isc_table_type1' +GO +~~START~~ +nvarchar#!#nvarchar#!#varchar#!#varchar +~~END~~ + + +SELECT * FROM information_schema.tables WHERE TABLE_SCHEMA = 'isc_tables_sc1' +SELECT * FROM information_schema.tables WHERE TABLE_SCHEMA = 'ISC_TABLES_SC1' +GO +~~START~~ +nvarchar#!#nvarchar#!#varchar#!#varchar +master#!#isc_tables_sc1#!#t2#!#BASE TABLE +~~END~~ + +~~START~~ +nvarchar#!#nvarchar#!#varchar#!#varchar +master#!#isc_tables_sc1#!#t2#!#BASE TABLE +~~END~~ + + +-- Table types should not be a result +-- Should not return any rows. +SELECT * FROM information_schema.tables WHERE (TABLE_NAME = 'isc_table_type2' AND TABLE_SCHEMA = 'isc_tables_sc1') +GO +~~START~~ +nvarchar#!#nvarchar#!#varchar#!#varchar +~~END~~ + + +EXEC isc_tables_vu_prepare_p1 +GO +~~START~~ +nvarchar#!#nvarchar#!#varchar#!#varchar +master#!#dbo#!#isc_tables_vu_prepare_t1#!#BASE TABLE +~~END~~ + +~~START~~ +nvarchar#!#nvarchar#!#varchar#!#varchar +master#!#dbo#!#isc_tables_vu_prepare_t1#!#BASE TABLE +~~END~~ + + +SELECT * FROM isc_tables_vu_prepare_f1() +SELECT * FROM isc_tables_vu_prepare_f2() +GO +~~START~~ +int +5 +~~END~~ + +~~START~~ +int +5 +~~END~~ + + +-- Drop and re-create isc_tables_vu_prepare_v1 as it might be dependent upon +-- the deprecated version of information_schema.tables view. +DROP VIEW isc_tables_vu_prepare_v1 +GO +CREATE VIEW isc_tables_vu_prepare_v1 AS + SELECT * FROM information_schema.tables WHERE TABLE_NAME LIKE 'ISC_TABLES%' ORDER BY TABLE_NAME +GO + +SELECT * FROM isc_tables_vu_prepare_v1 +GO +~~START~~ +nvarchar#!#nvarchar#!#varchar#!#varchar +master#!#ISC_TABLES SCHEMA . WITH .. DOTS#!#ISC_TABLES TABLE . WITH .. DOTS2#!#BASE TABLE +master#!#ISC_TABLES_TABLE_SCHEMA#!#ISC_TABLES_TABLE#!#BASE TABLE +master#!#ISC_TABLES_TABLE_SCHEMA#!#ISC_TABLES_TABLE2#!#BASE TABLE +master#!#dbo#!#isc_tables_vu_prepare_t1#!#BASE TABLE +master#!#dbo#!#isc_tables_vu_prepare_v1#!#VIEW +~~END~~ + + +DROP TABLE [ISC_TABLES_TABLE_SCHEMA] . [ISC_TABLES_TABLE2] +GO diff --git a/test/JDBC/expected/ISC-Tables-vu-cleanup.out b/test/JDBC/expected/ISC-Tables-vu-cleanup.out index ccadb1a4256..d648cef653b 100644 --- a/test/JDBC/expected/ISC-Tables-vu-cleanup.out +++ b/test/JDBC/expected/ISC-Tables-vu-cleanup.out @@ -1,10 +1,14 @@ DROP TABLE isc_tables_sc1.t2 +DROP TABLE [ISC_TABLES_TABLE_SCHEMA].[ISC_TABLES_TABLE] +DROP TABLE [ISC_TABLES SCHEMA . WITH .. DOTS].[ISC_TABLES TABLE . WITH .. DOTS] GO DROP TYPE isc_tables_sc1.isc_table_type2 GO DROP SCHEMA isc_tables_sc1 +DROP SCHEMA [ISC_TABLES_TABLE_SCHEMA] +DROP SCHEMA [ISC_TABLES SCHEMA . WITH .. DOTS] GO DROP VIEW isc_tables_vu_prepare_v1 diff --git a/test/JDBC/expected/ISC-Tables-vu-prepare.out b/test/JDBC/expected/ISC-Tables-vu-prepare.out index 18f81a38128..806a0e3c9d7 100644 --- a/test/JDBC/expected/ISC-Tables-vu-prepare.out +++ b/test/JDBC/expected/ISC-Tables-vu-prepare.out @@ -8,9 +8,22 @@ GO CREATE SCHEMA isc_tables_sc1 GO +CREATE SCHEMA [ISC_TABLES_TABLE_SCHEMA] +GO + +CREATE SCHEMA [ISC_TABLES SCHEMA . WITH .. DOTS] +GO + CREATE TABLE isc_tables_sc1.t2(a INT,b INT) GO +-- Table name which is prefix of schema name +CREATE TABLE [ISC_TABLES_TABLE_SCHEMA] . [ISC_TABLES_TABLE] (a INT, b INT) +GO + +CREATE TABLE [ISC_TABLES SCHEMA . WITH .. DOTS] . [ISC_TABLES TABLE . WITH .. DOTS] (a INT, b INT) +GO + CREATE TYPE isc_tables_sc1.isc_table_type2 AS TABLE(a INT) GO @@ -25,7 +38,7 @@ CREATE FUNCTION isc_tables_vu_prepare_f1() RETURNS INT AS BEGIN - RETURN (SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_NAME = 'isc_tables_vu_prepare_t1') + RETURN (SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_NAME LIKE 'isc_tables%') end GO @@ -33,11 +46,11 @@ CREATE FUNCTION isc_tables_vu_prepare_f2() RETURNS INT AS BEGIN - RETURN (SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_NAME = 'ISC_TABLES_VU_PREPARE_T1') + RETURN (SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_NAME LIKE 'ISC_TABLES%') end GO -- Dep View CREATE VIEW isc_tables_vu_prepare_v1 AS - SELECT * FROM information_schema.tables WHERE TABLE_NAME = 'ISC_TABLES_VU_PREPARE_T1' + SELECT * FROM information_schema.tables WHERE TABLE_NAME LIKE 'ISC_TABLES%' ORDER BY TABLE_NAME GO diff --git a/test/JDBC/expected/ISC-Tables-vu-verify.out b/test/JDBC/expected/ISC-Tables-vu-verify.out index 549d72fae08..d050ff6b7f4 100644 --- a/test/JDBC/expected/ISC-Tables-vu-verify.out +++ b/test/JDBC/expected/ISC-Tables-vu-verify.out @@ -1,14 +1,20 @@ -SELECT * FROM information_schema.tables WHERE TABLE_NAME = 'isc_tables_vu_prepare_t1' -SELECT * FROM information_schema.tables WHERE TABLE_NAME = 'ISC_TABLES_VU_PREPARE_T1' +SELECT * FROM information_schema.tables WHERE TABLE_NAME LIKE 'isc_tables%' ORDER BY TABLE_NAME +SELECT * FROM information_schema.tables WHERE TABLE_NAME LIKE 'ISC_TABLES%' ORDER BY TABLE_NAME GO ~~START~~ nvarchar#!#nvarchar#!#varchar#!#varchar +master#!#ISC_TABLES SCHEMA . WITH .. DOTS#!#ISC_TABLES TABLE . WITH .. DOTS#!#BASE TABLE +master#!#ISC_TABLES_TABLE_SCHEMA#!#ISC_TABLES_TABLE#!#BASE TABLE master#!#dbo#!#isc_tables_vu_prepare_t1#!#BASE TABLE +master#!#dbo#!#isc_tables_vu_prepare_v1#!#VIEW ~~END~~ ~~START~~ nvarchar#!#nvarchar#!#varchar#!#varchar +master#!#ISC_TABLES SCHEMA . WITH .. DOTS#!#ISC_TABLES TABLE . WITH .. DOTS#!#BASE TABLE +master#!#ISC_TABLES_TABLE_SCHEMA#!#ISC_TABLES_TABLE#!#BASE TABLE master#!#dbo#!#isc_tables_vu_prepare_t1#!#BASE TABLE +master#!#dbo#!#isc_tables_vu_prepare_v1#!#VIEW ~~END~~ @@ -62,12 +68,12 @@ SELECT * FROM isc_tables_vu_prepare_f2() GO ~~START~~ int -1 +4 ~~END~~ ~~START~~ int -1 +4 ~~END~~ @@ -75,6 +81,9 @@ SELECT * FROM isc_tables_vu_prepare_v1 GO ~~START~~ nvarchar#!#nvarchar#!#varchar#!#varchar +master#!#ISC_TABLES SCHEMA . WITH .. DOTS#!#ISC_TABLES TABLE . WITH .. DOTS#!#BASE TABLE +master#!#ISC_TABLES_TABLE_SCHEMA#!#ISC_TABLES_TABLE#!#BASE TABLE master#!#dbo#!#isc_tables_vu_prepare_t1#!#BASE TABLE +master#!#dbo#!#isc_tables_vu_prepare_v1#!#VIEW ~~END~~ diff --git a/test/JDBC/expected/PARTITION-vu-cleanup.out b/test/JDBC/expected/PARTITION-vu-cleanup.out new file mode 100644 index 00000000000..f45b042ebc0 --- /dev/null +++ b/test/JDBC/expected/PARTITION-vu-cleanup.out @@ -0,0 +1,480 @@ +DROP VIEW GetPartitionFunctionMetadataView +GO + +DROP VIEW GetRangeMetadataView +GO + +DROP VIEW GetRangeMetadataVarBinaryFunctionView +GO + +DROP VIEW GetParameterMetadataView +GO + +DROP VIEW GetPartitionSchemesMetadataView +GO + +DROP VIEW GetPartitionedTableListFromSysTablesView +GO + +DROP VIEW GetPartitionedIndexListFromSysIndexesView +GO + +DROP FUNCTION PartitionFunctionContainsDuplicateName +GO + +DROP FUNCTION PartitionFunctionContainsDuplicateIDs +GO + +DROP FUNCTION PartitionSchemeContainsDuplicateName +GO + +DROP FUNCTION PartitionSchemeContainsDuplicateIDs +GO + +DROP VIEW GetPartitionSchemeOrFilegroupForTableOrIndex +GO + +DROP VIEW GetFileGroupMappingOfPartitionScheme +GO + +DROP VIEW GetPartitionedTablePartitioningColumn +GO + +DROP VIEW GetPartitionedIndexPartitioningColumn +GO + +DROP VIEW GetSysPartitionsMetadata +GO + +DROP VIEW DollarPartitionFunctionView +GO + +DROP PROCEDURE DollarPartitionFunctionProc +GO + +DROP FUNCTION DollarPartitionFunctionFunc +GO + +DROP VIEW DollarPartitionFunctionNullView +GO + +DROP PROCEDURE DollarPartitionFunctionNullProc +GO + +DROP FUNCTION DollarPartitionFunctionNullFunc +GO + +DROP VIEW SysSearchPartitionDepView +GO + +DROP VIEW SysSearchPartitionNULLDepView +GO +-------------------------------------------------- +--- DROP Partitioned Index +-------------------------------------------------- +DROP INDEX partition_vu_prepare_uniqueidentifier_index ON partition_vu_prepare_uniqueidentifier_table; +GO + +DROP INDEX partition_vu_prepare_varbinary_index ON partition_vu_prepare_varbinary_table; +GO + +DROP INDEX partition_vu_prepare_binary_index ON partition_vu_prepare_binary_table; +GO + +DROP INDEX partition_vu_prepare_nchar_index ON partition_vu_prepare_nchar_table; +GO + +DROP INDEX partition_vu_prepare_nvarchar_index ON partition_vu_prepare_nvarchar_table; +GO + +DROP INDEX partition_vu_prepare_varchar_index ON partition_vu_prepare_varchar_table; +GO + +DROP INDEX partition_vu_prepare_char_index ON partition_vu_prepare_char_table; +GO + +DROP INDEX partition_vu_prepare_smalldatetime_index ON partition_vu_prepare_smalldatetime_table; +GO + +DROP INDEX partition_vu_prepare_datetime2_index ON partition_vu_prepare_datetime2_table; +GO + +DROP INDEX partition_vu_prepare_datetime_index ON partition_vu_prepare_datetime_table; +GO + +DROP INDEX partition_vu_prepare_date_index ON partition_vu_prepare_date_table; +GO + +DROP INDEX partition_vu_prepare_smallmoney_index ON partition_vu_prepare_smallmoney_table; +GO + +DROP INDEX partition_vu_prepare_money_index ON partition_vu_prepare_money_table; +GO + +DROP INDEX partition_vu_prepare_numeric_index ON partition_vu_prepare_numeric_table; +GO + +DROP INDEX partition_vu_prepare_decimal_index ON partition_vu_prepare_decimal_table; +GO + +DROP INDEX partition_vu_prepare_tinyint_index ON partition_vu_prepare_tinyint_table; +GO + +DROP INDEX partition_vu_prepare_smallint_index ON partition_vu_prepare_smallint_table; +GO + +DROP INDEX partition_vu_prepare_bigint_index ON partition_vu_prepare_bigint_table; +GO + +DROP INDEX partition_vu_prepare_int_index ON partition_vu_prepare_int_table; +GO + +DROP INDEX PARTITION_INDEXログインαιώνια ON PARTITION_TABLEログインαιώνια +GO + +DROP INDEX [PARTITION_INDEX 유니코드스키마👻 ] ON [PARTITION_TABLE 유니코드스키마👻 ] +GO + +DROP INDEX partition_vu_prepare_normal_index ON partition_vu_prepare_normal_table +GO + + +SET QUOTED_IDENTIFIER ON; +GO + +DROP INDEX "PARTITION_INDEX 😎$@ #123 🌍rder " ON "PARTITION_TABLE 😎$@ #123 🌍rder " +GO + +SET QUOTED_IDENTIFIER OFF; +GO + +DROP INDEX PartitionIndexNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz +ON PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz +GO + +DROP INDEX PartitionIndexNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz +ON PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +GO +-------------------------------------------------- +--- DROP Partitioned Table +-------------------------------------------------- +DROP TABLE partition_vu_prepare_uniqueidentifier_table; +GO + +DROP TABLE partition_vu_prepare_varbinary_table; +GO + +DROP TABLE partition_vu_prepare_binary_table; +GO + +DROP TABLE partition_vu_prepare_nchar_table; +GO + +DROP TABLE partition_vu_prepare_nvarchar_table; +GO + +DROP TABLE partition_vu_prepare_varchar_table; +GO + +DROP TABLE partition_vu_prepare_char_table; +GO + +DROP TABLE partition_vu_prepare_smalldatetime_table; +GO + +DROP TABLE partition_vu_prepare_datetime2_table; +GO + +DROP TABLE partition_vu_prepare_datetime_table; +GO + +DROP TABLE partition_vu_prepare_date_table; +GO + +DROP TABLE partition_vu_prepare_smallmoney_table; +GO + +DROP TABLE partition_vu_prepare_money_table; +GO + +DROP TABLE partition_vu_prepare_numeric_table; +GO + +DROP TABLE partition_vu_prepare_decimal_table; +GO + +DROP TABLE partition_vu_prepare_tinyint_table; +GO + +DROP TABLE partition_vu_prepare_smallint_table; +GO + +DROP TABLE partition_vu_prepare_bigint_table; +GO + +DROP TABLE partition_vu_prepare_int_table; +GO + +DROP TABLE PartitionTableNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz +GO + +DROP TABLE PARTITION_TABLEログインαιώνια +GO + +DROP TABLE [PARTITION_TABLE 유니코드스키마👻 ] +GO + +DROP TABLE partition_vu_prepare_normal_table +GO + +SET QUOTED_IDENTIFIER ON; +GO + +DROP TABLE "PARTITION_TABLE 😎$@ #123 🌍rder " +GO + +SET QUOTED_IDENTIFIER OFF; +GO + +DROP TABLE PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz +GO + +DROP TABLE PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +GO + +DROP SCHEMA PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz +GO +-------------------------------------------------- +--- DROP Partition Scheme +-------------------------------------------------- +DROP PARTITION SCHEME IntPartitionScheme +GO + +DROP PARTITION SCHEME BigIntPartitionScheme +GO + +DROP PARTITION SCHEME SmallIntPartitionScheme +GO + +DROP PARTITION SCHEME TinyIntPartitionScheme +GO + +DROP PARTITION SCHEME DecimalPartitionScheme +GO + +DROP PARTITION SCHEME NumericPartitionScheme +GO + +DROP PARTITION SCHEME MoneyPartitionScheme +GO + +DROP PARTITION SCHEME SmallMoneyPartitionScheme +GO + +DROP PARTITION SCHEME DatePartitionScheme +GO + +DROP PARTITION SCHEME DateTimePartitionScheme +GO + +DROP PARTITION SCHEME DateTime2PartitionScheme +GO + +DROP PARTITION SCHEME SmallDateTimePartitionScheme +GO + +DROP PARTITION SCHEME CharPartitionScheme +GO + +DROP PARTITION SCHEME VarCharPartitionScheme +GO + +DROP PARTITION SCHEME NVarCharPartitionScheme +GO + +DROP PARTITION SCHEME NCharPartitionScheme +GO + +DROP PARTITION SCHEME BinaryPartitionScheme +GO + +DROP PARTITION SCHEME VarBinaryPartitionScheme +GO + +DROP PARTITION SCHEME UniqueIdentifierPartitionScheme +GO + +DROP PARTITION SCHEME PartitionSchemeNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz +GO + +DROP PARTITION SCHEME PARTITION_SCHEMEログインαιώνια +GO + +DROP PARTITION SCHEME [PARTITION_SCHEME 유니코드스키마👻 ] +GO + +SET QUOTED_IDENTIFIER ON; +GO + +DROP PARTITION SCHEME "PARTITION_SCHEME 😎$@ #123 🌍rder " +Go + +SET QUOTED_IDENTIFIER OFF; +GO + +DROP PARTITION SCHEME PartitionSchemeNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +GO + +------------------------------------------- +--- DROP Partition Function +------------------------------------------- +DROP PARTITION FUNCTION IntPartitionFunction +GO + +DROP PARTITION FUNCTION BigIntPartitionFunction +GO + +DROP PARTITION FUNCTION SmallIntPartitionFunction +GO + +DROP PARTITION FUNCTION TinyIntPartitionFunction +GO + +DROP PARTITION FUNCTION DecimalPartitionFunction +GO + +DROP PARTITION FUNCTION NumericPartitionFunction +GO + +DROP PARTITION FUNCTION MoneyPartitionFunction +GO + +DROP PARTITION FUNCTION SmallMoneyPartitionFunction +GO + +DROP PARTITION FUNCTION DatePartitionFunction +GO + +DROP PARTITION FUNCTION DateTimePartitionFunction +GO + +DROP PARTITION FUNCTION DateTime2PartitionFunction +GO + +DROP PARTITION FUNCTION SmallDateTimePartitionFunction +GO + +DROP PARTITION FUNCTION CharPartitionFunction +GO + +DROP PARTITION FUNCTION VarCharPartitionFunction +GO + +DROP PARTITION FUNCTION NVarCharPartitionFunction +GO + +DROP PARTITION FUNCTION NCharPartitionFunction +GO + +DROP PARTITION FUNCTION BinaryPartitionFunction +GO + +DROP PARTITION FUNCTION VarBinaryPartitionFunction +GO + +DROP PARTITION FUNCTION UniqueIdentifierPartitionFunction +GO + +DROP PARTITION FUNCTION PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz +GO + +DROP PARTITION FUNCTION PartitionFunctionHavingDifferentCollationInput +GO + +DROP PARTITION FUNCTION PARTITION_FUNCTIONログインαιώνια +GO + +DROP PARTITION FUNCTION [PARTITION_FUNCTION 유니코드스키마👻 ] +GO + +DROP PARTITION FUNCTION PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +GO + + +--------------------------- +--- DROP Procedures +--------------------------- +DROP PROCEDURE PartitionProcedureCreatePartitionFunction +GO + +DROP PROCEDURE PartitionProcedureCreatePartitionScheme +GO + +DROP PROCEDURE PartitionProcedureCreatePartitionTable +GO + +DROP PROCEDURE PartitionProcedureCreatePartitionFunctionSchemeAndTable +GO + +DROP PROCEDURE PartitionProcedureDropPartitionFunction +GO + +DROP PROCEDURE PartitionProcedureDropPartitionScheme +GO + +DROP PROCEDURE PartitionProcedureDropPartitionTable +GO + +DROP PROCEDURE PartitionProcedureDropPartitionFunctionSchemeAndTable +GO + + +SET QUOTED_IDENTIFIER ON; +GO + +DROP PARTITION FUNCTION "PARTITION_FUNCTION 😎$@ #123 🌍rder " +Go + +SET QUOTED_IDENTIFIER OFF; +GO + +USE PartitionDb; +GO + +DROP LOGIN partition_l1; +GO + +DROP LOGIN partition_l2 +GO + +USE master +go + +DROP DATABASE PartitionDb +go + +-- psql +-- validate that catalogs don't have stale entries +SELECT count(*) FROM sys.babelfish_partition_function; +GO +~~START~~ +int8 +0 +~~END~~ + + +SELECT count(*) FROM sys.babelfish_partition_scheme +GO +~~START~~ +int8 +0 +~~END~~ + + +SELECT count(*) FROM sys.babelfish_partition_depend +GO +~~START~~ +int8 +0 +~~END~~ + diff --git a/test/JDBC/expected/PARTITION-vu-prepare.out b/test/JDBC/expected/PARTITION-vu-prepare.out new file mode 100644 index 00000000000..451e292f1a9 --- /dev/null +++ b/test/JDBC/expected/PARTITION-vu-prepare.out @@ -0,0 +1,1343 @@ + + +--------------------------------------------------------------- +---- Views/Function to retrieve from the metadata Views +---------------------------------------------------------------- +CREATE VIEW GetPartitionFunctionMetadataView +AS +( + SELECT + name, type, type_desc, fanout, boundary_value_on_right, is_system + FROM + sys.partition_functions + ORDER BY + name +) +GO + +CREATE VIEW GetRangeMetadataVIEW +AS +( + SELECT + name, parameter_id, boundary_id, value + FROM + sys.partition_range_values pr + LEFT JOIN + sys.partition_functions pf on (pr.function_id = pf.function_id) + WHERE + name not in ('BinaryPartitionFunction', 'VarBinaryPartitionFunction') + ORDER BY + name, boundary_id +) +GO + +CREATE VIEW GetRangeMetadataVarBinaryFunctionView +AS +( + SELECT + name, parameter_id, boundary_id, cast(value as varbinary) + FROM + sys.partition_range_values pr + LEFT JOIN + sys.partition_functions pf on (pr.function_id = pf.function_id) + WHERE + name in ('BinaryPartitionFunction', 'VarBinaryPartitionFunction') + ORDER BY + name, boundary_id +) +GO + + +CREATE VIEW GetParameterMetadataView +AS +( + SELECT + pf.name as function_name, typ.name as typname, parameter_id, pp.max_length, pp.precision, pp.scale, pp.collation_name + FROM + sys.partition_functions pf + INNER JOIN + sys.partition_parameters pp on (pp.function_id = pf.function_id) + INNER JOIN + sys.types typ on (pp.user_type_id = typ.user_type_id and pp.user_type_id = typ.system_type_id) + ORDER BY + pf.name +) +GO + +CREATE VIEW GetPartitionSchemesMetadataView +AS +( + SELECT + ps.name as scheme_name, pf.name as function_name, ps.type, ps.type_desc, is_default, ps.is_system + FROM + sys.partition_schemes ps + INNER JOIN + sys.partition_functions pf on (ps.function_id = pf.function_id) + ORDER BY + ps.name +) +GO + +CREATE FUNCTION PartitionFunctionContainsDuplicateName() +RETURNS TABLE +AS +RETURN +( + SELECT + name + FROM + sys.partition_functions + GROUP BY name + HAVING COUNT(*) > 1 +) +GO + +CREATE FUNCTION PartitionFunctionContainsDuplicateIDs() +RETURNS TABLE +AS +RETURN +( + SELECT + function_id + FROM + sys.partition_functions + GROUP BY function_id + HAVING COUNT(*) > 1 +) +GO + +CREATE FUNCTION PartitionSchemeContainsDuplicateName() +RETURNS TABLE +AS +RETURN +( + SELECT + name + FROM + sys.partition_schemes + GROUP BY name + HAVING COUNT(*) > 1 +) +GO + +CREATE FUNCTION PartitionSchemeContainsDuplicateIDs() +RETURNS TABLE +AS +RETURN +( + SELECT + data_space_id + FROM + sys.partition_schemes + GROUP BY data_space_id + HAVING COUNT(*) > 1 +) +GO + + +CREATE VIEW GetPartitionSchemeOrFilegroupForTableOrIndex +AS +( + SELECT + o.name AS TableName, + i.name AS IndexName, + ds.name AS PartitionSchemeOrFilegroupName + FROM + sys.indexes i + INNER JOIN + sys.objects o ON i.object_id = o.object_id + INNER JOIN + sys.data_spaces ds ON i.data_space_id = ds.data_space_id + WHERE + o.name like 'partition_vu_prepare%' + ORDER BY + o.name, i.name +) +GO + + +CREATE VIEW GetFileGroupMappingOfPartitionScheme +AS +( + SELECT + ps.name AS PartitionSchemeName, + sf.name AS FileGroupName, + dds.destination_id AS DestinationId + FROM + sys.partition_schemes AS ps + INNER JOIN + sys.destination_data_spaces AS dds ON dds.partition_scheme_id = ps.data_space_id + INNER JOIN + sys.filegroups AS sf ON sf.data_space_id = dds.data_space_id + WHERE + -- fetch only these two because they covers both possible value of next_used + ps.name in ('IntPartitionScheme', 'SmallIntPartitionScheme') + ORDER BY + ps.name, dds.destination_id +) +GO + + +CREATE VIEW GetPartitionedTablePartitioningColumn +AS +( + SELECT + tbl.name AS TableName, + c.name AS PartitioningColumn, + ic.partition_ordinal AS PartitionOrdinal + FROM + sys.tables AS tbl + INNER JOIN + sys.index_columns ic ON (ic.index_id = 0 AND ic.partition_ordinal > 0 AND ic.object_id = tbl.object_id) + INNER JOIN + sys.columns c ON (c.object_id = ic.object_id AND c.column_id = ic.column_id) + WHERE + tbl.name like 'partition_vu_prepare%' + ORDER BY + tbl.name +) +GO + +CREATE VIEW GetPartitionedIndexPartitioningColumn +AS +( + SELECT + idx.name AS IndexName, + OBJECT_NAME(idx.object_id) AS TableName, + c.name AS PartitioningColumn, + ic.partition_ordinal AS PartitionOrdinal + FROM + sys.indexes AS idx + INNER JOIN + sys.index_columns ic ON (ic.partition_ordinal > 0 AND ic.object_id = idx.object_id) + INNER JOIN + sys.columns c ON (c.object_id = ic.object_id AND c.column_id = ic.column_id) + WHERE + idx.name like 'partition_vu_prepare%' + ORDER BY + idx.name +) +GO + + +CREATE VIEW GetSysPartitionsMetadata +AS +( + SELECT + OBJECT_NAME(partition_id) AS PartitionName, + partition_number, + index_id + FROM + sys.partitions, + OBJECT_NAME(object_id) AS ParentName + WHERE + ParentName IN ('partition_vu_prepare_int_table', 'partition_vu_prepare_normal_table') + ORDER BY + ParentName, partition_number +) +GO + +-------------------------------------------------- +--- Create Normal TABLE and INDEX for Views testing +-------------------------------------------------- +CREATE TABLE partition_vu_prepare_normal_table ( + Id INT, + Value sys.varchar(50) +); +GO + +CREATE INDEX partition_vu_prepare_normal_index +ON partition_vu_prepare_normal_table(Value); +GO + + + +-------------------------------------------------- +--- Supported Datatypes for Partition Function +-------------------------------------------------- +-- all datatypes should sort and store the values in ascending order by itself +-- and input values should be implicit casted into specified type +-- using local variable in args +declare @a int = 0; +declare @b int = 500; +declare @c int = 1000; +CREATE PARTITION FUNCTION IntPartitionFunction (int) +AS RANGE RIGHT FOR VALUES (@a, @b, @c); +GO + + +-- explicit schema can also be specified with paramater type +CREATE PARTITION FUNCTION BigIntPartitionFunction (sys.bigint) +AS RANGE RIGHT FOR VALUES (0, 10000, 100, 1000); +GO + +CREATE PARTITION FUNCTION SmallIntPartitionFunction (smallint) +AS RANGE RIGHT FOR VALUES (cast(32767 as bigint), -32768, 0); +GO + +-- explicit schema can also be specified with paramater type +CREATE PARTITION FUNCTION TinyIntPartitionFunction (sys.tinyint) +AS RANGE RIGHT FOR VALUES (0, cast(255 as varchar), 128); +GO + +CREATE PARTITION FUNCTION DecimalPartitionFunction (decimal(10, 5)) +AS RANGE RIGHT FOR VALUES (0.0, 300.0, 200.0, 100.0); +GO + +CREATE PARTITION FUNCTION NumericPartitionFunction (numeric(5, 2)) +AS RANGE RIGHT FOR VALUES (0.0, 30.0, 10.0, 20.0); +GO + +CREATE PARTITION FUNCTION MoneyPartitionFunction (MONEY) +AS RANGE RIGHT FOR VALUES ($2.56789, ¥4.91, $3.56789); +GO + +CREATE PARTITION FUNCTION SmallMoneyPartitionFunction (SMALLMONEY) +AS RANGE RIGHT FOR VALUES ($2.56789, ¥4.91, $3.56789); +GO + +CREATE PARTITION FUNCTION DatePartitionFunction (date) +AS RANGE RIGHT FOR VALUES ('2022-07-01', '2022-01-01','2023-01-01'); +GO + +-- should implicity cast it to input type +CREATE PARTITION FUNCTION DateTimePartitionFunction (datetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01 00:00:00', '2019-01-01 00:00:00'); +GO + +CREATE PARTITION FUNCTION DateTime2PartitionFunction (datetime2(3)) +AS RANGE RIGHT FOR VALUES ('2022-01-01 00:00:00.000', '2022-07-01 00:00:00.000', '2019-01-01 00:00:00.000'); +GO + +CREATE PARTITION FUNCTION SmallDateTimePartitionFunction (smalldatetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01', '2019-01-01'); +GO + +CREATE PARTITION FUNCTION CharPartitionFunction (char(5)) +AS RANGE RIGHT FOR VALUES ('A', 'F', 'K', 'P', 'U', 'Z', 'D'); +GO + +CREATE PARTITION FUNCTION VarCharPartitionFunction (varchar(10)) +AS RANGE RIGHT FOR VALUES ('Apple', 'Banana', 'Mango', 'Cherry', 'Date'); +GO + +CREATE PARTITION FUNCTION NVarCharPartitionFunction (nvarchar(10)) +AS RANGE RIGHT FOR VALUES (N'Apple', N'Banana', N'Mango', N'Cherry', N'Date'); +GO + +CREATE PARTITION FUNCTION NCharPartitionFunction (nchar(5)) +AS RANGE RIGHT FOR VALUES (N'A', N'F', N'K', N'P', N'U', N'Z', N'B'); +GO + +CREATE PARTITION FUNCTION BinaryPartitionFunction (binary(4)) +AS RANGE RIGHT FOR VALUES (0x000, 0x800, 0x400, 0xC000); +GO + +CREATE PARTITION FUNCTION VarBinaryPartitionFunction (varbinary(8)) +AS RANGE RIGHT FOR VALUES (0x0000000000000000, 0x8000000000000000, 0x4000000000000000, 0xC000000000000000); +GO + +CREATE PARTITION FUNCTION UniqueIdentifierPartitionFunction (uniqueidentifier) +AS RANGE RIGHT FOR VALUES ('00000000-0000-0000-0000-000000000000', 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF', '6F9619FF-8B86-D011-B42D-00C04FC964FF'); +GO + + +-- identifier length greater than 64 +CREATE PARTITION FUNCTION PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz (bigint) +AS RANGE RIGHT FOR VALUES (0, 10000, 100, 1000); +GO + +CREATE PARTITION FUNCTION PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder (bigint) +AS RANGE RIGHT FOR VALUES (0, 10000, 100, 1000); +GO + +CREATE PARTITION FUNCTION PartitionFunctionHavingDifferentCollationInput (NVARCHAR(50)) +AS RANGE RIGHT +FOR VALUES ( + N'John Doe', + N'Jane Smith' COLLATE Latin1_General_CI_AS, + N'châu phố' COLLATE Vietnamese_CI_AS, + N'Müller GmbH' COLLATE Traditional_Spanish_CI_AS +); +GO + + +-------------------------------------------------- +--- Partition Scheme +-------------------------------------------------- +-- without all option +-- filegroups are equal to partition that will generated by function +CREATE PARTITION SCHEME IntPartitionScheme AS +PARTITION IntPartitionFunction +TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]); +GO + +-- filgroups are more than partition that will generated by function +CREATE PARTITION SCHEME BigIntPartitionScheme AS +PARTITION BigIntPartitionFunction +TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]); +GO + +-- with all option +CREATE PARTITION SCHEME SmallIntPartitionScheme AS +PARTITION SmallIntPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME TinyIntPartitionScheme AS +PARTITION TinyIntPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME DecimalPartitionScheme AS +PARTITION DecimalPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME NumericPartitionScheme AS +PARTITION NumericPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME MoneyPartitionScheme AS +PARTITION MoneyPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME SmallMoneyPartitionScheme AS +PARTITION SmallMoneyPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME DatePartitionScheme AS +PARTITION DatePartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME DateTimePartitionScheme AS +PARTITION DateTimePartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME DateTime2PartitionScheme AS +PARTITION DateTime2PartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME SmallDateTimePartitionScheme AS +PARTITION SmallDateTimePartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME CharPartitionScheme AS +PARTITION CharPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME VarCharPartitionScheme AS +PARTITION VarCharPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME NVarCharPartitionScheme AS +PARTITION NVarCharPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME NCharPartitionScheme AS +PARTITION NCharPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME BinaryPartitionScheme AS +PARTITION BinaryPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME VarBinaryPartitionScheme AS +PARTITION VarBinaryPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME UniqueIdentifierPartitionScheme AS +PARTITION UniqueIdentifierPartitionFunction +ALL TO ([PRIMARY]); +GO + +-- identifier length greater than 64 +CREATE PARTITION SCHEME PartitionSchemeNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz AS +PARTITION PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME PartitionSchemeNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder AS +PARTITION PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +ALL TO ([PRIMARY]); +GO + +CREATE SCHEMA PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz +GO + +CREATE TABLE PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz ( + PartitionColumnNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz BIGINT, + Value sys.varchar(50) +) ON PartitionSchemeNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz (PartitionColumnNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz); +GO + +CREATE INDEX PartitionIndexNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz +ON PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz(Value) +ON PartitionSchemeNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz +(PartitionColumnNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz); +GO + +CREATE TABLE PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder ( + PartitionColumnNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz BIGINT, + Value sys.varchar(50) +) ON PartitionSchemeNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +(PartitionColumnNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz); +GO + +CREATE INDEX PartitionIndexNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz +ON PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder(Value) +ON PartitionSchemeNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +(PartitionColumnNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz); +GO + +-------------------------------------------------- +--- name identifiers test +-------------------------------------------------- +CREATE PARTITION FUNCTION PARTITION_FUNCTIONログインαιώνια (int) +AS RANGE RIGHT FOR VALUES (0, 500, 1000); +GO + +CREATE PARTITION SCHEME PARTITION_SCHEMEログインαιώνια AS +PARTITION PARTITION_FUNCTIONログインαιώνια +ALL TO ([PRIMARY]); +GO + +CREATE TABLE PARTITION_TABLEログインαιώνια ( + PARTITION_COLUMNログインαιώνια INT, + Value sys.varchar(50) +) ON PARTITION_SCHEMEログインαιώνια(PARTITION_COLUMNログインαιώνια); +GO + +CREATE INDEX PARTITION_INDEXログインαιώνια +ON PARTITION_TABLEログインαιώνια(Value) +ON PARTITION_SCHEMEログインαιώνια(PARTITION_COLUMNログインαιώνια); +GO + +CREATE PARTITION FUNCTION [PARTITION_FUNCTION 유니코드스키마👻 ] (int) +AS RANGE RIGHT FOR VALUES (0, 500, 1000); +GO + +CREATE PARTITION SCHEME [PARTITION_SCHEME 유니코드스키마👻 ] AS +PARTITION [PARTITION_FUNCTION 유니코드스키마👻 ] +ALL TO ([PRIMARY]); +GO + +CREATE TABLE [PARTITION_TABLE 유니코드스키마👻 ]( + [PARTITION_COLUMN 유니코드스키마👻 ] INT, + Value sys.varchar(50) +) ON [PARTITION_SCHEME 유니코드스키마👻 ]([PARTITION_COLUMN 유니코드스키마👻 ]); +GO + +CREATE INDEX [PARTITION_INDEX 유니코드스키마👻 ] +ON [PARTITION_TABLE 유니코드스키마👻 ](Value) +ON [PARTITION_SCHEME 유니코드스키마👻 ]([PARTITION_COLUMN 유니코드스키마👻 ]); +GO + +-- qouted identifer +SET QUOTED_IDENTIFIER ON; +GO + +CREATE PARTITION FUNCTION "PARTITION_FUNCTION 😎$@ #123 🌍rder " (int) +AS RANGE RIGHT FOR VALUES (0, 500, 1000); +GO + +CREATE PARTITION SCHEME "PARTITION_SCHEME 😎$@ #123 🌍rder " AS +PARTITION "PARTITION_FUNCTION 😎$@ #123 🌍rder " +ALL TO ([PRIMARY]); +GO + + +CREATE TABLE "PARTITION_TABLE 😎$@ #123 🌍rder " ( + "PARTITION_COLUMN 😎$@ #123 🌍rder " INT, + Value sys.varchar(50) +) ON "PARTITION_SCHEME 😎$@ #123 🌍rder " ("PARTITION_COLUMN 😎$@ #123 🌍rder "); +GO + +CREATE INDEX "PARTITION_INDEX 😎$@ #123 🌍rder " +ON "PARTITION_TABLE 😎$@ #123 🌍rder " (Value) +ON "PARTITION_SCHEME 😎$@ #123 🌍rder "("PARTITION_COLUMN 😎$@ #123 🌍rder "); +GO + +SET QUOTED_IDENTIFIER OFF; +Go + + +-------------------------------------------------- +--- TO test Permission +-------------------------------------------------- +CREATE DATABASE PartitionDb; +GO + +USE PartitionDb; +GO + +CREATE PARTITION FUNCTION PartitionDb_PartitionFunction (int) +AS RANGE RIGHT FOR VALUES (500, 1000, 10000); +Go + +CREATE PARTITION SCHEME PartitionDb_PartitionScheme AS +PARTITION PartitionDb_PartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE TABLE PartitionDb_PartitionTable ( + Id INT, + Value sys.varchar(50) +) ON PartitionDb_PartitionScheme(Id); +GO + +CREATE INDEX PartitionDb_PartitionIndex +ON PartitionDb_PartitionTable(Id) +ON PartitionDb_PartitionScheme (Id); +GO + +USE MASTER +go + +--------------------------------------------------------------- +--- CREATE/DROP Partition Function/Scheme/Table inside Procedure +--------------------------------------------------------------- +CREATE PROCEDURE PartitionProcedureCreatePartitionFunction AS +BEGIN +CREATE PARTITION FUNCTION PartitionFunctionInsideProc1 (int) +AS RANGE RIGHT FOR VALUES (500, 1000, 10000) +END; +Go + +CREATE PROCEDURE PartitionProcedureCreatePartitionScheme AS +BEGIN +CREATE PARTITION SCHEME PartitionSchemeInsideProc1 AS +PARTITION PartitionFunctionInsideProc1 +ALL TO ([PRIMARY]) +END; +GO + +CREATE PROCEDURE PartitionProcedureCreatePartitionTable AS +BEGIN +CREATE TABLE PartitionTableInsideProc1( + Id INT, + Value sys.varchar(50) +) ON PartitionSchemeInsideProc1(Id); +END; +GO + +CREATE PROCEDURE PartitionProcedureCreatePartitionFunctionSchemeAndTable AS +BEGIN +CREATE PARTITION FUNCTION PartitionFunctionInsideProc2 (int) +AS RANGE RIGHT FOR VALUES (500, 1000, 10000); +CREATE PARTITION SCHEME PartitionSchemeInsideProc2 AS +PARTITION PartitionFunctionInsideProc2 +ALL TO ([PRIMARY]); +CREATE TABLE PartitionTableInsideProc2( + Id INT, + Value sys.varchar(50) +) ON PartitionSchemeInsideProc2(Id); +END; +Go + +CREATE PROCEDURE PartitionProcedureDropPartitionFunction AS +BEGIN +DROP PARTITION FUNCTION PartitionFunctionInsideProc1 +END; +Go + +CREATE PROCEDURE PartitionProcedureDropPartitionScheme AS +BEGIN +DROP PARTITION SCHEME PartitionSchemeInsideProc1 +END; +GO + +CREATE PROCEDURE PartitionProcedureDropPartitionTable AS +BEGIN +DROP TABLE PartitionTableInsideProc1 +END; +GO + +CREATE PROCEDURE PartitionProcedureDropPartitionFunctionSchemeAndTable AS +BEGIN +DROP TABLE PartitionTableInsideProc2; +DROP PARTITION SCHEME PartitionSchemeInsideProc2; +DROP PARTITION FUNCTION PartitionFunctionInsideProc2; +END; +Go + +USE master; +go +--------------------------------------------------------------------------- +--- CREATE PARTITIONED TABLES with PARTITION SCHEME for different datatypes +--------------------------------------------------------------------------- +-- int data type +CREATE TABLE partition_vu_prepare_int_table ( + Value sys.varchar(50), + Id INT UNIQUE +) ON IntPartitionScheme(Id); +GO + +-- add constraint +ALTER TABLE partition_vu_prepare_int_table ADD CONSTRAINT check_value_not_null CHECK(value IS NOT NULL); +GO + +-- bigint data type +CREATE TABLE partition_vu_prepare_bigint_table ( + Id BIGINT, + Value sys.varchar(50) +) ON BigIntPartitionScheme--this is comment should get ignored +(Id); +GO + +-- smallint data type +CREATE TABLE partition_vu_prepare_smallint_table ( + Id SMALLINT, + Value sys.varchar(50) +) ON SmallIntPartitionScheme(Id); +GO + +-- tinyint data type +CREATE TABLE partition_vu_prepare_tinyint_table ( + Id TINYINT, + Value sys.varchar(50) +) ON TinyIntPartitionScheme(Id); +GO + +-- decimal data type +CREATE TABLE partition_vu_prepare_decimal_table ( + Id DECIMAL(10, 5), + Value sys.varchar(50) +) ON DecimalPartitionScheme(Id); +GO + +-- numeric data type +CREATE TABLE partition_vu_prepare_numeric_table ( + Id NUMERIC(5, 2), + Value sys.varchar(50) +) ON NumericPartitionScheme(Id); +GO + +-- money data type +CREATE TABLE partition_vu_prepare_money_table ( + Id MONEY, + Value sys.varchar(50) +) ON MoneyPartitionScheme(Id); +GO + +-- smallmoney data type +CREATE TABLE partition_vu_prepare_smallmoney_table ( + Id SMALLMONEY, + Value sys.varchar(50) +) ON SmallMoneyPartitionScheme(Id); +GO + +-- date data type +CREATE TABLE partition_vu_prepare_date_table ( + Id DATE, + Value sys.varchar(50) +) ON DatePartitionScheme(Id); +GO + +-- datetime data type +CREATE TABLE partition_vu_prepare_datetime_table ( + Id DATETIME, + Value sys.varchar(50) +) ON DateTimePartitionScheme(Id); +GO + +-- datetime2 data type +CREATE TABLE partition_vu_prepare_datetime2_table ( + Id DATETIME2(3), + Value sys.varchar(50) +) ON DateTime2PartitionScheme(Id); +GO + +-- smalldatetime data type +CREATE TABLE partition_vu_prepare_smalldatetime_table ( + Id SMALLDATETIME, + Value sys.varchar(50) +) ON SmallDateTimePartitionScheme(Id); +GO + +-- char data type +CREATE TABLE partition_vu_prepare_char_table ( + Id CHAR(5), + Value sys.varchar(50) +) ON CharPartitionScheme(Id); +GO + +-- varchar data type +CREATE TABLE partition_vu_prepare_varchar_table ( + Id VARCHAR(10), + Value sys.varchar(50) +) ON VarCharPartitionScheme(Id); +GO + +-- nvarchar data type +CREATE TABLE partition_vu_prepare_nvarchar_table ( + Id NVARCHAR(10), + Value sys.varchar(50) +) ON NVarCharPartitionScheme(Id); +GO + +-- nchar data type +CREATE TABLE partition_vu_prepare_nchar_table ( + Id NCHAR(5), + Value sys.varchar(50) +) ON NCharPartitionScheme(Id); +GO + +-- binary data type +CREATE TABLE partition_vu_prepare_binary_table ( + Id BINARY(4), + Value sys.varchar(50) +) ON BinaryPartitionScheme(Id); +GO + +-- varbinary data type +CREATE TABLE partition_vu_prepare_varbinary_table ( + Id VARBINARY(8), + Value sys.varchar(50) +) ON VarBinaryPartitionScheme(Id); +GO + +-- uniqueidentifier data type +CREATE TABLE partition_vu_prepare_uniqueidentifier_table ( + Id UNIQUEIDENTIFIER, + Value sys.varchar(50) +) ON UniqueIdentifierPartitionScheme(Id); +GO + + +-- identifier length greater than 64 +CREATE TABLE PartitionTableNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz ( + Id INT, + Value sys.varchar(50) +) ON IntPartitionScheme(Id); +GO + +CREATE VIEW GetPartitionedTableListFromSysTablesView +AS +( + SELECT + name + FROM + sys.tables + WHERE + name like '%partition_vu_prepare%' + ORDER BY + name +) +GO + +--------------------------------------------------------------------------- +--- CREATE ALIGNED PARTITIONED INDEX with PARTITION SCHEME +--------------------------------------------------------------------------- +-- using schema name +CREATE INDEX partition_vu_prepare_int_index +ON dbo.partition_vu_prepare_int_table(Value) +ON IntPartitionScheme (Id); +GO + +-- without explicit schema name +CREATE INDEX partition_vu_prepare_bigint_index +ON partition_vu_prepare_bigint_table(Id) +ON BigIntPartitionScheme (Id); +GO + +-- without partition scheme should also work +CREATE INDEX partition_vu_prepare_smallint_index +ON partition_vu_prepare_smallint_table--this is comment should get ignored +(Id) +GO + +CREATE INDEX partition_vu_prepare_tinyint_index +ON partition_vu_prepare_tinyint_table(Id) +ON TinyIntPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_decimal_index +ON partition_vu_prepare_decimal_table(Id) +ON DecimalPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_numeric_index +ON partition_vu_prepare_numeric_table(Id) +ON NumericPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_money_index +ON partition_vu_prepare_money_table(Id) +ON MoneyPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_smallmoney_index +ON partition_vu_prepare_smallmoney_table(Id) +ON SmallMoneyPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_date_index +ON partition_vu_prepare_date_table(Id) +ON DatePartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_datetime_index +ON partition_vu_prepare_datetime_table(Id) +ON DateTimePartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_datetime2_index +ON partition_vu_prepare_datetime2_table(Id) +ON DateTime2PartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_smalldatetime_index +ON partition_vu_prepare_smalldatetime_table(Id) +ON SmallDateTimePartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_char_index +ON partition_vu_prepare_char_table(Id) +ON CharPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_varchar_index +ON partition_vu_prepare_varchar_table(Id) +ON VarCharPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_nvarchar_index +ON partition_vu_prepare_nvarchar_table(Id) +ON NVarCharPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_nchar_index +ON partition_vu_prepare_nchar_table(Id) +ON NCharPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_binary_index +ON partition_vu_prepare_binary_table(Id) +ON BinaryPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_varbinary_index +ON partition_vu_prepare_varbinary_table(Id) +ON VarBinaryPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_uniqueidentifier_index +ON partition_vu_prepare_uniqueidentifier_table(Id) +ON UniqueIdentifierPartitionScheme (Id); +GO + +CREATE VIEW GetPartitionedIndexListFromSysIndexesView +AS +( + SELECT + name + FROM + sys.indexes + WHERE + name like '%partition_vu_prepare%' + ORDER BY + name +) +GO + +--------------------------------------------------------------------------- +--- Insert data into partitioned tables +--------------------------------------------------------------------------- +-- Insert values into partition_vu_prepare_int_table +INSERT INTO partition_vu_prepare_int_table (Id, Value) VALUES (1, 'Value 1'); +INSERT INTO partition_vu_prepare_int_table (Id, Value) VALUES (100, 'Value 100'); +INSERT INTO partition_vu_prepare_int_table (Id, Value) VALUES (10000, 'Value 10000'); +INSERT INTO partition_vu_prepare_int_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- Insert values into partition_vu_prepare_bigint_table +INSERT INTO partition_vu_prepare_bigint_table (Id, Value) VALUES (1, 'Value 1'); +INSERT INTO partition_vu_prepare_bigint_table (Id, Value) VALUES (100, 'Value 100'); +INSERT INTO partition_vu_prepare_bigint_table (Id, Value) VALUES (10000, 'Value 10000'); +INSERT INTO partition_vu_prepare_bigint_table (Id, Value) VALUES (1000000000, 'Value 1000000000'); +INSERT INTO partition_vu_prepare_bigint_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- Insert values into partition_vu_prepare_smallint_table +INSERT INTO partition_vu_prepare_smallint_table (Id, Value) VALUES (1, 'Value 1'); +INSERT INTO partition_vu_prepare_smallint_table (Id, Value) VALUES (-32768, 'Value -32768'); +INSERT INTO partition_vu_prepare_smallint_table (Id, Value) VALUES (32767, 'Value 32767'); +INSERT INTO partition_vu_prepare_smallint_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- Insert values into partition_vu_prepare_tinyint_table +INSERT INTO partition_vu_prepare_tinyint_table (Id, Value) VALUES (1, 'Value 1'); +INSERT INTO partition_vu_prepare_tinyint_table (Id, Value) VALUES (128, 'Value 128'); +INSERT INTO partition_vu_prepare_tinyint_table (Id, Value) VALUES (255, 'Value 255'); +INSERT INTO partition_vu_prepare_tinyint_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- Insert values into partition_vu_prepare_decimal_table +INSERT INTO partition_vu_prepare_decimal_table (Id, Value) VALUES (1.0, 'Value 1.0'); +INSERT INTO partition_vu_prepare_decimal_table (Id, Value) VALUES (100.0, 'Value 100.0'); +INSERT INTO partition_vu_prepare_decimal_table (Id, Value) VALUES (200.0, 'Value 200.0'); +INSERT INTO partition_vu_prepare_decimal_table (Id, Value) VALUES (300.0, 'Value 300.0'); +INSERT INTO partition_vu_prepare_decimal_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- Insert values into partition_vu_prepare_numeric_table +INSERT INTO partition_vu_prepare_numeric_table (Id, Value) VALUES (1.0, 'Value 1.0'); +INSERT INTO partition_vu_prepare_numeric_table (Id, Value) VALUES (10.0, 'Value 10.0'); +INSERT INTO partition_vu_prepare_numeric_table (Id, Value) VALUES (20.0, 'Value 20.0'); +INSERT INTO partition_vu_prepare_numeric_table (Id, Value) VALUES (30.0, 'Value 30.0'); +INSERT INTO partition_vu_prepare_numeric_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- Insert values into partition_vu_prepare_money_table +INSERT INTO partition_vu_prepare_money_table (Id, Value) VALUES (1.0, 'Value 1.0'); +INSERT INTO partition_vu_prepare_money_table (Id, Value) VALUES (2.56789, 'Value 2.56789'); +INSERT INTO partition_vu_prepare_money_table (Id, Value) VALUES (4.91, 'Value 4.91'); +INSERT INTO partition_vu_prepare_money_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- Insert values into partition_vu_prepare_smallmoney_table +INSERT INTO partition_vu_prepare_smallmoney_table (Id, Value) VALUES (1.0, 'Value 1.0'); +INSERT INTO partition_vu_prepare_smallmoney_table (Id, Value) VALUES (2.56789, 'Value 2.56789'); +INSERT INTO partition_vu_prepare_smallmoney_table (Id, Value) VALUES (4.91, 'Value 4.91'); +INSERT INTO partition_vu_prepare_smallmoney_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- Insert values into partition_vu_prepare_date_table +INSERT INTO partition_vu_prepare_date_table (Id, Value) VALUES ('2022-01-01', 'Value 2022-01-01'); +INSERT INTO partition_vu_prepare_date_table (Id, Value) VALUES ('2022-07-01', 'Value 2022-07-01'); +INSERT INTO partition_vu_prepare_date_table (Id, Value) VALUES ('2023-01-01', 'Value 2023-01-01'); +INSERT INTO partition_vu_prepare_date_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- Insert values into partition_vu_prepare_datetime_table +INSERT INTO partition_vu_prepare_datetime_table (Id, Value) VALUES ('2019-01-01', 'Value 2019-01-01'); +INSERT INTO partition_vu_prepare_datetime_table (Id, Value) VALUES ('2022-01-01', 'Value 2022-01-01'); +INSERT INTO partition_vu_prepare_datetime_table (Id, Value) VALUES ('2022-07-01', 'Value 2022-07-01'); +INSERT INTO partition_vu_prepare_datetime_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- Insert values into partition_vu_prepare_datetime2_table +INSERT INTO partition_vu_prepare_datetime2_table (Id, Value) VALUES ('2019-01-01 00:00:00.000', 'Value 2019-01-01 00:00:00.000'); +INSERT INTO partition_vu_prepare_datetime2_table (Id, Value) VALUES ('2022-01-01 00:00:00.000', 'Value 2022-01-01 00:00:00.000'); +INSERT INTO partition_vu_prepare_datetime2_table (Id, Value) VALUES ('2022-07-01 00:00:00.000', 'Value 2022-07-01 00:00:00.000'); +INSERT INTO partition_vu_prepare_datetime2_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- Insert values into partition_vu_prepare_smalldatetime_table +INSERT INTO partition_vu_prepare_smalldatetime_table (Id, Value) VALUES ('2019-01-01', 'Value 2019-01-01'); +INSERT INTO partition_vu_prepare_smalldatetime_table (Id, Value) VALUES ('2022-01-01', 'Value 2022-01-01'); +INSERT INTO partition_vu_prepare_smalldatetime_table (Id, Value) VALUES ('2022-07-01', 'Value 2022-07-01'); +INSERT INTO partition_vu_prepare_smalldatetime_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- Insert values into partition_vu_prepare_char_table +INSERT INTO partition_vu_prepare_char_table (Id, Value) VALUES ('A', 'Value A'); +INSERT INTO partition_vu_prepare_char_table (Id, Value) VALUES ('K', 'Value K'); +INSERT INTO partition_vu_prepare_char_table (Id, Value) VALUES ('U', 'Value U'); +INSERT INTO partition_vu_prepare_char_table (Id, Value) VALUES ('D', 'Value D'); +INSERT INTO partition_vu_prepare_char_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- Insert values into partition_vu_prepare_varchar_table +INSERT INTO partition_vu_prepare_varchar_table (Id, Value) VALUES ('Apple', 'Value Apple'); +INSERT INTO partition_vu_prepare_varchar_table (Id, Value) VALUES ('Banana', 'Value Banana'); +INSERT INTO partition_vu_prepare_varchar_table (Id, Value) VALUES ('Mango', 'Value Mango'); +INSERT INTO partition_vu_prepare_varchar_table (Id, Value) VALUES ('Cherry', 'Value Cherry'); +INSERT INTO partition_vu_prepare_varchar_table (Id, Value) VALUES ('Date', 'Value Date'); +INSERT INTO partition_vu_prepare_varchar_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- Insert values into partition_vu_prepare_nvarchar_table +INSERT INTO partition_vu_prepare_nvarchar_table (Id, Value) VALUES (N'Apple', N'Value Apple'); +INSERT INTO partition_vu_prepare_nvarchar_table (Id, Value) VALUES (N'Banana', N'Value Banana'); +INSERT INTO partition_vu_prepare_nvarchar_table (Id, Value) VALUES (N'Mango', N'Value Mango'); +INSERT INTO partition_vu_prepare_nvarchar_table (Id, Value) VALUES (N'Cherry', N'Value Cherry'); +INSERT INTO partition_vu_prepare_nvarchar_table (Id, Value) VALUES (N'Date', N'Value Date'); +INSERT INTO partition_vu_prepare_nvarchar_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- Insert values into partition_vu_prepare_nchar_table +INSERT INTO partition_vu_prepare_nchar_table (Id, Value) VALUES (N'A', N'Value A'); +INSERT INTO partition_vu_prepare_nchar_table (Id, Value) VALUES (N'K', N'Value K'); +INSERT INTO partition_vu_prepare_nchar_table (Id, Value) VALUES (N'U', N'Value U'); +INSERT INTO partition_vu_prepare_nchar_table (Id, Value) VALUES (N'B', N'Value B'); +INSERT INTO partition_vu_prepare_nchar_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- BABEL-4957 needs to fixed first otherwise dump/restore will fail +INSERT INTO partition_vu_prepare_binary_table (Id, Value) VALUES (0x0000, 'Value 0x0000'); +INSERT INTO partition_vu_prepare_binary_table (Id, Value) VALUES (0x0400, 'Value 0x0400'); +INSERT INTO partition_vu_prepare_binary_table (Id, Value) VALUES (0x0800, 'Value 0x0800'); +INSERT INTO partition_vu_prepare_binary_table (Id, Value) VALUES (0x0C000, 'Value 0x0C000'); +INSERT INTO partition_vu_prepare_binary_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- Insert values into partition_vu_prepare_varbinary_table +INSERT INTO partition_vu_prepare_varbinary_table (Id, Value) VALUES (0x0000000000000000, 'Value 0x0000000000000000'); +INSERT INTO partition_vu_prepare_varbinary_table (Id, Value) VALUES (0x4000000000000000, 'Value 0x4000000000000000'); +INSERT INTO partition_vu_prepare_varbinary_table (Id, Value) VALUES (0x8000000000000000, 'Value 0x8000000000000000'); +INSERT INTO partition_vu_prepare_varbinary_table (Id, Value) VALUES (0xC000000000000000, 'Value 0xC000000000000000'); +INSERT INTO partition_vu_prepare_varbinary_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- Insert values into partition_vu_prepare_uniqueidentifier_table +INSERT INTO partition_vu_prepare_uniqueidentifier_table (Id, Value) VALUES ('00000000-0000-0000-0000-000000000000', 'Value 00000000-0000-0000-0000-000000000000'); +INSERT INTO partition_vu_prepare_uniqueidentifier_table (Id, Value) VALUES ('6F9619FF-8B86-D011-B42D-00C04FC964FF', 'Value 6F9619FF-8B86-D011-B42D-00C04FC964FF'); +INSERT INTO partition_vu_prepare_uniqueidentifier_table (Id, Value) VALUES ('FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF', 'Value FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF'); +INSERT INTO partition_vu_prepare_uniqueidentifier_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +--------------------------------------------------- +--- Check for inconsistent metadata before upgrade +---------------------------------------------------- +SELECT COUNT(*) FROM sys.babelfish_inconsistent_metadata(); +GO +~~START~~ +int +0 +~~END~~ + + + +--------------------------------------------------------------- +---- Views/Functions/Procedure to test DOLLAR PARTITION FUNCTION +---------------------------------------------------------------- +CREATE VIEW DollarPartitionFunctionView +AS + SELECT $PARTITION.IntPartitionFunction(Id) AS PartitionNumber, Id + FROM partition_vu_prepare_int_table + ORDER BY PartitionNumber, Id; +GO + +CREATE PROCEDURE DollarPartitionFunctionProc +AS + SELECT $PARTITION.IntPartitionFunction(Id) AS PartitionNumber, Id + FROM partition_vu_prepare_int_table + ORDER BY PartitionNumber, Id; +GO + +CREATE FUNCTION DollarPartitionFunctionFunc() +RETURNS TABLE +AS + RETURN ( + SELECT $PARTITION.IntPartitionFunction(Id) AS PartitionNumber, Id + FROM partition_vu_prepare_int_table + ORDER BY PartitionNumber, Id + ) +GO + +CREATE VIEW DollarPartitionFunctionNullView +AS + SELECT $PARTITION.IntPartitionFunction(NULL) +GO + +CREATE PROCEDURE DollarPartitionFunctionNullProc +AS + SELECT $PARTITION.IntPartitionFunction(NULL) +GO + +CREATE FUNCTION DollarPartitionFunctionNullFunc() +RETURNS TABLE +AS + RETURN ( + SELECT $PARTITION.IntPartitionFunction(NULL) + ) +GO + +CREATE VIEW SysSearchPartitionDepView +AS + SELECT sys.search_partition('IntPartitionFunction', 10) +GO + +CREATE VIEW SysSearchPartitionNULLDepView +AS + SELECT sys.search_partition('IntPartitionFunction', 10, NULL) +GO diff --git a/test/JDBC/expected/PARTITION-vu-verify.out b/test/JDBC/expected/PARTITION-vu-verify.out new file mode 100644 index 00000000000..d5c8562af28 --- /dev/null +++ b/test/JDBC/expected/PARTITION-vu-verify.out @@ -0,0 +1,3746 @@ +--------------------------------------------------- +--- Check for inconsistent metadata after upgrade +---------------------------------------------------- +SELECT COUNT(*) FROM sys.babelfish_inconsistent_metadata(); +GO +~~START~~ +int +0 +~~END~~ + + +-------------------------------------------------- +--- CREATE PARTITION FUNCTION/SCHEME/TABLE using procedure +-------------------------------------------------- +EXEC PartitionProcedureCreatePartitionFunction +GO + +EXEC PartitionProcedureCreatePartitionScheme +GO + +EXEC PartitionProcedureCreatePartitionTable +GO + +EXEC PartitionProcedureCreatePartitionFunctionSchemeAndTable +GO + +-------------------------------------------------- +--- CREATE PARTITION FUNCTION/SCHEME/TABLE inside Function +-------------------------------------------------- +CREATE FUNCTION TestFunctionCreatePartitionFunction() +RETURNS INT +AS +BEGIN + CREATE PARTITION FUNCTION TestPartitionFunction (int) + AS RANGE RIGHT FOR VALUES (500, 1000, 10000); + RETURN 1; +END; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid use of a side-effecting operator 'CREATE PARTITION FUNCTION' within a function.)~~ + + +CREATE FUNCTION TestFunctionDropPartitionFunction() +RETURNS INT +AS +BEGIN + DROP PARTITION FUNCTION IntPartitionFunction; + RETURN 1; +END; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid use of a side-effecting operator 'DROP PARTITION FUNCTION' within a function.)~~ + + +CREATE FUNCTION TestFunctionCreatePartitionScheme() +RETURNS INT +AS +BEGIN + CREATE PARTITION SCHEME TestPartitionScheme AS + PARTITION IntPartitionFunction + ALL TO ([PRIMARY]); + RETURN 1; +END; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid use of a side-effecting operator 'CREATE PARTITION SCHEME' within a function.)~~ + + +CREATE FUNCTION TestFunctionDropPartitionScheme() +RETURNS INT +AS +BEGIN + DROP PARTITION SCHEME IntPartitionScheme; + RETURN 1; +END; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid use of a side-effecting operator 'DROP PARTITION SCHEME' within a function.)~~ + + +CREATE FUNCTION TestFunctionCreatePartitionTable() +RETURNS INT +AS +BEGIN + CREATE TABLE TestPartitionTable ( + Id INT, + Value sys.varchar(20) + ) ON IntPartitionScheme(Id); +END; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: DDL cannot be used within a function)~~ + + +CREATE FUNCTION TestFunctionDropPartitionTable() +RETURNS INT +AS +BEGIN + DROP TABLE partition_vu_prepare_int_table; + RETURN 1; +END; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: DDL cannot be used within a function)~~ + + + +--------------------------------------------------------- +--- CREATE PARTITION FUNCTION/SCHEME using 2-part name +--------------------------------------------------------- +CREATE PARTITION FUNCTION [TestDb].[TwoPartParitionFunction](DATE) +AS RANGE RIGHT FOR VALUES ('20230101', '20230201', '20230301', '20230401'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '.' at line 4 and character position 34)~~ + + +CREATE PARTITION SCHEME [TestDb].[TwoPartParitionScheme] +AS PARTITION [TestDb].[TwoPartPF] +TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '.' at line 1 and character position 32)~~ + + +-------------------------------------------------- +--- Unsupported Datatypes for Partition Function +-------------------------------------------------- +CREATE PARTITION FUNCTION VarcharMaxPartitionFunction (VARCHAR(MAX)) +AS RANGE RIGHT FOR VALUES ('A', 'B', 'C', 'D'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'varchar(max)' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION NVarcharMaxPartitionFunction (NVARCHAR(MAX)) +AS RANGE RIGHT FOR VALUES (N'A', N'B', N'C', N'D'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'nvarchar(max)' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION VarbinaryMaxPartitionFunction (VARBINARY(MAX)) +AS RANGE RIGHT FOR VALUES (0x000, 0x800, 0x400, 0xC000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'varbinary(max)' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION BinaryMaxPartitionFunction (BINARY(MAX)) +AS RANGE RIGHT FOR VALUES (0x000, 0x800, 0x400, 0xC000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Incorrect syntax near the keyword 'binary'.)~~ + + +CREATE PARTITION FUNCTION TextPartitionFunction (text) +AS RANGE RIGHT FOR VALUES ('a', 'b', 'c'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'text' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION NTextPartitionFunction (ntext) +AS RANGE RIGHT FOR VALUES (N'a', N'b', N'c'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'ntext' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION ImagePartitionFunction (image) +AS RANGE RIGHT FOR VALUES (0x123456, 0x789ABC, 0xDEF012); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'image' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION XmlPartitionFunction (xml) +AS RANGE RIGHT FOR VALUES ('1', '2', '3'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'xml' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION GeometryPartitionFunction (GEOMETRY) +AS RANGE RIGHT FOR VALUES (GEOMETRY::STGeomFromText('POINT(1 1)', 0)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'geometry' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION GeometryPartitionFunction (GEOGRAPHY) +AS RANGE RIGHT FOR VALUES (GEOMETRY::STGeomFromText('POINT(1 1)', 0)); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'geography' is not valid for this operation.)~~ + + +-- to test rowversion and timestamp +SELECT SET_CONFIG('babelfishpg_tsql.escape_hatch_rowversion', 'ignore', 'false') +go +~~START~~ +text +ignore +~~END~~ + + +CREATE PARTITION FUNCTION RowVersionPartitionFunction (ROWVERSION) +AS RANGE RIGHT FOR VALUES (0x0000000000000000, 0x0000000000000001, 0x0000000000000002); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'rowversion' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION TimestampPartitionFunction (TIMESTAMP) +AS RANGE RIGHT FOR VALUES (0x0000000000000000, 0x0000000000000001, 0x0000000000000002); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'timestamp' is not valid for this operation.)~~ + + +-- reset back the escape hatch +SELECT SET_CONFIG('babelfishpg_tsql.escape_hatch_rowversion', 'strict', 'true') +go +~~START~~ +text +strict +~~END~~ + + +-- user defined type +CREATE TYPE PartitionUserDefinedType FROM VARCHAR(10); +GO + +CREATE PARTITION FUNCTION UdtPartitionFunction (PartitionUserDefinedType) +AS RANGE RIGHT FOR VALUES ('a', 'b', 'c'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'partitionuserdefinedtype' is not valid for this operation.)~~ + + +DROP type PartitionUserDefinedType +GO + +------------------------------------------------------------------------------ +--- Duplicate range values for all supported datatypes in Partition Function +------------------------------------------------------------------------------ +CREATE PARTITION FUNCTION IntPartitionFunctionContainsDuplicateValue (int) +AS RANGE RIGHT FOR VALUES (0, 100, 1000, 100); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION BigIntPartitionFunctionContainsDuplicateValue (bigint) +AS RANGE RIGHT FOR VALUES (0, 500, 100, 500, 1000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION SmallIntPartitionFunctionContainsDuplicateValue (smallint) +AS RANGE RIGHT FOR VALUES (32767, 10, -32768, 0, 10); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION TinyIntPartitionFunctionContainsDuplicateValue (tinyint) +AS RANGE RIGHT FOR VALUES (0, 255, 128, 255); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION DecimalPartitionFunctionContainsDuplicateValue (decimal(10, 5)) +AS RANGE RIGHT FOR VALUES (0.0, 300.0, 200.0, 100.0, 300.0); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION NumericPartitionFunctionContainsDuplicateValue (numeric(5, 2)) +AS RANGE RIGHT FOR VALUES (0.0, 30.0, 10.0, 20.0, 30.0); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION DatePartitionFunctionContainsDuplicateValue (date) +AS RANGE RIGHT FOR VALUES ('2022-07-01', '2022-01-01','2023-01-01','2022-01-01'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION DateTimePartitionFunctionContainsDuplicateValue (datetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01 00:00:00', '2019-01-01 00:00:00', '2022-01-01'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION DateTime2PartitionFunctionContainsDuplicateValue (datetime2(3)) +AS RANGE RIGHT FOR VALUES ('2022-01-01 00:00:00.000', '2022-07-01 00:00:00.000', '2019-01-01 00:00:00.000', '2022-07-01 00:00:00.000'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION SmallDateTimePartitionFunctionContainsDuplicateValue (smalldatetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01', '2019-01-01', '2022-07-01'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION CharPartitionFunctionContainsDuplicateValue (char(5)) +AS RANGE RIGHT FOR VALUES ('A', 'F', 'K', 'P', 'U', 'Z', 'D', 'K'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION VarCharPartitionFunctionContainsDuplicateValue (varchar(10)) +AS RANGE RIGHT FOR VALUES ('Apple', 'Banana', 'Mango', 'Cherry', 'Date', 'Banana'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION NVarCharPartitionFunctionContainsDuplicateValue (nvarchar(10)) +AS RANGE RIGHT FOR VALUES (N'Apple', N'Banana', N'Mango', N'Cherry', N'Date', N'Banana'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION NCharPartitionFunctionContainsDuplicateValue (nchar(5)) +AS RANGE RIGHT FOR VALUES (N'A', N'F', N'K', N'P', N'U', N'Z', N'B', N'K'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION BinaryPartitionFunctionContainsDuplicateValue (binary(4)) +AS RANGE RIGHT FOR VALUES (0x000, 0x800, 0x400, 0xC000, 0x800); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION VarBinaryPartitionFunctionContainsDuplicateValue (varbinary(8)) +AS RANGE RIGHT FOR VALUES (0x0000000000000000, 0x8000000000000000, 0x4000000000000000, 0xC000000000000000, 0x8000000000000000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION UniqueIdentifierPartitionFunctionContainsDuplicateValue (uniqueidentifier) +AS RANGE RIGHT FOR VALUES ('00000000-0000-0000-0000-000000000000', '6F9619FF-8B86-D011-B42D-00C04FC964FF', 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF', '6F9619FF-8B86-D011-B42D-00C04FC964FF'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +-------------------------------------------------- +--- Unsupported Options with Partition Function +-------------------------------------------------- +-- LEFT option is not supported in Babelfish +CREATE PARTITION FUNCTION PartitionFunctionWithLeft (int) +AS RANGE LEFT FOR VALUES (10, 1000, 10000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'PARTIION FUNCTION with LEFT option' is not currently supported in Babelfish)~~ + + +-- sql_variant is not yet supported in Babelfish +CREATE PARTITION FUNCTION SqlVariantPartitionFunction (sql_variant) +AS RANGE RIGHT +FOR VALUES ( + CAST('abc' AS char(5)), + CAST(N'xyz' AS nchar(5)), + CAST('Apple' AS VARCHAR(10)), + CAST(N'Banana' AS NVARCHAR(10)), + CAST('Some text' AS SQL_VARIANT) +); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'sql_variant' is not yet supported for partition function in Babelfish.)~~ + + +-- by default it is LEFT and it should throw error +CREATE PARTITION FUNCTION PartitionFunctionWithLeft (int) +AS RANGE FOR VALUES (10, 1000, 10000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'PARTIION FUNCTION with LEFT option' is not currently supported in Babelfish)~~ + + +-- NULL value is not supported in range values +CREATE PARTITION FUNCTION PartitionFunctionWithNULL (int) +AS RANGE RIGHT FOR VALUES (10, 1000, NULL); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: NULL values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION PartitionFunctionWithNULL (int) +AS RANGE RIGHT FOR VALUES (10, 1000, NULL, NULL); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: NULL values are not allowed in partition function boundary values list.)~~ + + +-------------------------------------------------- +--- Duplicate Create of Partition Function/Scheme +-------------------------------------------------- +CREATE PARTITION FUNCTION IntPartitionFunction (int) +AS RANGE RIGHT FOR VALUES (500, 1000, 10000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: There is already an object named 'IntPartitionFunction' in the database.)~~ + + +-- duplicate partition function with invalid args +CREATE PARTITION FUNCTION IntPartitionFunction (int) +AS RANGE RIGHT FOR VALUES ('xyz', CONVERT(DATETIME, '2023-05-01'), 0x789ABC); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: There is already an object named 'IntPartitionFunction' in the database.)~~ + + +CREATE PARTITION SCHEME IntPartitionScheme AS +PARTITION IntPartitionFunction +ALL TO ([PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: There is already an object named 'IntPartitionScheme' in the database.)~~ + + +-- duplicate partition scheme with invalid Partition function +CREATE PARTITION SCHEME IntPartitionScheme AS +PARTITION PartitionFunctionDoesNotExists +ALL TO ([PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid object name 'PartitionFunctionDoesNotExists'.)~~ + + +----------------------------------------------------------------------------------- +--- Drop of of Partition Function/Scheme when it does not exists +----------------------------------------------------------------------------------- +DROP PARTITION FUNCTION PartitionFunctionDoesNotExists +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the partition function 'PartitionFunctionDoesNotExists', because it does not exist or you do not have permission.)~~ + + +DROP PARTITION SCHEME PartitionSchemeDoesNotExists +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the partition scheme 'PartitionSchemeDoesNotExists', because it does not exist or you do not have permission.)~~ + + +----------------------------------------------------------------------------------- +--- Create of Partition Scheme when provided partition function doesn't exists +----------------------------------------------------------------------------------- +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION PartitionFunctionDoesNotExists +ALL TO ([PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid object name 'PartitionFunctionDoesNotExists'.)~~ + + +----------------------------------------------------------------------------------- +--- Drop of of Partition Function when there is dependent Partition Scheme +----------------------------------------------------------------------------------- +DROP PARTITION FUNCTION IntPartitionFunction +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition function 'IntPartitionFunction' is being used by one or more partition schemes.)~~ + + +----------------------------------------------------------------------------------- +--- Drop of of Partition Scheme when there is dependent Table on it +----------------------------------------------------------------------------------- +DROP PARTITION SCHEME IntPartitionScheme +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The partition scheme "IntPartitionScheme" is currently being used to partition one or more tables.)~~ + + + + +----------------------------------------------- +--- Filegroup behaviour with Partition Scheme +----------------------------------------------- +-- by default user filegroup will be treated as PRIMARY filegroup +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION IntPartitionFunction +ALL TO (user_filegroup); +GO + +DROP PARTITION SCHEME TestPartitionScheme +GO + +-- User can configure the "escape_hatch_storage_options" to STRICT to disallow user filegroups +SELECT SET_CONFIG('babelfishpg_tsql.escape_hatch_storage_options', 'strict', 'false') +GO +~~START~~ +text +strict +~~END~~ + + +-- should throw error +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION IntPartitionFunction +ALL TO (user_filegroup); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'user filegroup' is not currently supported in Babelfish. please use babelfishpg_tsql.escape_hatch_storage_options to ignore)~~ + + +-- reset it back +SELECT SET_CONFIG('babelfishpg_tsql.escape_hatch_storage_options', 'ignore', 'false') +GO +~~START~~ +text +ignore +~~END~~ + + +-- when more than one filegroup are specified with ALL option +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION IntPartitionFunction +ALL TO ([PRIMARY], [PRIMARY], [PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Only a single filegroup can be specified while creating partition scheme using option ALL to specify all the filegroups.)~~ + + +-- when partition function generates more partition than specified filegroups +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION IntPartitionFunction +TO ([PRIMARY], [PRIMARY], [PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The associated partition function 'IntPartitionFunction' generates more partitions than there are file groups mentioned in the scheme 'TestPartitionScheme'.)~~ + + + +--------------------------------- +--- Metadata Related Tests +--------------------------------- +SELECT * FROM GetPartitionFunctionMetadataView +GO +~~START~~ +nvarchar#!#char#!#nvarchar#!#int#!#bit#!#bit +BigIntPartitionFunction#!#R #!#RANGE#!#5#!#1#!#0 +BinaryPartitionFunction#!#R #!#RANGE#!#5#!#1#!#0 +CharPartitionFunction#!#R #!#RANGE#!#8#!#1#!#0 +DatePartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +DateTime2PartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +DateTimePartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +DecimalPartitionFunction#!#R #!#RANGE#!#5#!#1#!#0 +IntPartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +MoneyPartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +NCharPartitionFunction#!#R #!#RANGE#!#8#!#1#!#0 +NumericPartitionFunction#!#R #!#RANGE#!#5#!#1#!#0 +NVarCharPartitionFunction#!#R #!#RANGE#!#6#!#1#!#0 +PARTITION_FUNCTION 유니코드스키마👻 #!#R #!#RANGE#!#4#!#1#!#0 +PARTITION_FUNCTION 😎$@ #123 🌍rder #!#R #!#RANGE#!#4#!#1#!#0 +PARTITION_FUNCTIONログインαιώνια#!#R #!#RANGE#!#4#!#1#!#0 +PartitionFunctionHavingDifferentCollationInput#!#R #!#RANGE#!#5#!#1#!#0 +PartitionFunctionInsideProc1#!#R #!#RANGE#!#4#!#1#!#0 +PartitionFunctionInsideProc2#!#R #!#RANGE#!#4#!#1#!#0 +PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#R #!#RANGE#!#5#!#1#!#0 +PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#R #!#RANGE#!#5#!#1#!#0 +SmallDateTimePartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +SmallIntPartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +SmallMoneyPartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +TinyIntPartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +UniqueIdentifierPartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +VarBinaryPartitionFunction#!#R #!#RANGE#!#5#!#1#!#0 +VarCharPartitionFunction#!#R #!#RANGE#!#6#!#1#!#0 +~~END~~ + + +SELECT * FROM GetRangeMetadataView +GO +~~START~~ +nvarchar#!#int#!#int#!#sql_variant +BigIntPartitionFunction#!#1#!#1#!#0 +BigIntPartitionFunction#!#1#!#2#!#100 +BigIntPartitionFunction#!#1#!#3#!#1000 +BigIntPartitionFunction#!#1#!#4#!#10000 +CharPartitionFunction#!#1#!#1#!#A +CharPartitionFunction#!#1#!#2#!#D +CharPartitionFunction#!#1#!#3#!#F +CharPartitionFunction#!#1#!#4#!#K +CharPartitionFunction#!#1#!#5#!#P +CharPartitionFunction#!#1#!#6#!#U +CharPartitionFunction#!#1#!#7#!#Z +DatePartitionFunction#!#1#!#1#!#2022-01-01 +DatePartitionFunction#!#1#!#2#!#2022-07-01 +DatePartitionFunction#!#1#!#3#!#2023-01-01 +DateTime2PartitionFunction#!#1#!#1#!#2019-01-01 00:00:00.0 +DateTime2PartitionFunction#!#1#!#2#!#2022-01-01 00:00:00.0 +DateTime2PartitionFunction#!#1#!#3#!#2022-07-01 00:00:00.0 +DateTimePartitionFunction#!#1#!#1#!#2019-01-01 00:00:00.0 +DateTimePartitionFunction#!#1#!#2#!#2022-01-01 00:00:00.0 +DateTimePartitionFunction#!#1#!#3#!#2022-07-01 00:00:00.0 +DecimalPartitionFunction#!#1#!#1#!#0.00000 +DecimalPartitionFunction#!#1#!#2#!#100.00000 +DecimalPartitionFunction#!#1#!#3#!#200.00000 +DecimalPartitionFunction#!#1#!#4#!#300.00000 +IntPartitionFunction#!#1#!#1#!#0 +IntPartitionFunction#!#1#!#2#!#500 +IntPartitionFunction#!#1#!#3#!#1000 +MoneyPartitionFunction#!#1#!#1#!#2.5679 +MoneyPartitionFunction#!#1#!#2#!#3.5679 +MoneyPartitionFunction#!#1#!#3#!#4.9100 +NCharPartitionFunction#!#1#!#1#!#A +NCharPartitionFunction#!#1#!#2#!#B +NCharPartitionFunction#!#1#!#3#!#F +NCharPartitionFunction#!#1#!#4#!#K +NCharPartitionFunction#!#1#!#5#!#P +NCharPartitionFunction#!#1#!#6#!#U +NCharPartitionFunction#!#1#!#7#!#Z +NumericPartitionFunction#!#1#!#1#!#0.00 +NumericPartitionFunction#!#1#!#2#!#10.00 +NumericPartitionFunction#!#1#!#3#!#20.00 +NumericPartitionFunction#!#1#!#4#!#30.00 +NVarCharPartitionFunction#!#1#!#1#!#Apple +NVarCharPartitionFunction#!#1#!#2#!#Banana +NVarCharPartitionFunction#!#1#!#3#!#Cherry +NVarCharPartitionFunction#!#1#!#4#!#Date +NVarCharPartitionFunction#!#1#!#5#!#Mango +PARTITION_FUNCTION 유니코드스키마👻 #!#1#!#1#!#0 +PARTITION_FUNCTION 유니코드스키마👻 #!#1#!#2#!#500 +PARTITION_FUNCTION 유니코드스키마👻 #!#1#!#3#!#1000 +PARTITION_FUNCTION 😎$@ #123 🌍rder #!#1#!#1#!#0 +PARTITION_FUNCTION 😎$@ #123 🌍rder #!#1#!#2#!#500 +PARTITION_FUNCTION 😎$@ #123 🌍rder #!#1#!#3#!#1000 +PARTITION_FUNCTIONログインαιώνια#!#1#!#1#!#0 +PARTITION_FUNCTIONログインαιώνια#!#1#!#2#!#500 +PARTITION_FUNCTIONログインαιώνια#!#1#!#3#!#1000 +PartitionFunctionHavingDifferentCollationInput#!#1#!#1#!#châu phố +PartitionFunctionHavingDifferentCollationInput#!#1#!#2#!#Jane Smith +PartitionFunctionHavingDifferentCollationInput#!#1#!#3#!#John Doe +PartitionFunctionHavingDifferentCollationInput#!#1#!#4#!#Müller GmbH +PartitionFunctionInsideProc1#!#1#!#1#!#500 +PartitionFunctionInsideProc1#!#1#!#2#!#1000 +PartitionFunctionInsideProc1#!#1#!#3#!#10000 +PartitionFunctionInsideProc2#!#1#!#1#!#500 +PartitionFunctionInsideProc2#!#1#!#2#!#1000 +PartitionFunctionInsideProc2#!#1#!#3#!#10000 +PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#1#!#1#!#0 +PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#1#!#2#!#100 +PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#1#!#3#!#1000 +PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#1#!#4#!#10000 +PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#1#!#1#!#0 +PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#1#!#2#!#100 +PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#1#!#3#!#1000 +PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#1#!#4#!#10000 +SmallDateTimePartitionFunction#!#1#!#1#!#2019-01-01 00:00:00.0 +SmallDateTimePartitionFunction#!#1#!#2#!#2022-01-01 00:00:00.0 +SmallDateTimePartitionFunction#!#1#!#3#!#2022-07-01 00:00:00.0 +SmallIntPartitionFunction#!#1#!#1#!#-32768 +SmallIntPartitionFunction#!#1#!#2#!#0 +SmallIntPartitionFunction#!#1#!#3#!#32767 +SmallMoneyPartitionFunction#!#1#!#1#!#2.5679 +SmallMoneyPartitionFunction#!#1#!#2#!#3.5679 +SmallMoneyPartitionFunction#!#1#!#3#!#4.9100 +TinyIntPartitionFunction#!#1#!#1#!#0 +TinyIntPartitionFunction#!#1#!#2#!#128 +TinyIntPartitionFunction#!#1#!#3#!#255 +UniqueIdentifierPartitionFunction#!#1#!#1#!#00000000-0000-0000-0000-000000000000 +UniqueIdentifierPartitionFunction#!#1#!#2#!#6F9619FF-8B86-D011-B42D-00C04FC964FF +UniqueIdentifierPartitionFunction#!#1#!#3#!#FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF +VarCharPartitionFunction#!#1#!#1#!#Apple +VarCharPartitionFunction#!#1#!#2#!#Banana +VarCharPartitionFunction#!#1#!#3#!#Cherry +VarCharPartitionFunction#!#1#!#4#!#Date +VarCharPartitionFunction#!#1#!#5#!#Mango +~~END~~ + + +SELECT * FROM GetRangeMetadataVarBinaryFunctionView +GO +~~START~~ +nvarchar#!#int#!#int#!#varbinary +BinaryPartitionFunction#!#1#!#1#!#00000000 +BinaryPartitionFunction#!#1#!#2#!#04000000 +BinaryPartitionFunction#!#1#!#3#!#08000000 +BinaryPartitionFunction#!#1#!#4#!#C0000000 +VarBinaryPartitionFunction#!#1#!#1#!#0000000000000000 +VarBinaryPartitionFunction#!#1#!#2#!#4000000000000000 +VarBinaryPartitionFunction#!#1#!#3#!#8000000000000000 +VarBinaryPartitionFunction#!#1#!#4#!#C000000000000000 +~~END~~ + + +SELECT * FROM GetParameterMetadataView +GO +~~START~~ +nvarchar#!#varchar#!#int#!#smallint#!#tinyint#!#tinyint#!#varchar +BigIntPartitionFunction#!#bigint#!#1#!#8#!#19#!#0#!# +BinaryPartitionFunction#!#binary#!#1#!#8000#!#0#!#0#!# +CharPartitionFunction#!#char#!#1#!#8000#!#0#!#0#!#bbf_unicode_cp1_ci_as +DatePartitionFunction#!#date#!#1#!#3#!#10#!#0#!# +DateTime2PartitionFunction#!#datetime2#!#1#!#8#!#26#!#6#!# +DateTimePartitionFunction#!#datetime#!#1#!#8#!#23#!#3#!# +DecimalPartitionFunction#!#decimal#!#1#!#17#!#38#!#38#!# +IntPartitionFunction#!#int#!#1#!#4#!#10#!#0#!# +MoneyPartitionFunction#!#money#!#1#!#8#!#19#!#4#!# +NCharPartitionFunction#!#nchar#!#1#!#8000#!#0#!#0#!#bbf_unicode_cp1_ci_as +NumericPartitionFunction#!#numeric#!#1#!#17#!#38#!#38#!# +NVarCharPartitionFunction#!#nvarchar#!#1#!#8000#!#0#!#0#!#bbf_unicode_cp1_ci_as +PARTITION_FUNCTION 유니코드스키마👻 #!#int#!#1#!#4#!#10#!#0#!# +PARTITION_FUNCTION 😎$@ #123 🌍rder #!#int#!#1#!#4#!#10#!#0#!# +PARTITION_FUNCTIONログインαιώνια#!#int#!#1#!#4#!#10#!#0#!# +PartitionFunctionHavingDifferentCollationInput#!#nvarchar#!#1#!#8000#!#0#!#0#!#bbf_unicode_cp1_ci_as +PartitionFunctionInsideProc1#!#int#!#1#!#4#!#10#!#0#!# +PartitionFunctionInsideProc2#!#int#!#1#!#4#!#10#!#0#!# +PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#bigint#!#1#!#8#!#19#!#0#!# +PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#bigint#!#1#!#8#!#19#!#0#!# +SmallDateTimePartitionFunction#!#smalldatetime#!#1#!#4#!#16#!#0#!# +SmallIntPartitionFunction#!#smallint#!#1#!#2#!#5#!#0#!# +SmallMoneyPartitionFunction#!#smallmoney#!#1#!#4#!#10#!#4#!# +TinyIntPartitionFunction#!#tinyint#!#1#!#1#!#3#!#0#!# +UniqueIdentifierPartitionFunction#!#uniqueidentifier#!#1#!#16#!#0#!#0#!# +VarBinaryPartitionFunction#!#varbinary#!#1#!#8000#!#0#!#0#!# +VarCharPartitionFunction#!#varchar#!#1#!#8000#!#0#!#0#!#bbf_unicode_cp1_ci_as +~~END~~ + + +SELECT * FROM GetPartitionSchemesMetadataView +GO +~~START~~ +nvarchar#!#nvarchar#!#char#!#nvarchar#!#bit#!#bit +BigIntPartitionScheme#!#BigIntPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +BinaryPartitionScheme#!#BinaryPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +CharPartitionScheme#!#CharPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +DatePartitionScheme#!#DatePartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +DateTime2PartitionScheme#!#DateTime2PartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +DateTimePartitionScheme#!#DateTimePartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +DecimalPartitionScheme#!#DecimalPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +IntPartitionScheme#!#IntPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +MoneyPartitionScheme#!#MoneyPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +NCharPartitionScheme#!#NCharPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +NumericPartitionScheme#!#NumericPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +NVarCharPartitionScheme#!#NVarCharPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +PARTITION_SCHEME 유니코드스키마👻 #!#PARTITION_FUNCTION 유니코드스키마👻 #!#PS#!#PARTITION_SCHEME#!#0#!#0 +PARTITION_SCHEME 😎$@ #123 🌍rder #!#PARTITION_FUNCTION 😎$@ #123 🌍rder #!#PS#!#PARTITION_SCHEME#!#0#!#0 +PARTITION_SCHEMEログインαιώνια#!#PARTITION_FUNCTIONログインαιώνια#!#PS#!#PARTITION_SCHEME#!#0#!#0 +PartitionSchemeInsideProc1#!#PartitionFunctionInsideProc1#!#PS#!#PARTITION_SCHEME#!#0#!#0 +PartitionSchemeInsideProc2#!#PartitionFunctionInsideProc2#!#PS#!#PARTITION_SCHEME#!#0#!#0 +PartitionSchemeNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#PS#!#PARTITION_SCHEME#!#0#!#0 +PartitionSchemeNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#PS#!#PARTITION_SCHEME#!#0#!#0 +SmallDateTimePartitionScheme#!#SmallDateTimePartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +SmallIntPartitionScheme#!#SmallIntPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +SmallMoneyPartitionScheme#!#SmallMoneyPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +TinyIntPartitionScheme#!#TinyIntPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +UniqueIdentifierPartitionScheme#!#UniqueIdentifierPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +VarBinaryPartitionScheme#!#VarBinaryPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +VarCharPartitionScheme#!#VarCharPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +~~END~~ + + +SELECT * FROM PartitionFunctionContainsDuplicateName() +GO +~~START~~ +nvarchar +~~END~~ + + +SELECT * FROM PartitionFunctionContainsDuplicateIDs() +GO +~~START~~ +int +~~END~~ + + +SELECT * FROM PartitionSchemeContainsDuplicateName() +GO +~~START~~ +nvarchar +~~END~~ + + +SELECT * FROM PartitionSchemeContainsDuplicateIDs() +GO +~~START~~ +int +~~END~~ + + +SELECT * FROM GetPartitionSchemeOrFilegroupForTableOrIndex +GO +~~START~~ +varchar#!#varchar#!#nvarchar +partition_vu_prepare_bigint_table#!##!#BigIntPartitionScheme +partition_vu_prepare_bigint_table#!#partition_vu_prepare_bigint_ind877afb285426cec9d46b047e3cf96f63#!#BigIntPartitionScheme +partition_vu_prepare_binary_table#!##!#BinaryPartitionScheme +partition_vu_prepare_binary_table#!#partition_vu_prepare_binary_ind48a88b3c8178211af1ed1dcf4cfbe503#!#BinaryPartitionScheme +partition_vu_prepare_char_table#!##!#CharPartitionScheme +partition_vu_prepare_char_table#!#partition_vu_prepare_char_index32fed8129381de1b5745e90cd811516f#!#CharPartitionScheme +partition_vu_prepare_date_table#!##!#DatePartitionScheme +partition_vu_prepare_date_table#!#partition_vu_prepare_date_indexf571a291edad587ba646fc34c4566844#!#DatePartitionScheme +partition_vu_prepare_datetime_table#!##!#DateTimePartitionScheme +partition_vu_prepare_datetime_table#!#partition_vu_prepare_datetime_i364577d0a406eee6e806be980ac15d2e#!#DateTimePartitionScheme +partition_vu_prepare_datetime2_table#!##!#DateTime2PartitionScheme +partition_vu_prepare_datetime2_table#!#partition_vu_prepare_datetime2_4cad7647322c234b34b97cddb3cd1ad6#!#DateTime2PartitionScheme +partition_vu_prepare_decimal_table#!##!#DecimalPartitionScheme +partition_vu_prepare_decimal_table#!#partition_vu_prepare_decimal_infc7570aeccbb040dde39974c476a7ec9#!#DecimalPartitionScheme +partition_vu_prepare_int_table#!##!#IntPartitionScheme +partition_vu_prepare_int_table#!#partition_vu_prepare_int_indexpbbe9a6f0ef5edf6e63fa853dac4ed046#!#IntPartitionScheme +partition_vu_prepare_int_table#!#partition_vu_prepare_int_table_id_key#!#IntPartitionScheme +partition_vu_prepare_money_table#!##!#MoneyPartitionScheme +partition_vu_prepare_money_table#!#partition_vu_prepare_money_inde9b6a61ad06c0883c6d0f95b2fec9eeee#!#MoneyPartitionScheme +partition_vu_prepare_nchar_table#!##!#NCharPartitionScheme +partition_vu_prepare_nchar_table#!#partition_vu_prepare_nchar_indecdc4872501ea902494c8f710f4e9dbb1#!#NCharPartitionScheme +partition_vu_prepare_normal_table#!##!#PRIMARY +partition_vu_prepare_normal_table#!#partition_vu_prepare_normal_inded6315af14d88f45711ba24e46851b8f#!#PRIMARY +partition_vu_prepare_numeric_table#!##!#NumericPartitionScheme +partition_vu_prepare_numeric_table#!#partition_vu_prepare_numeric_inf04f315c86929345e23bee80713cf963#!#NumericPartitionScheme +partition_vu_prepare_nvarchar_table#!##!#NVarCharPartitionScheme +partition_vu_prepare_nvarchar_table#!#partition_vu_prepare_nvarchar_if89fa8cc46282fa6dc23e9f5b834f3ec#!#NVarCharPartitionScheme +partition_vu_prepare_smalldatetime_table#!##!#SmallDateTimePartitionScheme +partition_vu_prepare_smalldatetime_table#!#partition_vu_prepare_smalldatetfe8f8bfb8c766f9a1bcd804238ff35d8#!#SmallDateTimePartitionScheme +partition_vu_prepare_smallint_table#!##!#SmallIntPartitionScheme +partition_vu_prepare_smallint_table#!#partition_vu_prepare_smallint_i3eae48e3a131ed23416aa2891b58d579#!#SmallIntPartitionScheme +partition_vu_prepare_smallmoney_table#!##!#SmallMoneyPartitionScheme +partition_vu_prepare_smallmoney_table#!#partition_vu_prepare_smallmoney68389bf5dc5c581b33c4dbb8a3dc1dc8#!#SmallMoneyPartitionScheme +partition_vu_prepare_tinyint_table#!##!#TinyIntPartitionScheme +partition_vu_prepare_tinyint_table#!#partition_vu_prepare_tinyint_in02b271c73e639954190c6a45bd5dd1bb#!#TinyIntPartitionScheme +partition_vu_prepare_uniqueidentifier_table#!##!#UniqueIdentifierPartitionScheme +partition_vu_prepare_uniqueidentifier_table#!#partition_vu_prepare_uniqueidend39220cd3f46c5b2cea8c338a387aedf#!#UniqueIdentifierPartitionScheme +partition_vu_prepare_varbinary_table#!##!#VarBinaryPartitionScheme +partition_vu_prepare_varbinary_table#!#partition_vu_prepare_varbinary_26e1223f68c4186a96126a57446ac386#!#VarBinaryPartitionScheme +partition_vu_prepare_varchar_table#!##!#VarCharPartitionScheme +partition_vu_prepare_varchar_table#!#partition_vu_prepare_varchar_inc528f397ba573964de161e03035b8f08#!#VarCharPartitionScheme +~~END~~ + + +SELECT * FROM GetFileGroupMappingOfPartitionScheme +GO +~~START~~ +nvarchar#!#nvarchar#!#int +IntPartitionScheme#!#PRIMARY#!#1 +IntPartitionScheme#!#PRIMARY#!#2 +IntPartitionScheme#!#PRIMARY#!#3 +IntPartitionScheme#!#PRIMARY#!#4 +SmallIntPartitionScheme#!#PRIMARY#!#1 +SmallIntPartitionScheme#!#PRIMARY#!#2 +SmallIntPartitionScheme#!#PRIMARY#!#3 +SmallIntPartitionScheme#!#PRIMARY#!#4 +SmallIntPartitionScheme#!#PRIMARY#!#5 +~~END~~ + + +SELECT * FROM GetPartitionedTablePartitioningColumn +GO +~~START~~ +varchar#!#varchar#!#tinyint +partition_vu_prepare_bigint_table#!#id#!#1 +partition_vu_prepare_binary_table#!#id#!#1 +partition_vu_prepare_char_table#!#id#!#1 +partition_vu_prepare_date_table#!#id#!#1 +partition_vu_prepare_datetime_table#!#id#!#1 +partition_vu_prepare_datetime2_table#!#id#!#1 +partition_vu_prepare_decimal_table#!#id#!#1 +partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_money_table#!#id#!#1 +partition_vu_prepare_nchar_table#!#id#!#1 +partition_vu_prepare_numeric_table#!#id#!#1 +partition_vu_prepare_nvarchar_table#!#id#!#1 +partition_vu_prepare_smalldatetime_table#!#id#!#1 +partition_vu_prepare_smallint_table#!#id#!#1 +partition_vu_prepare_smallmoney_table#!#id#!#1 +partition_vu_prepare_tinyint_table#!#id#!#1 +partition_vu_prepare_uniqueidentifier_table#!#id#!#1 +partition_vu_prepare_varbinary_table#!#id#!#1 +partition_vu_prepare_varchar_table#!#id#!#1 +~~END~~ + + +SELECT * FROM GetPartitionedIndexPartitioningColumn +GO +~~START~~ +varchar#!#varchar#!#varchar#!#tinyint +partition_vu_prepare_bigint_ind877afb285426cec9d46b047e3cf96f63#!#partition_vu_prepare_bigint_table#!#id#!#1 +partition_vu_prepare_bigint_ind877afb285426cec9d46b047e3cf96f63#!#partition_vu_prepare_bigint_table#!#id#!#1 +partition_vu_prepare_binary_ind48a88b3c8178211af1ed1dcf4cfbe503#!#partition_vu_prepare_binary_table#!#id#!#1 +partition_vu_prepare_binary_ind48a88b3c8178211af1ed1dcf4cfbe503#!#partition_vu_prepare_binary_table#!#id#!#1 +partition_vu_prepare_char_index32fed8129381de1b5745e90cd811516f#!#partition_vu_prepare_char_table#!#id#!#1 +partition_vu_prepare_char_index32fed8129381de1b5745e90cd811516f#!#partition_vu_prepare_char_table#!#id#!#1 +partition_vu_prepare_date_indexf571a291edad587ba646fc34c4566844#!#partition_vu_prepare_date_table#!#id#!#1 +partition_vu_prepare_date_indexf571a291edad587ba646fc34c4566844#!#partition_vu_prepare_date_table#!#id#!#1 +partition_vu_prepare_datetime_i364577d0a406eee6e806be980ac15d2e#!#partition_vu_prepare_datetime_table#!#id#!#1 +partition_vu_prepare_datetime_i364577d0a406eee6e806be980ac15d2e#!#partition_vu_prepare_datetime_table#!#id#!#1 +partition_vu_prepare_datetime2_4cad7647322c234b34b97cddb3cd1ad6#!#partition_vu_prepare_datetime2_table#!#id#!#1 +partition_vu_prepare_datetime2_4cad7647322c234b34b97cddb3cd1ad6#!#partition_vu_prepare_datetime2_table#!#id#!#1 +partition_vu_prepare_decimal_infc7570aeccbb040dde39974c476a7ec9#!#partition_vu_prepare_decimal_table#!#id#!#1 +partition_vu_prepare_decimal_infc7570aeccbb040dde39974c476a7ec9#!#partition_vu_prepare_decimal_table#!#id#!#1 +partition_vu_prepare_int_indexpbbe9a6f0ef5edf6e63fa853dac4ed046#!#partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_int_indexpbbe9a6f0ef5edf6e63fa853dac4ed046#!#partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_int_indexpbbe9a6f0ef5edf6e63fa853dac4ed046#!#partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_int_table_id_key#!#partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_int_table_id_key#!#partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_int_table_id_key#!#partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_money_inde9b6a61ad06c0883c6d0f95b2fec9eeee#!#partition_vu_prepare_money_table#!#id#!#1 +partition_vu_prepare_money_inde9b6a61ad06c0883c6d0f95b2fec9eeee#!#partition_vu_prepare_money_table#!#id#!#1 +partition_vu_prepare_nchar_indecdc4872501ea902494c8f710f4e9dbb1#!#partition_vu_prepare_nchar_table#!#id#!#1 +partition_vu_prepare_nchar_indecdc4872501ea902494c8f710f4e9dbb1#!#partition_vu_prepare_nchar_table#!#id#!#1 +partition_vu_prepare_numeric_inf04f315c86929345e23bee80713cf963#!#partition_vu_prepare_numeric_table#!#id#!#1 +partition_vu_prepare_numeric_inf04f315c86929345e23bee80713cf963#!#partition_vu_prepare_numeric_table#!#id#!#1 +partition_vu_prepare_nvarchar_if89fa8cc46282fa6dc23e9f5b834f3ec#!#partition_vu_prepare_nvarchar_table#!#id#!#1 +partition_vu_prepare_nvarchar_if89fa8cc46282fa6dc23e9f5b834f3ec#!#partition_vu_prepare_nvarchar_table#!#id#!#1 +partition_vu_prepare_smalldatetfe8f8bfb8c766f9a1bcd804238ff35d8#!#partition_vu_prepare_smalldatetime_table#!#id#!#1 +partition_vu_prepare_smalldatetfe8f8bfb8c766f9a1bcd804238ff35d8#!#partition_vu_prepare_smalldatetime_table#!#id#!#1 +partition_vu_prepare_smallint_i3eae48e3a131ed23416aa2891b58d579#!#partition_vu_prepare_smallint_table#!#id#!#1 +partition_vu_prepare_smallint_i3eae48e3a131ed23416aa2891b58d579#!#partition_vu_prepare_smallint_table#!#id#!#1 +partition_vu_prepare_smallmoney68389bf5dc5c581b33c4dbb8a3dc1dc8#!#partition_vu_prepare_smallmoney_table#!#id#!#1 +partition_vu_prepare_smallmoney68389bf5dc5c581b33c4dbb8a3dc1dc8#!#partition_vu_prepare_smallmoney_table#!#id#!#1 +partition_vu_prepare_tinyint_in02b271c73e639954190c6a45bd5dd1bb#!#partition_vu_prepare_tinyint_table#!#id#!#1 +partition_vu_prepare_tinyint_in02b271c73e639954190c6a45bd5dd1bb#!#partition_vu_prepare_tinyint_table#!#id#!#1 +partition_vu_prepare_uniqueidend39220cd3f46c5b2cea8c338a387aedf#!#partition_vu_prepare_uniqueidentifier_table#!#id#!#1 +partition_vu_prepare_uniqueidend39220cd3f46c5b2cea8c338a387aedf#!#partition_vu_prepare_uniqueidentifier_table#!#id#!#1 +partition_vu_prepare_varbinary_26e1223f68c4186a96126a57446ac386#!#partition_vu_prepare_varbinary_table#!#id#!#1 +partition_vu_prepare_varbinary_26e1223f68c4186a96126a57446ac386#!#partition_vu_prepare_varbinary_table#!#id#!#1 +partition_vu_prepare_varchar_inc528f397ba573964de161e03035b8f08#!#partition_vu_prepare_varchar_table#!#id#!#1 +partition_vu_prepare_varchar_inc528f397ba573964de161e03035b8f08#!#partition_vu_prepare_varchar_table#!#id#!#1 +~~END~~ + + +SELECT * FROM GetSysPartitionsMetadata +GO +~~START~~ +varchar#!#int#!#int +363863941f079adaa9aa733200e57c9f_partition_0_id_key#!#1#!#2 +363863941f079adaa9aa733200e57c9f_partition_0#!#1#!#0 +363863941f079adaa9aa733200e57c9f_partition_0_value_idx#!#1#!#3 +363863941f079adaa9aa733200e57c9f_partition_1_id_key#!#2#!#2 +363863941f079adaa9aa733200e57c9f_partition_1#!#2#!#0 +363863941f079adaa9aa733200e57c9f_partition_1_value_idx#!#2#!#3 +363863941f079adaa9aa733200e57c9f_partition_2_id_key#!#3#!#2 +363863941f079adaa9aa733200e57c9f_partition_2#!#3#!#0 +363863941f079adaa9aa733200e57c9f_partition_2_value_idx#!#3#!#3 +363863941f079adaa9aa733200e57c9f_partition_3_value_idx#!#4#!#3 +363863941f079adaa9aa733200e57c9f_partition_3#!#4#!#0 +363863941f079adaa9aa733200e57c9f_partition_3_id_key#!#4#!#2 +partition_vu_prepare_normal_inded6315af14d88f45711ba24e46851b8f#!#1#!#2 +partition_vu_prepare_normal_table#!#1#!#0 +~~END~~ + + + + + + + + +-------------------------------------------------- +--- Test Partition Function Argument Limit +-------------------------------------------------- +-- create with max allowed limit +DECLARE @partition_count INT = 14998; +DECLARE @partition_interval INT = 1000; +DECLARE @partition_function_definition VARCHAR(MAX) = 'CREATE PARTITION FUNCTION PartitionFunctionWith14999Arg (int) AS RANGE RIGHT FOR VALUES ('; +-- Build the partition function definition +DECLARE @i INT = 1; +WHILE @i <= @partition_count +BEGIN + SET @partition_function_definition = @partition_function_definition + CAST((@i * @partition_interval) AS VARCHAR(10)) + ', ' + SET @i = @i + 1; +END +SET @partition_function_definition = @partition_function_definition + CAST((@i * @partition_interval) AS VARCHAR(10)) + ')' +-- Execute the partition function creation +EXEC (@partition_function_definition) +GO + +SELECT fanout FROM sys.partition_functions WHERE name = 'PartitionFunctionWith14999Arg' +GO +~~START~~ +int +15000 +~~END~~ + + +DROP PARTITION FUNCTION PartitionFunctionWith14999Arg +GO + + + + + + + +-- create when arg > max allowed limit should throw error +DECLARE @partition_count INT = 14999; +DECLARE @partition_interval INT = 1000; +DECLARE @partition_function_definition VARCHAR(MAX) = 'CREATE PARTITION FUNCTION PartitionFunctionWith15000Arg (int) AS RANGE RIGHT FOR VALUES ('; +-- Build the partition function definition +DECLARE @i INT = 1; +WHILE @i <= @partition_count +BEGIN + SET @partition_function_definition = @partition_function_definition + CAST((@i * @partition_interval) AS VARCHAR(10)) + ', ' + SET @i = @i + 1; +END +SET @partition_function_definition = @partition_function_definition + CAST((@i * @partition_interval) AS VARCHAR(10)) + ')' +-- Execute the partition function creation +EXEC (@partition_function_definition) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: CREATE/ALTER partition function failed as only a maximum of 15000 partitions can be created.)~~ + + + +-------------------------------------------------- +--- Test Partition Function/Scheme Name Limit +-------------------------------------------------- +CREATE PARTITION FUNCTION PartitionFunctionNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz (bigint) +AS RANGE RIGHT FOR VALUES (0, 10000, 100, 1000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The identifier that starts with 'PartitionFunctionNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmno' is too long. Maximum length is 128.)~~ + + +CREATE PARTITION SCHEME PartitionSchemeNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz AS +PARTITION PartitionFunctionDoesNotExists +ALL TO ([PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The identifier that starts with 'PartitionSchemeNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopq' is too long. Maximum length is 128.)~~ + + + +-------------------------------------------------- +--- TO test Permission +-------------------------------------------------- +USE PartitionDb; +GO + +CREATE LOGIN partition_l1 WITH PASSWORD = '12345678'; +GO + +CREATE USER partition_u1 FOR LOGIN partition_l1; +GO + +-- tsql user=partition_l1 password=12345678 +USE PartitionDb; +GO + +SELECT CURRENT_USER +GO +~~START~~ +varchar +partition_u1 +~~END~~ + + + +-- CREATE/DROP should throw permission error +------------------------------------------------------------ +--- only db owner and logins which are member of sysadmin +--- are allowed to create/drop partition function and scheme +------------------------------------------------------------ +CREATE PARTITION FUNCTION TestPartitionFunction (int) +AS RANGE RIGHT FOR VALUES (500, 1000, 10000); +Go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: User does not have permission to perform this action.)~~ + + +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION PartitionFunctionDoesNotExists +ALL TO ([PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: User does not have permission to perform this action.)~~ + + +DROP PARTITION FUNCTION IntPartitionFunction +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the partition function 'IntPartitionFunction', because it does not exist or you do not have permission.)~~ + + +DROP PARTITION SCHEME IntPartitionScheme +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the partition scheme 'IntPartitionScheme', because it does not exist or you do not have permission.)~~ + + +------------------------------------------ +--- all user can access the metadata +------------------------------------------ +SELECT + name, type, type_desc, fanout, boundary_value_on_right, is_system + FROM + sys.partition_functions +go +~~START~~ +nvarchar#!#char#!#nvarchar#!#int#!#bit#!#bit +PartitionDb_PartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +~~END~~ + + +SELECT + ps.name as scheme_name, pf.name as function_name, ps.type, ps.type_desc, ps.is_default, ps.is_system + FROM + sys.partition_schemes ps + INNER JOIN + sys.partition_functions pf on (ps.function_id = pf.function_id) +go +~~START~~ +nvarchar#!#nvarchar#!#char#!#nvarchar#!#bit#!#bit +PartitionDb_PartitionScheme#!#PartitionDb_PartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +~~END~~ + + + +-- psql + +------------------------------------------------------------ +--- all user can use the metadata of the partition scheme +--- to create table if they permission to create table +------------------------------------------------------------ +-- grant create permission to user on schema so that it can create table +DO $$ +DECLARE + schema_name TEXT; +BEGIN + IF current_setting('babelfishpg_tsql.migration_mode') = 'multi-db' THEN + schema_name := 'partitiondb_dbo'; + ELSE + schema_name := 'dbo'; + END IF; + EXECUTE 'GRANT CREATE ON SCHEMA ' || quote_ident(schema_name) || ' TO partitiondb_partition_u1'; +END$$; +GO + +-- tsql user=partition_l1 password=12345678 +USE PartitionDb; +GO + +SELECT CURRENT_USER +GO +~~START~~ +varchar +partition_u1 +~~END~~ + + +CREATE TABLE PartitionDb_TestPartitionTable ( + Id INT, + Value sys.varchar(20) +) ON PartitionDb_PartitionScheme(Id); +GO + +DROP TABLE PartitionDb_TestPartitionTable +GO + +-- psql + +-- revoke create permission from user on schema +DO $$ +DECLARE + schema_name TEXT; +BEGIN + IF current_setting('babelfishpg_tsql.migration_mode') = 'multi-db' THEN + schema_name := 'partitiondb_dbo'; + ELSE + schema_name := 'dbo'; + END IF; + EXECUTE 'REVOKE CREATE ON SCHEMA ' || quote_ident(schema_name) || ' FROM partitiondb_partition_u1'; +END$$; +GO + +-- tsql +----------------------------------------------------------------------------------- +--- DB owner should be able to create/drop partition function and scheme +---------------------------------------------------------------------------------- +-- make the user a DB owner +USE PartitionDb; +GO + +DROP USER partition_u1; +GO + +execute sp_changedbowner 'partition_l1' +GO + +-- tsql user=partition_l1 password=12345678 +USE PartitionDb; +GO + +SELECT CURRENT_USER +GO +~~START~~ +varchar +dbo +~~END~~ + +-- CREATE/DROP should work now +CREATE PARTITION FUNCTION TestPartitionFunction (int) +AS RANGE RIGHT FOR VALUES (500, 1000, 10000); +Go + +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION TestPartitionFunction +ALL TO ([PRIMARY]); +GO + +DROP PARTITION SCHEME TestPartitionScheme +go + +DROP PARTITION FUNCTION TestPartitionFunction +go + +-- tsql +USE master +GO + + +------------------------------------------------------------------------------------------------------------ +--- Test error during Implicit Conversion of range values in Partition Function for each datatypes +------------------------------------------------------------------------------------------------------------ +CREATE PARTITION FUNCTION NewIntPartitionFunction (int) +AS RANGE RIGHT FOR VALUES (500, 1000, cast('xyz' as varchar)); +-- having duplicates also, but first it should try to convert and fail +CREATE PARTITION FUNCTION NewBigIntPartitionFunction (bigint) +AS RANGE RIGHT FOR VALUES (1000, 1000, 1000, cast('xyz' as varchar), 1000, 1000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewSmallIntPartitionFunction (smallint) +AS RANGE RIGHT FOR VALUES ('xyz', 32767, -32768); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 1 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewTinyIntPartitionFunction (tinyint) +AS RANGE RIGHT FOR VALUES (0, 255, cast('xyz' as varchar)); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewDecimalPartitionFunction (decimal(10, 5)) +AS RANGE RIGHT FOR VALUES (0.0, 300.0, 200.0, 'xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 4 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewNumericPartitionFunction (numeric(5, 2)) +AS RANGE RIGHT FOR VALUES (0.0, 30.0, 10.0, 'xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 4 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewDatePartitionFunction (date) +AS RANGE RIGHT FOR VALUES ('2022-07-01', '2022-01-01','xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewDateTimePartitionFunction (datetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01 00:00:00', 'xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewDateTime2PartitionFunction (datetime2(3)) +AS RANGE RIGHT FOR VALUES ('2022-01-01 00:00:00.000', '2022-07-01 00:00:00.000', 'xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewSmallDateTimePartitionFunction (smalldatetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01', cast(0x123 as binary(4))); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewCharPartitionFunction (char(5)) +AS RANGE RIGHT FOR VALUES ('A', 'F', 'K', 'P', 'U', 'Z', cast(0x123 as binary(4))); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 7 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewNCharPartitionFunction (nchar(5)) +AS RANGE RIGHT FOR VALUES (N'A', N'F', N'K', N'P', N'U', N'Z', cast(0x123 as binary(4))); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 7 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewBinaryPartitionFunction (binary(4)) +AS RANGE RIGHT FOR VALUES (0x000, 0x800, 0x400, 'xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 4 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewVarBinaryPartitionFunction (varbinary(8)) +AS RANGE RIGHT FOR VALUES (0x0000000000000000, 0x8000000000000000, 0x4000000000000000, 'xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 4 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewUniqueIdentifierPartitionFunction (uniqueidentifier) +AS RANGE RIGHT FOR VALUES ('00000000-0000-0000-0000-000000000000', 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF', 123); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + + +-------------------------------------------------- +--- DROP PARTITION FUNCTION/SCHEME/TABLE using procedure +-------------------------------------------------- +EXEC PartitionProcedureDropPartitionTable +GO + +EXEC PartitionProcedureDropPartitionScheme +GO + +EXEC PartitionProcedureDropPartitionFunction +GO + +EXEC PartitionProcedureDropPartitionFunctionSchemeAndTable +GO + + +--------------------------------------------------------------------------- +--- PARTITIONED TABLES test +--------------------------------------------------------------------------- +SELECT * FROM GetPartitionedTableListFromSysTablesView +GO +~~START~~ +varchar +partition_vu_prepare_bigint_table +partition_vu_prepare_binary_table +partition_vu_prepare_char_table +partition_vu_prepare_date_table +partition_vu_prepare_datetime_table +partition_vu_prepare_datetime2_table +partition_vu_prepare_decimal_table +partition_vu_prepare_int_table +partition_vu_prepare_money_table +partition_vu_prepare_nchar_table +partition_vu_prepare_normal_table +partition_vu_prepare_numeric_table +partition_vu_prepare_nvarchar_table +partition_vu_prepare_smalldatetime_table +partition_vu_prepare_smallint_table +partition_vu_prepare_smallmoney_table +partition_vu_prepare_tinyint_table +partition_vu_prepare_uniqueidentifier_table +partition_vu_prepare_varbinary_table +partition_vu_prepare_varchar_table +~~END~~ + + +--------------------------------------------------------------------------- +--- PARTITIONED INDEX test +--------------------------------------------------------------------------- +SELECT * FROM GetPartitionedIndexListFromSysIndexesView +GO +~~START~~ +varchar +partition_vu_prepare_bigint_ind877afb285426cec9d46b047e3cf96f63 +partition_vu_prepare_binary_ind48a88b3c8178211af1ed1dcf4cfbe503 +partition_vu_prepare_char_index32fed8129381de1b5745e90cd811516f +partition_vu_prepare_date_indexf571a291edad587ba646fc34c4566844 +partition_vu_prepare_datetime_i364577d0a406eee6e806be980ac15d2e +partition_vu_prepare_datetime2_4cad7647322c234b34b97cddb3cd1ad6 +partition_vu_prepare_decimal_infc7570aeccbb040dde39974c476a7ec9 +partition_vu_prepare_int_indexpbbe9a6f0ef5edf6e63fa853dac4ed046 +partition_vu_prepare_int_table_id_key +partition_vu_prepare_money_inde9b6a61ad06c0883c6d0f95b2fec9eeee +partition_vu_prepare_nchar_indecdc4872501ea902494c8f710f4e9dbb1 +partition_vu_prepare_normal_inded6315af14d88f45711ba24e46851b8f +partition_vu_prepare_numeric_inf04f315c86929345e23bee80713cf963 +partition_vu_prepare_nvarchar_if89fa8cc46282fa6dc23e9f5b834f3ec +partition_vu_prepare_smalldatetfe8f8bfb8c766f9a1bcd804238ff35d8 +partition_vu_prepare_smallint_i3eae48e3a131ed23416aa2891b58d579 +partition_vu_prepare_smallmoney68389bf5dc5c581b33c4dbb8a3dc1dc8 +partition_vu_prepare_tinyint_in02b271c73e639954190c6a45bd5dd1bb +partition_vu_prepare_uniqueidend39220cd3f46c5b2cea8c338a387aedf +partition_vu_prepare_varbinary_26e1223f68c4186a96126a57446ac386 +partition_vu_prepare_varchar_inc528f397ba573964de161e03035b8f08 +~~END~~ + + + +---------------------------------------------------------------------------------------------- +--- System views should list only metadata of Partitioned table(not of the partitions) +---------------------------------------------------------------------------------------------- +SELECT count(*) from sys.tables where name = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +1 +~~END~~ + + +SELECT count(*) from sys.all_columns where object_id = OBJECT_ID('partition_vu_prepare_int_table') +GO +~~START~~ +int +2 +~~END~~ + + +SELECT count(*) from sys.columns where object_id = OBJECT_ID('partition_vu_prepare_int_table') +GO +~~START~~ +int +2 +~~END~~ + + +SELECT count(*) from sys.indexes where object_id = OBJECT_ID('partition_vu_prepare_int_table') +GO +~~START~~ +int +3 +~~END~~ + + +SELECT count(*) from sys.index_columns where object_id = OBJECT_ID('partition_vu_prepare_int_table') +GO +~~START~~ +int +5 +~~END~~ + + +SELECT count(*) from sys.all_objects where name = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +1 +~~END~~ + + +SELECT count(*) from sys.sp_tables_view where TABLE_NAME = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +1 +~~END~~ + + +SELECT count(*) from information_schema.columns where TABLE_NAME = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +2 +~~END~~ + + +SELECT count(*) from information_schema.tables where TABLE_NAME = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +1 +~~END~~ + + +SELECT count(*) from information_schema.table_constraints where TABLE_NAME = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +2 +~~END~~ + + +SELECT count(*) from information_schema.CONSTRAINT_COLUMN_USAGE where TABLE_NAME = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +2 +~~END~~ + + +SELECT count(*) from information_schema.key_column_usage where TABLE_NAME = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +1 +~~END~~ + + +--------------------------------------------------------- +--- System views should not list metadata of Partitions +--------------------------------------------------------- +SELECT count(*) from sys.tables where name = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from sys.all_columns where object_id = OBJECT_ID('363863941f079adaa9aa733200e57c9f_partition_0') +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from sys.columns where object_id = OBJECT_ID('363863941f079adaa9aa733200e57c9f_partition_0') +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from sys.indexes where object_id = OBJECT_ID('363863941f079adaa9aa733200e57c9f_partition_0') +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from sys.index_columns where object_id = OBJECT_ID('363863941f079adaa9aa733200e57c9f_partition_0') +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from sys.all_objects where name = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from sys.sp_tables_view where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from information_schema.columns where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from information_schema.tables where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from information_schema.table_constraints where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from information_schema.CONSTRAINT_COLUMN_USAGE where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from information_schema.key_column_usage where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + + + +-- psql +--------------------------------------------------------------------------- +--- Run analyze on each table and enable query plan +--------------------------------------------------------------------------- +ANALYZE master_dbo.partition_vu_prepare_int_table; +ANALYZE master_dbo.partition_vu_prepare_bigint_table; +ANALYZE master_dbo.partition_vu_prepare_smallint_table; +ANALYZE master_dbo.partition_vu_prepare_tinyint_table; +ANALYZE master_dbo.partition_vu_prepare_decimal_table; +ANALYZE master_dbo.partition_vu_prepare_numeric_table; +ANALYZE master_dbo.partition_vu_prepare_money_table; +ANALYZE master_dbo.partition_vu_prepare_smallmoney_table; +ANALYZE master_dbo.partition_vu_prepare_date_table; +ANALYZE master_dbo.partition_vu_prepare_datetime_table; +ANALYZE master_dbo.partition_vu_prepare_datetime2_table; +ANALYZE master_dbo.partition_vu_prepare_smalldatetime_table; +ANALYZE master_dbo.partition_vu_prepare_char_table; +ANALYZE master_dbo.partition_vu_prepare_varchar_table; +ANALYZE master_dbo.partition_vu_prepare_nvarchar_table; +ANALYZE master_dbo.partition_vu_prepare_nchar_table; +ANALYZE master_dbo.partition_vu_prepare_binary_table; +ANALYZE master_dbo.partition_vu_prepare_varbinary_table; +ANALYZE master_dbo.partition_vu_prepare_uniqueidentifier_table; +GO + +-- tsql +SELECT set_config('babelfishpg_tsql.explain_costs', 'off', false) +GO +~~START~~ +text +off +~~END~~ + + +SET BABELFISH_SHOWPLAN_ALL ON +GO + + +--------------------------------------------------------------------------- +--- Query plan of select on partitioned tables +--------------------------------------------------------------------------- +SELECT * FROM partition_vu_prepare_int_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_int_table +Append + -> Seq Scan on "363863941f079adaa9aa733200e57c9f_partition_1" partition_vu_prepare_int_table_1 + -> Seq Scan on "363863941f079adaa9aa733200e57c9f_partition_2" partition_vu_prepare_int_table_2 + -> Seq Scan on "363863941f079adaa9aa733200e57c9f_partition_3" partition_vu_prepare_int_table_3 + -> Seq Scan on "363863941f079adaa9aa733200e57c9f_partition_0" partition_vu_prepare_int_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.752 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_bigint_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_bigint_table +Append + -> Seq Scan on "548bb344374ce8d65342b36428375873_partition_1" partition_vu_prepare_bigint_table_1 + -> Seq Scan on "548bb344374ce8d65342b36428375873_partition_2" partition_vu_prepare_bigint_table_2 + -> Seq Scan on "548bb344374ce8d65342b36428375873_partition_3" partition_vu_prepare_bigint_table_3 + -> Seq Scan on "548bb344374ce8d65342b36428375873_partition_4" partition_vu_prepare_bigint_table_4 + -> Seq Scan on "548bb344374ce8d65342b36428375873_partition_0" partition_vu_prepare_bigint_table_5 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.129 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_smallint_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_smallint_table +Append + -> Seq Scan on "12025e103721b70925744c196ce004cd_partition_1" partition_vu_prepare_smallint_table_1 + -> Seq Scan on "12025e103721b70925744c196ce004cd_partition_2" partition_vu_prepare_smallint_table_2 + -> Seq Scan on "12025e103721b70925744c196ce004cd_partition_3" partition_vu_prepare_smallint_table_3 + -> Seq Scan on "12025e103721b70925744c196ce004cd_partition_0" partition_vu_prepare_smallint_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.124 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_tinyint_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_tinyint_table +Append + -> Seq Scan on "61446d711d19b5970809387caa7fd3d3_partition_1" partition_vu_prepare_tinyint_table_1 + -> Seq Scan on "61446d711d19b5970809387caa7fd3d3_partition_2" partition_vu_prepare_tinyint_table_2 + -> Seq Scan on "61446d711d19b5970809387caa7fd3d3_partition_3" partition_vu_prepare_tinyint_table_3 + -> Seq Scan on "61446d711d19b5970809387caa7fd3d3_partition_0" partition_vu_prepare_tinyint_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.099 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_decimal_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_decimal_table +Append + -> Seq Scan on cda2902d769fd61eb60b1a461650212f_partition_1 partition_vu_prepare_decimal_table_1 + -> Seq Scan on cda2902d769fd61eb60b1a461650212f_partition_2 partition_vu_prepare_decimal_table_2 + -> Seq Scan on cda2902d769fd61eb60b1a461650212f_partition_3 partition_vu_prepare_decimal_table_3 + -> Seq Scan on cda2902d769fd61eb60b1a461650212f_partition_4 partition_vu_prepare_decimal_table_4 + -> Seq Scan on cda2902d769fd61eb60b1a461650212f_partition_0 partition_vu_prepare_decimal_table_5 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.095 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_numeric_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_numeric_table +Append + -> Seq Scan on "57405760297bb338f333c148aac5f845_partition_1" partition_vu_prepare_numeric_table_1 + -> Seq Scan on "57405760297bb338f333c148aac5f845_partition_2" partition_vu_prepare_numeric_table_2 + -> Seq Scan on "57405760297bb338f333c148aac5f845_partition_3" partition_vu_prepare_numeric_table_3 + -> Seq Scan on "57405760297bb338f333c148aac5f845_partition_4" partition_vu_prepare_numeric_table_4 + -> Seq Scan on "57405760297bb338f333c148aac5f845_partition_0" partition_vu_prepare_numeric_table_5 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.095 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_money_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_money_table +Append + -> Seq Scan on "640187c54e2c2984d190957d245a5fa5_partition_1" partition_vu_prepare_money_table_1 + -> Seq Scan on "640187c54e2c2984d190957d245a5fa5_partition_2" partition_vu_prepare_money_table_2 + -> Seq Scan on "640187c54e2c2984d190957d245a5fa5_partition_3" partition_vu_prepare_money_table_3 + -> Seq Scan on "640187c54e2c2984d190957d245a5fa5_partition_0" partition_vu_prepare_money_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.130 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_smallmoney_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_smallmoney_table +Append + -> Seq Scan on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_1" partition_vu_prepare_smallmoney_table_1 + -> Seq Scan on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_2" partition_vu_prepare_smallmoney_table_2 + -> Seq Scan on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_3" partition_vu_prepare_smallmoney_table_3 + -> Seq Scan on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_0" partition_vu_prepare_smallmoney_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.131 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_date_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_date_table +Append + -> Seq Scan on "4867824426e52acac5c93d9cbe8aa366_partition_1" partition_vu_prepare_date_table_1 + -> Seq Scan on "4867824426e52acac5c93d9cbe8aa366_partition_2" partition_vu_prepare_date_table_2 + -> Seq Scan on "4867824426e52acac5c93d9cbe8aa366_partition_3" partition_vu_prepare_date_table_3 + -> Seq Scan on "4867824426e52acac5c93d9cbe8aa366_partition_0" partition_vu_prepare_date_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.093 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_datetime_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_datetime_table +Append + -> Seq Scan on "751ce655481adf15600727bf291667f7_partition_1" partition_vu_prepare_datetime_table_1 + -> Seq Scan on "751ce655481adf15600727bf291667f7_partition_2" partition_vu_prepare_datetime_table_2 + -> Seq Scan on "751ce655481adf15600727bf291667f7_partition_3" partition_vu_prepare_datetime_table_3 + -> Seq Scan on "751ce655481adf15600727bf291667f7_partition_0" partition_vu_prepare_datetime_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.091 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_datetime2_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_datetime2_table +Append + -> Seq Scan on "5ed003cf80dacbb8cce0b21e175f7f94_partition_1" partition_vu_prepare_datetime2_table_1 + -> Seq Scan on "5ed003cf80dacbb8cce0b21e175f7f94_partition_2" partition_vu_prepare_datetime2_table_2 + -> Seq Scan on "5ed003cf80dacbb8cce0b21e175f7f94_partition_3" partition_vu_prepare_datetime2_table_3 + -> Seq Scan on "5ed003cf80dacbb8cce0b21e175f7f94_partition_0" partition_vu_prepare_datetime2_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.098 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_smalldatetime_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_smalldatetime_table +Append + -> Seq Scan on b5c2e665ec4a1219ba8510e33e45379b_partition_1 partition_vu_prepare_smalldatetime_table_1 + -> Seq Scan on b5c2e665ec4a1219ba8510e33e45379b_partition_2 partition_vu_prepare_smalldatetime_table_2 + -> Seq Scan on b5c2e665ec4a1219ba8510e33e45379b_partition_3 partition_vu_prepare_smalldatetime_table_3 + -> Seq Scan on b5c2e665ec4a1219ba8510e33e45379b_partition_0 partition_vu_prepare_smalldatetime_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.096 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_char_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_char_table +Append + -> Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_1" partition_vu_prepare_char_table_1 + -> Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_2" partition_vu_prepare_char_table_2 + -> Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_3" partition_vu_prepare_char_table_3 + -> Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_4" partition_vu_prepare_char_table_4 + -> Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_5" partition_vu_prepare_char_table_5 + -> Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_6" partition_vu_prepare_char_table_6 + -> Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_7" partition_vu_prepare_char_table_7 + -> Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_0" partition_vu_prepare_char_table_8 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.094 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_varchar_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_varchar_table +Append + -> Seq Scan on "933a5c7f0de13890324e53ee0711424b_partition_1" partition_vu_prepare_varchar_table_1 + -> Seq Scan on "933a5c7f0de13890324e53ee0711424b_partition_2" partition_vu_prepare_varchar_table_2 + -> Seq Scan on "933a5c7f0de13890324e53ee0711424b_partition_3" partition_vu_prepare_varchar_table_3 + -> Seq Scan on "933a5c7f0de13890324e53ee0711424b_partition_4" partition_vu_prepare_varchar_table_4 + -> Seq Scan on "933a5c7f0de13890324e53ee0711424b_partition_5" partition_vu_prepare_varchar_table_5 + -> Seq Scan on "933a5c7f0de13890324e53ee0711424b_partition_0" partition_vu_prepare_varchar_table_6 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.097 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_nvarchar_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_nvarchar_table +Append + -> Seq Scan on "320465af1d1bd21f5b29c57f9f4e5c51_partition_1" partition_vu_prepare_nvarchar_table_1 + -> Seq Scan on "320465af1d1bd21f5b29c57f9f4e5c51_partition_2" partition_vu_prepare_nvarchar_table_2 + -> Seq Scan on "320465af1d1bd21f5b29c57f9f4e5c51_partition_3" partition_vu_prepare_nvarchar_table_3 + -> Seq Scan on "320465af1d1bd21f5b29c57f9f4e5c51_partition_4" partition_vu_prepare_nvarchar_table_4 + -> Seq Scan on "320465af1d1bd21f5b29c57f9f4e5c51_partition_5" partition_vu_prepare_nvarchar_table_5 + -> Seq Scan on "320465af1d1bd21f5b29c57f9f4e5c51_partition_0" partition_vu_prepare_nvarchar_table_6 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.097 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_nchar_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_nchar_table +Append + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_1 partition_vu_prepare_nchar_table_1 + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_2 partition_vu_prepare_nchar_table_2 + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_3 partition_vu_prepare_nchar_table_3 + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_4 partition_vu_prepare_nchar_table_4 + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_5 partition_vu_prepare_nchar_table_5 + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_6 partition_vu_prepare_nchar_table_6 + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_7 partition_vu_prepare_nchar_table_7 + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_0 partition_vu_prepare_nchar_table_8 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.095 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_binary_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_binary_table +Append + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_1" partition_vu_prepare_binary_table_1 + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_2" partition_vu_prepare_binary_table_2 + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_3" partition_vu_prepare_binary_table_3 + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_4" partition_vu_prepare_binary_table_4 + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_0" partition_vu_prepare_binary_table_5 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.094 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_varbinary_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_varbinary_table +Append + -> Seq Scan on "77718961234110c3a22a3c977bc252d8_partition_1" partition_vu_prepare_varbinary_table_1 + -> Seq Scan on "77718961234110c3a22a3c977bc252d8_partition_2" partition_vu_prepare_varbinary_table_2 + -> Seq Scan on "77718961234110c3a22a3c977bc252d8_partition_3" partition_vu_prepare_varbinary_table_3 + -> Seq Scan on "77718961234110c3a22a3c977bc252d8_partition_4" partition_vu_prepare_varbinary_table_4 + -> Seq Scan on "77718961234110c3a22a3c977bc252d8_partition_0" partition_vu_prepare_varbinary_table_5 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.098 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_uniqueidentifier_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_uniqueidentifier_table +Append + -> Seq Scan on f3baf999c06d6ea82082a4c549baeb77_partition_1 partition_vu_prepare_uniqueidentifier_table_1 + -> Seq Scan on f3baf999c06d6ea82082a4c549baeb77_partition_2 partition_vu_prepare_uniqueidentifier_table_2 + -> Seq Scan on f3baf999c06d6ea82082a4c549baeb77_partition_3 partition_vu_prepare_uniqueidentifier_table_3 + -> Seq Scan on f3baf999c06d6ea82082a4c549baeb77_partition_0 partition_vu_prepare_uniqueidentifier_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.096 ms +~~END~~ + + +----------------------------------------------------------------------------------------- +--- Query plan of select on partitioned tables with predicate and enforced index scan +----------------------------------------------------------------------------------------- +SET BABELFISH_SHOWPLAN_ALL OFF +GO + +SELECT set_config('enable_seqscan', 'off', false); +SELECT set_config('enable_bitmapscan', 'off', false); +GO +~~START~~ +text +off +~~END~~ + +~~START~~ +text +off +~~END~~ + + +SET BABELFISH_SHOWPLAN_ALL ON +GO + + +SELECT * FROM partition_vu_prepare_int_table WHERE Id >= 0 AND Id < 500; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_int_table WHERE Id >= 0 AND Id < 500 +Index Scan using "363863941f079adaa9aa733200e57c9f_partition_1_id_key" on "363863941f079adaa9aa733200e57c9f_partition_1" partition_vu_prepare_int_table + Index Cond: ((id >= 0) AND (id < 500)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 11.417 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_bigint_table WHERE Id >= 0 AND Id < 100; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_bigint_table WHERE Id >= 0 AND Id < 100 +Index Scan using "548bb344374ce8d65342b36428375873_partition_1_id_idx" on "548bb344374ce8d65342b36428375873_partition_1" partition_vu_prepare_bigint_table + Index Cond: ((id >= 0) AND (id < 100)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.174 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_smallint_table WHERE Id >= -32768 AND Id < 0; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_smallint_table WHERE Id >= -32768 AND Id < 0 +Index Scan using "12025e103721b70925744c196ce004cd_partition_1_id_idx" on "12025e103721b70925744c196ce004cd_partition_1" partition_vu_prepare_smallint_table + Index Cond: ((id >= '-32768'::integer) AND (id < 0)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 7.570 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_tinyint_table WHERE Id >= 0 AND Id < 128; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_tinyint_table WHERE Id >= 0 AND Id < 128 +Index Scan using "61446d711d19b5970809387caa7fd3d3_partition_1_id_idx" on "61446d711d19b5970809387caa7fd3d3_partition_1" partition_vu_prepare_tinyint_table + Index Cond: (((id)::smallint >= 0) AND ((id)::smallint < 128)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.175 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_decimal_table WHERE Id >= 0.0 AND Id < 100.0; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_decimal_table WHERE Id >= 0.0 AND Id < 100.0 +Index Scan using cda2902d769fd61eb60b1a461650212f_partition_1_id_idx on cda2902d769fd61eb60b1a461650212f_partition_1 partition_vu_prepare_decimal_table + Index Cond: (((id)::numeric >= 0.0) AND ((id)::numeric < 100.0)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 6.722 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_numeric_table WHERE Id >= 0.0 AND Id < 10.0; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_numeric_table WHERE Id >= 0.0 AND Id < 10.0 +Index Scan using "57405760297bb338f333c148aac5f845_partition_1_id_idx" on "57405760297bb338f333c148aac5f845_partition_1" partition_vu_prepare_numeric_table + Index Cond: ((id >= 0.0) AND (id < 10.0)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.194 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_money_table WHERE Id >= 2.56789 AND Id < 3.56789; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_money_table WHERE Id >= 2.56789 AND Id < 3.56789 +Append + -> Index Scan using "640187c54e2c2984d190957d245a5fa5_partition_1_id_idx" on "640187c54e2c2984d190957d245a5fa5_partition_1" partition_vu_prepare_money_table_1 + Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + -> Index Scan using "640187c54e2c2984d190957d245a5fa5_partition_0_id_idx" on "640187c54e2c2984d190957d245a5fa5_partition_0" partition_vu_prepare_money_table_2 + Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.230 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_smallmoney_table WHERE Id >= 2.56789 AND Id < 3.56789; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_smallmoney_table WHERE Id >= 2.56789 AND Id < 3.56789 +Append + -> Index Scan using "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_1_id_idx" on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_1" partition_vu_prepare_smallmoney_table_1 + Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + -> Index Scan using "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_0_id_idx" on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_0" partition_vu_prepare_smallmoney_table_2 + Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.163 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_date_table WHERE Id >= '2022-01-01' AND Id < '2022-07-01'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_date_table WHERE Id >= '2022-01-01' AND Id < '2022-07-01' +Index Scan using "4867824426e52acac5c93d9cbe8aa366_partition_1_id_idx" on "4867824426e52acac5c93d9cbe8aa366_partition_1" partition_vu_prepare_date_table + Index Cond: ((id >= '2022-01-01'::date) AND (id < '2022-07-01'::date)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.273 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_datetime_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_datetime_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01' +Index Scan using "751ce655481adf15600727bf291667f7_partition_1_id_idx" on "751ce655481adf15600727bf291667f7_partition_1" partition_vu_prepare_datetime_table + Index Cond: ((id >= '2019-01-01 00:00:00'::datetime) AND (id < '2022-01-01 00:00:00'::datetime)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.170 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_datetime2_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_datetime2_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01' +Index Scan using "5ed003cf80dacbb8cce0b21e175f7f94_partition_1_id_idx" on "5ed003cf80dacbb8cce0b21e175f7f94_partition_1" partition_vu_prepare_datetime2_table + Index Cond: ((id >= '2019-01-01 00:00:00'::datetime2) AND (id < '2022-01-01 00:00:00'::datetime2)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.169 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_smalldatetime_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_smalldatetime_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01' +Index Scan using b5c2e665ec4a1219ba8510e33e45379b_partition_1_id_idx on b5c2e665ec4a1219ba8510e33e45379b_partition_1 partition_vu_prepare_smalldatetime_table + Index Cond: ((id >= '2019-01-01 00:00:00'::smalldatetime) AND (id < '2022-01-01 00:00:00'::smalldatetime)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.246 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_char_table WHERE Id >= 'A' AND Id < 'B'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_char_table WHERE Id >= 'A' AND Id < 'B' +Index Scan using "5d20bd977eb6e6f1304dec45598c09f5_partition_1_id_idx" on "5d20bd977eb6e6f1304dec45598c09f5_partition_1" partition_vu_prepare_char_table + Index Cond: ((id >= 'A'::bpchar) AND (id < 'B'::bpchar)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.180 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_varchar_table WHERE Id >= 'Apple' AND Id < 'Banana'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_varchar_table WHERE Id >= 'Apple' AND Id < 'Banana' +Index Scan using "933a5c7f0de13890324e53ee0711424b_partition_1_id_idx" on "933a5c7f0de13890324e53ee0711424b_partition_1" partition_vu_prepare_varchar_table + Index Cond: ((id >= 'Apple'::"varchar") AND (id < 'Banana'::"varchar")) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.168 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_nvarchar_table WHERE Id >= N'Apple' AND Id < N'Banana'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_nvarchar_table WHERE Id >= N'Apple' AND Id < N'Banana' +Index Scan using "320465af1d1bd21f5b29c57f9f4e5c51_partition_1_id_idx" on "320465af1d1bd21f5b29c57f9f4e5c51_partition_1" partition_vu_prepare_nvarchar_table + Index Cond: (((id)::"varchar" >= 'Apple'::"varchar") AND ((id)::"varchar" < 'Banana'::"varchar")) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.172 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_nchar_table WHERE Id >= N'A' AND Id < N'B'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_nchar_table WHERE Id >= N'A' AND Id < N'B' +Gather + Workers Planned: 2 + -> Parallel Append + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_3 partition_vu_prepare_nchar_table_3 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_5 partition_vu_prepare_nchar_table_5 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_7 partition_vu_prepare_nchar_table_7 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_1 partition_vu_prepare_nchar_table_1 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_2 partition_vu_prepare_nchar_table_2 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_4 partition_vu_prepare_nchar_table_4 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_6 partition_vu_prepare_nchar_table_6 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_0 partition_vu_prepare_nchar_table_8 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.184 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_binary_table WHERE Id >= 0x0000 AND Id < 0x0400; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_binary_table WHERE Id >= 0x0000 AND Id < 0x0400 +Append + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_1" partition_vu_prepare_binary_table_1 + Filter: (((id)::bbf_varbinary >= '0x0000'::bbf_varbinary) AND ((id)::bbf_varbinary < '0x0400'::bbf_varbinary)) + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_2" partition_vu_prepare_binary_table_2 + Filter: (((id)::bbf_varbinary >= '0x0000'::bbf_varbinary) AND ((id)::bbf_varbinary < '0x0400'::bbf_varbinary)) + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_3" partition_vu_prepare_binary_table_3 + Filter: (((id)::bbf_varbinary >= '0x0000'::bbf_varbinary) AND ((id)::bbf_varbinary < '0x0400'::bbf_varbinary)) + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_4" partition_vu_prepare_binary_table_4 + Filter: (((id)::bbf_varbinary >= '0x0000'::bbf_varbinary) AND ((id)::bbf_varbinary < '0x0400'::bbf_varbinary)) + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_0" partition_vu_prepare_binary_table_5 + Filter: (((id)::bbf_varbinary >= '0x0000'::bbf_varbinary) AND ((id)::bbf_varbinary < '0x0400'::bbf_varbinary)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 7.260 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_varbinary_table WHERE Id >= 0x0000000000000000 AND Id < 0x4000000000000000; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_varbinary_table WHERE Id >= 0x0000000000000000 AND Id < 0x4000000000000000 +Index Scan using "77718961234110c3a22a3c977bc252d8_partition_1_id_idx" on "77718961234110c3a22a3c977bc252d8_partition_1" partition_vu_prepare_varbinary_table + Index Cond: (((id)::bbf_varbinary >= '0x0000000000000000'::bbf_varbinary) AND ((id)::bbf_varbinary < '0x4000000000000000'::bbf_varbinary)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.180 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_uniqueidentifier_table WHERE Id >= '00000000-0000-0000-0000-000000000000' AND Id < '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_uniqueidentifier_table WHERE Id >= '00000000-0000-0000-0000-000000000000' AND Id < '6F9619FF-8B86-D011-B42D-00C04FC964FF' +Index Scan using f3baf999c06d6ea82082a4c549baeb77_partition_1_id_idx on f3baf999c06d6ea82082a4c549baeb77_partition_1 partition_vu_prepare_uniqueidentifier_table + Index Cond: ((id >= '00000000-0000-0000-0000-000000000000'::uniqueidentifier) AND (id < '6F9619FF-8B86-D011-B42D-00C04FC964FF'::uniqueidentifier)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.198 ms +~~END~~ + + +SET BABELFISH_SHOWPLAN_ALL OFF +GO + +SELECT set_config('enable_seqscan', 'on', false); +SELECT set_config('enable_bitmapscan', 'on', false); +SELECT set_config('babelfishpg_tsql.explain_costs', 'on', false) +GO +~~START~~ +text +on +~~END~~ + +~~START~~ +text +on +~~END~~ + +~~START~~ +text +on +~~END~~ + + + + +-- psql +------------------------------------------ +--- Blocked Operation For Partitioned Tables +------------------------------------------- +-- user should not be allowed to CREATE/ATTACH/DETACH partition +-- to babelfish partitioned table from psql endpoint +SET ROLE master_dbo; +GO + +-- Attempt to create new partition with random values +CREATE TABLE NonExistentTable PARTITION OF master_dbo.partition_vu_prepare_int_table +FOR VALUES FROM (0) TO (500); +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: partition "nonexistenttable" would overlap partition "363863941f079adaa9aa733200e57c9f_partition_1" + Position: 157 + Server SQLState: 42P17)~~ + + +-- Attempt to create new partition with DEFAULT +CREATE TABLE NonExistentTable PARTITION OF master_dbo.partition_vu_prepare_int_table +DEFAULT +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: partition "nonexistenttable" conflicts with existing default partition "363863941f079adaa9aa733200e57c9f_partition_0" + Position: 134 + Server SQLState: 42P17)~~ + + +-- Attempt to drop partition of babelfish partitioned table from psql endpoint +DROP TABLE master_dbo."363863941f079adaa9aa733200e57c9f_partition_0"; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot drop the babelfish partition table '363863941f079adaa9aa733200e57c9f_partition_0'. + Server SQLState: 42704)~~ + + + +-- Attempt to detach +-- explicit schema name specified +ALTER TABLE master_dbo.partition_vu_prepare_int_table +DETACH PARTITION master_dbo."363863941f079adaa9aa733200e57c9f_partition_0"; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot detach partition from babelfish partitioned table 'partition_vu_prepare_int_table'. + Server SQLState: 0A000)~~ + + +-- using search_path +SET search_path = public, master_dbo; +ALTER TABLE master_dbo.partition_vu_prepare_int_table +DETACH PARTITION master_dbo."363863941f079adaa9aa733200e57c9f_partition_0"; +RESET search_path; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot detach partition from babelfish partitioned table 'partition_vu_prepare_int_table'. + Server SQLState: 0A000)~~ + + +-- Attempt to detach using CONCURRENTLY option +ALTER TABLE master_dbo.partition_vu_prepare_int_table +DETACH PARTITION master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +CONCURRENTLY; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot detach partition from babelfish partitioned table 'partition_vu_prepare_int_table'. + Server SQLState: 0A000)~~ + + +-- Attempt to detach using FINALIZE option +ALTER TABLE master_dbo.partition_vu_prepare_int_table +DETACH PARTITION master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +FINALIZE; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot detach partition from babelfish partitioned table 'partition_vu_prepare_int_table'. + Server SQLState: 0A000)~~ + + +-- Attempt to attach with Default value +ALTER TABLE master_dbo.partition_vu_prepare_int_table +ATTACH PARTITION NonExistentTable DEFAULT; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot attach partition to babelfish partitioned table 'partition_vu_prepare_int_table'. + Server SQLState: 0A000)~~ + + +-- Attempt to attach with random value +ALTER TABLE master_dbo.partition_vu_prepare_int_table +ATTACH PARTITION NonExistentTable FOR VALUES FROM (10) TO (20); +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot attach partition to babelfish partitioned table 'partition_vu_prepare_int_table'. + Server SQLState: 0A000)~~ + + + +-- user should not be allowed to modify partition +-- of babelfish partitioned table neither from psql nor tsql endpoint +-- explicit schema name specified +ALTER TABLE master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +ADD CONSTRAINT xyz CHECK ( id > 10 and id < 20); +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Modifying partitions directly is not supported. You can modify the partitions by modifying the parent table. + Server SQLState: 0A000)~~ + + +-- using search_path +SET search_path = public, master_dbo; +ALTER TABLE "363863941f079adaa9aa733200e57c9f_partition_0" +ADD CONSTRAINT xyz CHECK ( id > 10 and id < 20); +RESET search_path; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Modifying partitions directly is not supported. You can modify the partitions by modifying the parent table. + Server SQLState: 0A000)~~ + + +RESET ROLE; +GO + +-- Attempt to ADD storage parameter to babelfish partitioned table (not on the partitions) +SET babelfishpg_tsql.sql_dialect = "tsql"; +GO + +ALTER TABLE master_dbo.partition_vu_prepare_int_table SET (autovacuum_enabled = false); +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: cannot specify storage parameters for a partitioned table + Hint: Specify storage parameters for its leaf partitions instead. + Server SQLState: 42809)~~ + + +RESET babelfishpg_tsql.sql_dialect; +GO + + +-- tsql +ALTER TABLE [363863941f079adaa9aa733200e57c9f_partition_0] +ADD new_col int +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Modifying partitions directly is not supported. You can modify the partitions by modifying the parent table.)~~ + + + +ALTER TABLE [363863941f079adaa9aa733200e57c9f_partition_0] +ADD CONSTRAINT xyz DEFAULT 10 FOR id; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Modifying partitions directly is not supported. You can modify the partitions by modifying the parent table.)~~ + + +-- with explicity schema name +ALTER TABLE dbo.[363863941f079adaa9aa733200e57c9f_partition_0] +ADD new_col int +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Modifying partitions directly is not supported. You can modify the partitions by modifying the parent table.)~~ + + +ALTER TABLE dbo.[363863941f079adaa9aa733200e57c9f_partition_0] +ADD CONSTRAINT xyz DEFAULT 10 FOR id; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Modifying partitions directly is not supported. You can modify the partitions by modifying the parent table.)~~ + + +-- Attempt to drop partition of babelfish partitioned table from tsql endpoint +DROP TABLE [363863941f079adaa9aa733200e57c9f_partition_0] +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the babelfish partition table '363863941f079adaa9aa733200e57c9f_partition_0'.)~~ + + +-- psql +-------------------------------------------------------------------- +-- user should not be allowed to rename partition of +-- babelfish partitioned table neither from psql nor tsql endpoint +-------------------------------------------------------------------- +-- Attempt to rename partition of babelfish partitioned table from psql endpoint +-- explicit schema name specified +ALTER TABLE master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +RENAME TO xyz +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot rename babelfish partition table '363863941f079adaa9aa733200e57c9f_partition_0'. + Server SQLState: 0A000)~~ + + +-- using search_path +SET search_path = public, master_dbo; +ALTER TABLE "363863941f079adaa9aa733200e57c9f_partition_1" +RENAME TO xyz1 +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot rename babelfish partition table '363863941f079adaa9aa733200e57c9f_partition_1'. + Server SQLState: 0A000)~~ + + +-- tsql +-- Attempt to rename partition of babelfish partitioned table from tsql endpoint +-- NOTE: object not found error because sp_rename lookup in sys.objects which +-- will not list child objects +EXEC sp_rename '363863941f079adaa9aa733200e57c9f_partition_2', 'xyz2', 'OBJECT' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: There is no object with the given @objname.)~~ + + +-------------------------------------------------------------------- +--- Unsupported Option with CREATE TABLE with PARTITION SCHEME +-------------------------------------------------------------------- +-- Computed column as partitioning column is not yet supported in babelfish +CREATE TABLE TestPartitionedTable +( + id INT, + value INT, + computed_col AS id + value +) +ON IntPartitionScheme(computed_col); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cannot use generated column in partition key)~~ + + +CREATE TABLE TestPartitionedTable +( + id INT, + value INT, + computed_col AS id + value PERSISTED +) +ON IntPartitionScheme(computed_col); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cannot use generated column in partition key)~~ + + +-- temporary table +CREATE TABLE #TestPartitionedTable +( + id INT, + value INT +) +ON IntPartitionScheme(id); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Creation of temporary partitioned tables is not supported in Babelfish.)~~ + + + +--------------------------------------------------------------- +--- Negative Scenarios for CREATE TABLE with PARTITION SCHEME +--------------------------------------------------------------- +-- Attempt to create with multiple columns as partitioning scheme +CREATE TABLE TestPartitionedTable +( + id INT, + value INT +) +ON IntPartitionScheme(id, value); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near ',' at line 10 and character position 24)~~ + + +-- Attempt to create with a partition scheme that doesn't exist and column that doesn't exist in the table +CREATE TABLE TestPartitionedTable +( + id INT, + value INT +) +ON NonExistentPartitionScheme(NonExistentColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: column "nonexistentcolumn" named in partition key does not exist)~~ + + +-- Attempt to create with a partition scheme that doesn't exist +CREATE TABLE TestPartitionedTable +( + id INT, + value INT +) +ON NonExistentPartitionScheme(id); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid partition scheme 'NonExistentPartitionScheme' specifed.)~~ + + +-- Attempt to use two part name with partition scheme +CREATE TABLE TestPartitionedTable +( + id INT, + value INT +) +ON master.IntPartitionScheme(id); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '.' at line 7 and character position 9)~~ + + +-- Attempt to create with a unique constraint on a non-partition column +CREATE TABLE TestPartitionedTable +( + Id INT, + PartitionColumn INT, + Col1 INT UNIQUE +) +ON IntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: unique constraint on partitioned table must include all partitioning columns)~~ + + +-- Attempt to create with a primary key constraint on a non-partition column +CREATE TABLE TestPartitionedTable +( + Id INT, + PartitionColumn INT, + Col1 INT PRIMARY KEY +) +ON IntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: unique constraint on partitioned table must include all partitioning columns)~~ + + +--------------------------------------------------------------- +--- Negative Scenarios for CREATE TABLE with PARTITION SCHEME +--- Attempt to create with an incompatible partition column data type +--------------------------------------------------------------- +CREATE TABLE TestPartitionedTable1 +( + Id INT, + PartitionColumn DECIMAL(10, 2) +) +ON IntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'decimal' which is different from the partition function 'IntPartitionFunction' parameter data type 'int'.)~~ + + +CREATE TABLE TestPartitionedTable2 +( + Id INT, + PartitionColumn DATETIME +) +ON DatePartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'datetime' which is different from the partition function 'DatePartitionFunction' parameter data type 'date'.)~~ + + +CREATE TABLE TestPartitionedTable3 +( + Id INT, + PartitionColumn VARCHAR(10) +) +ON CharPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'varchar' which is different from the partition function 'CharPartitionFunction' parameter data type 'char'.)~~ + + +CREATE TABLE TestPartitionedTable4 +( + Id INT, + PartitionColumn VARBINARY(10) +) +ON BinaryPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'varbinary' which is different from the partition function 'BinaryPartitionFunction' parameter data type 'binary'.)~~ + + +CREATE TABLE TestPartitionedTable5 +( + Id INT, + PartitionColumn SMALLINT +) +ON BigIntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'int2' which is different from the partition function 'BigIntPartitionFunction' parameter data type 'bigint'.)~~ + + +CREATE TABLE TestPartitionedTable6 +( + Id INT, + PartitionColumn DECIMAL(10, 2) +) +ON SmallIntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'decimal' which is different from the partition function 'SmallIntPartitionFunction' parameter data type 'smallint'.)~~ + + +CREATE TABLE TestPartitionedTable7 +( + Id INT, + PartitionColumn DECIMAL(10, 5) +) +ON TinyIntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'decimal' which is different from the partition function 'TinyIntPartitionFunction' parameter data type 'tinyint'.)~~ + + +CREATE TABLE TestPartitionedTable8 +( + Id INT, + PartitionColumn BIGINT +) +ON DecimalPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'int8' which is different from the partition function 'DecimalPartitionFunction' parameter data type 'decimal'.)~~ + + +CREATE TABLE TestPartitionedTable9 +( + Id INT, + PartitionColumn MONEY +) +ON NumericPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'money' which is different from the partition function 'NumericPartitionFunction' parameter data type 'numeric'.)~~ + + +CREATE TABLE TestPartitionedTable10 +( + Id INT, + PartitionColumn INT +) +ON MoneyPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'int4' which is different from the partition function 'MoneyPartitionFunction' parameter data type 'money'.)~~ + + +CREATE TABLE TestPartitionedTable11 +( + Id INT, + PartitionColumn DATETIME +) +ON SmallMoneyPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'datetime' which is different from the partition function 'SmallMoneyPartitionFunction' parameter data type 'smallmoney'.)~~ + + +CREATE TABLE TestPartitionedTable12 +( + Id INT, + PartitionColumn DATETIME2(3) +) +ON DateTimePartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'datetime2' which is different from the partition function 'DateTimePartitionFunction' parameter data type 'datetime'.)~~ + + +CREATE TABLE TestPartitionedTable13 +( + Id INT, + PartitionColumn SMALLDATETIME +) +ON DateTime2PartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'smalldatetime' which is different from the partition function 'DateTime2PartitionFunction' parameter data type 'datetime2'.)~~ + + +CREATE TABLE TestPartitionedTable14 +( + Id INT, + PartitionColumn NVARCHAR(10) +) +ON SmallDateTimePartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'nvarchar' which is different from the partition function 'SmallDateTimePartitionFunction' parameter data type 'smalldatetime'.)~~ + + +CREATE TABLE TestPartitionedTable15 +( + Id INT, + PartitionColumn INT +) +ON NVarCharPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'int4' which is different from the partition function 'NVarCharPartitionFunction' parameter data type 'nvarchar'.)~~ + + +CREATE TABLE TestPartitionedTable16 +( + Id INT, + PartitionColumn NCHAR(5) +) +ON VarCharPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'nchar' which is different from the partition function 'VarCharPartitionFunction' parameter data type 'varchar'.)~~ + + +CREATE TABLE TestPartitionedTable17 +( + Id INT, + PartitionColumn INT +) +ON NCharPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'int4' which is different from the partition function 'NCharPartitionFunction' parameter data type 'nchar'.)~~ + + +-- using user defined type +CREATE TYPE PartitionUserDefinedType FROM SMALLINT; +GO + +CREATE TABLE TestPartitionedTable18 +( + Id INT, + PartitionColumn PartitionUserDefinedType +) +ON BigIntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'partitionuserdefinedtype' which is different from the partition function 'BigIntPartitionFunction' parameter data type 'bigint'.)~~ + + +DROP TYPE PartitionUserDefinedType +GO + +--------------------------------------------------------------- +--- Negative Scenarios for CREATE Index with PARTITION SCHEME +--------------------------------------------------------------- +CREATE TABLE TestPartitionedTable ( + PartitionColumn INT, + NonPartitionColumn INT +) ON IntPartitionScheme(PartitionColumn); +GO + +CREATE TABLE TestNonPartitionedTable ( + a INT, + b INT +) +GO + +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonExistentColumn1) +ON NonExistentPartitionScheme (NonExistentColumn2); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: column "nonexistentcolumn1" does not exist)~~ + + +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonPartitionColumn) +ON NonExistentPartitionScheme (NonExistentColumn2); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: column 'nonexistentcolumn2' does not exist)~~ + + +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonPartitionColumn) +ON NonExistentPartitionScheme (NonPartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid object name 'NonExistentPartitionScheme'.)~~ + + +-- scheme is different from the partition scheme used in the table +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonPartitionColumn) +ON BigIntPartitionScheme (NonPartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Un-aligned Index is not supported in Babelfish.)~~ + + +-- column specified with partition scheme is different +-- from the partition column used in the table +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonPartitionColumn) +ON IntPartitionScheme (NonPartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Un-aligned Index is not supported in Babelfish.)~~ + + +-- should work +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonPartitionColumn) +ON IntPartitionScheme (PartitionColumn); +GO + +DROP INDEX TestPartitionIndex ON TestPartitionedTable +GO + +-- usage of partition scheme on non-partitioned table (should fail) +CREATE INDEX TestPartitionIndex +ON TestNonPartitionedTable(a) +ON IntPartitionScheme (a); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Un-aligned Index is not supported in Babelfish.)~~ + + + +DROP TABLE TestPartitionedTable +GO + +DROP TABLE TestNonPartitionedTable +GO +-- psql +------------------------------------------------------------------------------------------- +--- Rename Operation on Partitioned Tables should update name in babelfish_partition_depend +--- and it should also update the name of all the partitions +------------------------------------------------------------------------------------------- +SELECT sys.db_name(dbid) as db_name, partition_scheme_name, schema_name, table_name FROM sys.babelfish_partition_depend where table_name = 'partition_vu_prepare_int_table'; +GO +~~START~~ +"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar" +master#!#IntPartitionScheme#!#dbo#!#partition_vu_prepare_int_table +~~END~~ + + +SELECT inhrelid::regclass as partition_name from pg_inherits where inhparent = (select oid from pg_class where relname = 'partition_vu_prepare_int_table')::regclass; +GO +~~START~~ +regclass +master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +master_dbo."363863941f079adaa9aa733200e57c9f_partition_1" +master_dbo."363863941f079adaa9aa733200e57c9f_partition_2" +master_dbo."363863941f079adaa9aa733200e57c9f_partition_3" +~~END~~ + + +-- tsql +-- trigger rename from TSQL endpoint +EXEC sp_rename 'partition_vu_prepare_int_table', 'partition_vu_prepare_int_table_renamed', 'OBJECT' +GO + +-- psql +SELECT sys.db_name(dbid) as db_name, partition_scheme_name, schema_name, table_name FROM sys.babelfish_partition_depend where table_name = 'partition_vu_prepare_int_table_renamed'; +GO +~~START~~ +"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar" +master#!#IntPartitionScheme#!#dbo#!#partition_vu_prepare_int_table_renamed +~~END~~ + + +SELECT inhrelid::regclass as partition_name from pg_inherits where inhparent = (select oid from pg_class where relname = 'partition_vu_prepare_int_table_renamed')::regclass; +GO +~~START~~ +regclass +master_dbo.c2647401dc3e9a950809daafcd188637_partition_0 +master_dbo.c2647401dc3e9a950809daafcd188637_partition_1 +master_dbo.c2647401dc3e9a950809daafcd188637_partition_2 +master_dbo.c2647401dc3e9a950809daafcd188637_partition_3 +~~END~~ + + +-- trigger rename from PSQL endpoint +ALTER TABLE master_dbo.partition_vu_prepare_int_table_renamed RENAME TO partition_vu_prepare_int_table; +GO + +-- we should get orginal here +SELECT sys.db_name(dbid) as db_name, partition_scheme_name, schema_name, table_name FROM sys.babelfish_partition_depend where table_name = 'partition_vu_prepare_int_table'; +GO +~~START~~ +"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar" +master#!#IntPartitionScheme#!#dbo#!#partition_vu_prepare_int_table +~~END~~ + + +SELECT inhrelid::regclass as partition_name from pg_inherits where inhparent = (select oid from pg_class where relname = 'partition_vu_prepare_int_table')::regclass; +GO +~~START~~ +regclass +master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +master_dbo."363863941f079adaa9aa733200e57c9f_partition_1" +master_dbo."363863941f079adaa9aa733200e57c9f_partition_2" +master_dbo."363863941f079adaa9aa733200e57c9f_partition_3" +~~END~~ + + +-- tsql +---------------------------------------------------------- +--- DOLLAR PARTITION FUNCTION name identifiers tests +---------------------------------------------------------- +SET QUOTED_IDENTIFIER ON; +GO + +SELECT $PARTITION."IntPartitionFunction" (100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT $PARTITION."PARTITION_FUNCTION 😎$@ #123 🌍rder "(100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT "master".$PARTITION."PARTITION_FUNCTION 😎$@ #123 🌍rder "(100) +GO +~~START~~ +int +2 +~~END~~ + + +SET QUOTED_IDENTIFIER OFF; +GO + + +SELECT $PARTITION.[PARTITION_FUNCTION 유니코드스키마👻 ] (100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT [master].$PARTITION.[PARTITION_FUNCTION 유니코드스키마👻 ] (100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT $PARTITION.[IntPartitionFunction] (100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT [master].$PARTITION.[IntPartitionFunction] (100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT $PARTITION.PARTITION_FUNCTIONログインαιώνια (100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT master.$PARTITION.PARTITION_FUNCTIONログインαιώνια (100) +GO +~~START~~ +int +2 +~~END~~ + + +------------------------------------------ +--- DOLLAR PARTITION FUNCTION Negative test +------------------------------------------ +-- explicit NULL value test +SELECT $PARTITION.IntPartitionFunction(NULL) +GO +~~START~~ +int +1 +~~END~~ + + +SELECT master.$PARTITION.IntPartitionFunction(NULL) +GO +~~START~~ +int +1 +~~END~~ + + +-- variable as NULL value +declare @var int = NULL +SELECT $PARTITION.IntPartitionFunction(@var) +GO +~~START~~ +int +1 +~~END~~ + + +-- non-existent database +SELECT NonExistentDatabase.$PARTITION.IntPartitionFunction(10) +GO +~~START~~ +int +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid database name 'NonExistentDatabase'.)~~ + + +-- error during implicit Conversion of values to partition function parameter type +SELECT $PARTITION.IntPartitionFunction('xyz') +GO +~~START~~ +int +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type integer: "xyz")~~ + + +-- using query +SELECT $PARTITION.IntPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_varchar_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type integer: "Apple")~~ + +--------------------------------------------------------------------- +--- Test for all the Supported Datatypes for Dollar Partition Function +--------------------------------------------------------------------- +SELECT $PARTITION.IntPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_int_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#int +1#!# +2#!#1 +2#!#100 +4#!#10000 +~~END~~ + + +SELECT $PARTITION.BigIntPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_bigint_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#bigint +1#!# +2#!#1 +3#!#100 +5#!#10000 +5#!#1000000000 +~~END~~ + + +SELECT $PARTITION.SmallIntPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_smallint_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#smallint +1#!# +2#!#-32768 +3#!#1 +4#!#32767 +~~END~~ + + +SELECT $PARTITION.TinyIntPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_tinyint_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#tinyint +1#!# +2#!#1 +3#!#128 +4#!#255 +~~END~~ + + +SELECT $PARTITION.DecimalPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_decimal_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#numeric +1#!# +2#!#1.00000 +3#!#100.00000 +4#!#200.00000 +5#!#300.00000 +~~END~~ + + +SELECT $PARTITION.NumericPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_numeric_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#numeric +1#!# +2#!#1.00 +3#!#10.00 +4#!#20.00 +5#!#30.00 +~~END~~ + + +SELECT $PARTITION.MoneyPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_money_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#money +1#!# +1#!#1.0000 +2#!#2.5679 +4#!#4.9100 +~~END~~ + + +SELECT $PARTITION.SmallMoneyPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_smallmoney_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#smallmoney +1#!# +1#!#1.0000 +2#!#2.5679 +4#!#4.9100 +~~END~~ + + +SELECT $PARTITION.DatePartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_date_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#date +1#!# +2#!#2022-01-01 +3#!#2022-07-01 +4#!#2023-01-01 +~~END~~ + + +SELECT $PARTITION.DateTimePartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_datetime_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#datetime +1#!# +2#!#2019-01-01 00:00:00.0 +3#!#2022-01-01 00:00:00.0 +4#!#2022-07-01 00:00:00.0 +~~END~~ + + +SELECT $PARTITION.DateTime2PartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_datetime2_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#datetime2 +1#!# +2#!#2019-01-01 00:00:00.000 +3#!#2022-01-01 00:00:00.000 +4#!#2022-07-01 00:00:00.000 +~~END~~ + + +SELECT $PARTITION.SmallDateTimePartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_smalldatetime_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#smalldatetime +1#!# +2#!#2019-01-01 00:00:00.0 +3#!#2022-01-01 00:00:00.0 +4#!#2022-07-01 00:00:00.0 +~~END~~ + + +SELECT $PARTITION.CharPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_char_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#char +1#!# +2#!#A +3#!#D +5#!#K +7#!#U +~~END~~ + + +SELECT $PARTITION.VarCharPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_varchar_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#varchar +1#!# +2#!#Apple +3#!#Banana +4#!#Cherry +5#!#Date +6#!#Mango +~~END~~ + + +SELECT $PARTITION.NVarCharPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_nvarchar_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#nvarchar +1#!# +2#!#Apple +3#!#Banana +4#!#Cherry +5#!#Date +6#!#Mango +~~END~~ + + +SELECT $PARTITION.NCharPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_nchar_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#nchar +1#!# +2#!#A +3#!#B +5#!#K +7#!#U +~~END~~ + + +SELECT $PARTITION.BinaryPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_binary_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#binary +1#!# +2#!#00000000 +2#!#00C00000 +3#!#04000000 +4#!#08000000 +~~END~~ + + +SELECT $PARTITION.VarBinaryPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_varbinary_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#varbinary +1#!# +2#!#0000000000000000 +3#!#4000000000000000 +4#!#8000000000000000 +5#!#C000000000000000 +~~END~~ + + +SELECT $PARTITION.UniqueIdentifierPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_uniqueidentifier_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#uniqueidentifier +1#!# +2#!#00000000-0000-0000-0000-000000000000 +3#!#6F9619FF-8B86-D011-B42D-00C04FC964FF +4#!#FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF +~~END~~ + + +---------------------------------------------- +--- DOLLAR PARTITION FUNCTION Dependency test +---------------------------------------------- +-- non-null test +SELECT * FROM DollarPartitionFunctionView +GO +~~START~~ +int#!#int +1#!# +2#!#1 +2#!#100 +4#!#10000 +~~END~~ + + +EXEC DollarPartitionFunctionProc +GO +~~START~~ +int#!#int +1#!# +2#!#1 +2#!#100 +4#!#10000 +~~END~~ + + +SELECT * FROM DollarPartitionFunctionFunc() +GO +~~START~~ +int#!#int +1#!# +2#!#1 +2#!#100 +4#!#10000 +~~END~~ + + +-- null test +SELECT * FROM DollarPartitionFunctionNullView +GO +~~START~~ +int +1 +~~END~~ + + +EXEC DollarPartitionFunctionNullProc +GO +~~START~~ +int +1 +~~END~~ + + +SELECT * FROM DollarPartitionFunctionNullFunc() +GO +~~START~~ +int +1 +~~END~~ + + +SELECT * FROM SysSearchPartitionDepView +GO +~~START~~ +int +2 +~~END~~ + + +SELECT * FROM SysSearchPartitionNULLDepView +GO +~~START~~ +int +2 +~~END~~ + +------------------------------------------------------ +--- DOLLAR PARTITION FUNCTION Cross Database test +------------------------------------------------------ +-- in current database with explicity lookup +SELECT master.$PARTITION.[IntPartitionFunction] (100) +GO +~~START~~ +int +2 +~~END~~ + + +-- use different database +USE PartitionDb; +GO + +SELECT CURRENT_USER +GO +~~START~~ +varchar +dbo +~~END~~ + + +SELECT master.$PARTITION.[IntPartitionFunction] (100) +GO +~~START~~ +int +2 +~~END~~ + + +-- test using guest login +CREATE LOGIN partition_l2 WITH PASSWORD = '12345678'; +GO + +CREATE USER partition_u2 FOR LOGIN partition_l2; +GO + +-- tsql user=partition_l2 password=12345678 database=partitiondb +SELECT CURRENT_USER +GO +~~START~~ +varchar +partition_u2 +~~END~~ + + +SELECT master.$PARTITION.[IntPartitionFunction] (100) +GO +~~START~~ +int +2 +~~END~~ + + +-- tsql +USE PartitionDb; +GO + +DROP USER partition_u2 +GO diff --git a/test/JDBC/expected/SP_TABLES-dep-vu-cleanup.out b/test/JDBC/expected/SP_TABLES-dep-vu-cleanup.out new file mode 100644 index 00000000000..2607f66033b --- /dev/null +++ b/test/JDBC/expected/SP_TABLES-dep-vu-cleanup.out @@ -0,0 +1,23 @@ +USE babel_5010_vu_prepare_db1; +GO + +DROP TABLE IF EXISTS babel_5010_temp_table; +GO + +DROP TABLE IF EXISTS babel_5010_vu_prepare_t1; +GO + +DROP TABLE IF EXISTS babel_5010_vu_prepare_t2; +GO + +DROP VIEW IF EXISTS babel_5010_vu_prepare_v1; +GO + +DROP VIEW IF EXISTS babel_5010_vu_prepare_v2; +GO + +USE master; +GO + +DROP DATABASE IF EXISTS babel_5010_vu_prepare_db1; +GO diff --git a/test/JDBC/expected/SP_TABLES-dep-vu-prepare.out b/test/JDBC/expected/SP_TABLES-dep-vu-prepare.out new file mode 100644 index 00000000000..efacf6942e0 --- /dev/null +++ b/test/JDBC/expected/SP_TABLES-dep-vu-prepare.out @@ -0,0 +1,29 @@ +CREATE DATABASE babel_5010_vu_prepare_db1; +GO + +USE babel_5010_vu_prepare_db1; +GO + +CREATE TABLE babel_5010_temp_table ( + TABLE_QUALIFIER sys.sysname, + TABLE_OWNER sys.nvarchar(384), + TABLE_NAME sys.nvarchar(384), + TABLE_TYPE sys.nvarchar(100), + REMARKS sys.bit +); +GO + +CREATE TABLE babel_5010_vu_prepare_t1(a INT) +GO + +CREATE TABLE babel_5010_vu_prepare_t2(a INT) +GO + +CREATE VIEW babel_5010_vu_prepare_v1 AS SELECT 1; +GO + +CREATE VIEW babel_5010_vu_prepare_v2 AS SELECT 1; +GO + +USE master; +GO diff --git a/test/JDBC/expected/SP_TABLES-dep-vu-verify.out b/test/JDBC/expected/SP_TABLES-dep-vu-verify.out new file mode 100644 index 00000000000..83113ae6386 --- /dev/null +++ b/test/JDBC/expected/SP_TABLES-dep-vu-verify.out @@ -0,0 +1,266 @@ +USE babel_5010_vu_prepare_db1; +GO + +SET NOCOUNT ON; +GO + + +-- special case: when table_qualifier only contains one % wildcard character and 0 or more space characters +-- should enumerate all databases +declare @p1 sys.nvarchar='' +declare @P2 sys.nvarchar='' +declare @P3 sys.nvarchar='% ' +declare @P4 sys.nvarchar=NULL +declare @fUsePattern bit = 1 +INSERT INTO babel_5010_temp_table EXEC [sys].sp_tables @p1, @P2, @P3, @P4, @fUsePattern = @fUsePattern; +SELECT * FROM babel_5010_temp_table WHERE TABLE_QUALIFIER IN ('master', 'tempdb', 'msdb', 'babel_5010_vu_prepare_db1'); +DELETE FROM babel_5010_temp_table; +GO +~~START~~ +varchar#!#nvarchar#!#nvarchar#!#nvarchar#!#bit +babel_5010_vu_prepare_db1#!##!##!##!# +master#!##!##!##!# +msdb#!##!##!##!# +tempdb#!##!##!##!# +~~END~~ + + +declare @p1 sys.nvarchar='' +declare @P2 sys.nvarchar='' +declare @P3 sys.nvarchar='%' +declare @P4 sys.nvarchar=NULL +declare @fUsePattern bit = 1 +INSERT INTO babel_5010_temp_table EXEC [sys].sp_tables @p1, @P2, @P3, @P4, @fUsePattern = @fUsePattern; +SELECT * FROM babel_5010_temp_table WHERE TABLE_QUALIFIER IN ('master', 'tempdb', 'msdb', 'babel_5010_vu_prepare_db1'); +DELETE FROM babel_5010_temp_table; +GO +~~START~~ +varchar#!#nvarchar#!#nvarchar#!#nvarchar#!#bit +babel_5010_vu_prepare_db1#!##!##!##!# +master#!##!##!##!# +msdb#!##!##!##!# +tempdb#!##!##!##!# +~~END~~ + + +INSERT INTO babel_5010_temp_table EXEC [sys].sp_tables @table_name = '', @table_owner = '', @table_qualifier = '% ', @table_type = NULL, @fUsePattern = 1; +SELECT * FROM babel_5010_temp_table WHERE TABLE_QUALIFIER IN ('master', 'tempdb', 'msdb', 'babel_5010_vu_prepare_db1'); +DELETE FROM babel_5010_temp_table; +GO +~~START~~ +varchar#!#nvarchar#!#nvarchar#!#nvarchar#!#bit +babel_5010_vu_prepare_db1#!##!##!##!# +master#!##!##!##!# +msdb#!##!##!##!# +tempdb#!##!##!##!# +~~END~~ + + +INSERT INTO babel_5010_temp_table EXEC [sys].sp_tables @table_name = '', @table_owner = '', @table_qualifier = '%', @table_type = NULL, @fUsePattern = 1; +SELECT * FROM babel_5010_temp_table WHERE TABLE_QUALIFIER IN ('master', 'tempdb', 'msdb', 'babel_5010_vu_prepare_db1'); +DELETE FROM babel_5010_temp_table; +GO +~~START~~ +varchar#!#nvarchar#!#nvarchar#!#nvarchar#!#bit +babel_5010_vu_prepare_db1#!##!##!##!# +master#!##!##!##!# +msdb#!##!##!##!# +tempdb#!##!##!##!# +~~END~~ + + +-- should return empty set +declare @p1 sys.nvarchar='' +declare @P2 sys.nvarchar='' +declare @P3 sys.nvarchar=' %' +declare @P4 sys.nvarchar=NULL +declare @fUsePattern bit = 1 +EXEC [sys].sp_tables @p1, @P2, @P3, @P4, @fUsePattern = @fUsePattern +GO +~~START~~ +varchar#!#varchar#!#varchar#!#varchar#!#varchar +~~END~~ + + +declare @p1 sys.nvarchar='' +declare @P2 sys.nvarchar='' +declare @P3 sys.nvarchar=' % ' +declare @P4 sys.nvarchar=NULL +declare @fUsePattern bit = 1 +EXEC [sys].sp_tables @p1, @P2, @P3, @P4, @fUsePattern = @fUsePattern +GO +~~START~~ +varchar#!#varchar#!#varchar#!#varchar#!#varchar +~~END~~ + + +declare @p1 sys.nvarchar=' ' +declare @P2 sys.nvarchar='' +declare @P3 sys.nvarchar=NULL +declare @P4 sys.nvarchar=NULL +declare @fUsePattern bit = 1 +EXEC [sys].sp_tables @p1, @P2, @P3, @P4, @fUsePattern = @fUsePattern +GO +~~START~~ +varchar#!#varchar#!#varchar#!#varchar#!#varchar +~~END~~ + + +-- should throw error +EXEC [sys].sp_tables @table_name = '', @table_owner = '', @table_qualifier = ' %', @table_type = NULL, @fUsePattern = 1; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The database name component of the object qualifier must be the name of the current database.)~~ + + +EXEC [sys].sp_tables @table_name = '', @table_owner = '', @table_qualifier = ' % ', @table_type = NULL, @fUsePattern = 1; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The database name component of the object qualifier must be the name of the current database.)~~ + + +EXEC [sys].sp_tables @table_name = '', @table_owner = '', @table_qualifier = '%%', @table_type = NULL, @fUsePattern = 1; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The database name component of the object qualifier must be the name of the current database.)~~ + + +EXEC [sys].sp_tables @table_name = '', @table_owner = '', @table_qualifier = '%_', @table_type = NULL, @fUsePattern = 1; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The database name component of the object qualifier must be the name of the current database.)~~ + + +EXEC [sys].sp_tables @table_name = '', @table_owner = '', @table_qualifier = 'mast%', @table_type = NULL, @fUsePattern = 1; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The database name component of the object qualifier must be the name of the current database.)~~ + + +EXEC [sys].sp_tables @table_name = '', @table_owner = '', @table_qualifier = '%db', @table_type = NULL, @fUsePattern = 1; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The database name component of the object qualifier must be the name of the current database.)~~ + + +-- special case: when all parameters are empty string, should return empty set +EXEC [sys].sp_tables @table_name = '', @table_owner = '', @table_qualifier = '', @table_type = '', @fUsePattern = 0; +GO +~~START~~ +varchar#!#varchar#!#varchar#!#varchar#!#varchar +~~END~~ + + +EXEC [sys].sp_tables @table_name = '', @table_owner = '', @table_qualifier = '', @table_type = ''; +GO +~~START~~ +varchar#!#varchar#!#varchar#!#varchar#!#varchar +~~END~~ + + +-- special case: when all parameters are NULL, should return all tables and views of current database i.e. babel_5010_vu_prepare_db1 +EXEC [sys].sp_tables; +GO +~~START~~ +varchar#!#varchar#!#varchar#!#varchar#!#varchar +babel_5010_vu_prepare_db1#!#dbo#!#babel_5010_temp_table#!#TABLE#!# +babel_5010_vu_prepare_db1#!#dbo#!#babel_5010_vu_prepare_t1#!#TABLE#!# +babel_5010_vu_prepare_db1#!#dbo#!#babel_5010_vu_prepare_t2#!#TABLE#!# +babel_5010_vu_prepare_db1#!#dbo#!#babel_5010_vu_prepare_v1#!#VIEW#!# +babel_5010_vu_prepare_db1#!#dbo#!#babel_5010_vu_prepare_v2#!#VIEW#!# +babel_5010_vu_prepare_db1#!#dbo#!#sysdatabases#!#VIEW#!# +~~END~~ + + + +-- NULL value tests +-- case 1: when table name is NULL +-- should return matching objects +EXEC [sys].sp_tables @table_owner = 'dbo', @table_qualifier = 'babel_5010_vu_prepare_db1', @table_type = "'TABLE'"; +GO +~~START~~ +varchar#!#varchar#!#varchar#!#varchar#!#varchar +babel_5010_vu_prepare_db1#!#dbo#!#babel_5010_temp_table#!#TABLE#!# +babel_5010_vu_prepare_db1#!#dbo#!#babel_5010_vu_prepare_t1#!#TABLE#!# +babel_5010_vu_prepare_db1#!#dbo#!#babel_5010_vu_prepare_t2#!#TABLE#!# +~~END~~ + + +EXEC [sys].sp_tables @table_owner = 'dbo', @table_qualifier = 'babel_5010_vu_prepare_db1', @table_type = "'VIEW'"; +GO +~~START~~ +varchar#!#varchar#!#varchar#!#varchar#!#varchar +babel_5010_vu_prepare_db1#!#dbo#!#babel_5010_vu_prepare_v1#!#VIEW#!# +babel_5010_vu_prepare_db1#!#dbo#!#babel_5010_vu_prepare_v2#!#VIEW#!# +babel_5010_vu_prepare_db1#!#dbo#!#sysdatabases#!#VIEW#!# +~~END~~ + + +EXEC [sys].sp_tables @table_owner = 'dbo', @table_qualifier = 'babel_5010_vu_prepare_db1', @table_type = "'TABLE','VIEW'"; +GO +~~START~~ +varchar#!#varchar#!#varchar#!#varchar#!#varchar +babel_5010_vu_prepare_db1#!#dbo#!#babel_5010_temp_table#!#TABLE#!# +babel_5010_vu_prepare_db1#!#dbo#!#babel_5010_vu_prepare_t1#!#TABLE#!# +babel_5010_vu_prepare_db1#!#dbo#!#babel_5010_vu_prepare_t2#!#TABLE#!# +babel_5010_vu_prepare_db1#!#dbo#!#babel_5010_vu_prepare_v1#!#VIEW#!# +babel_5010_vu_prepare_db1#!#dbo#!#babel_5010_vu_prepare_v2#!#VIEW#!# +babel_5010_vu_prepare_db1#!#dbo#!#sysdatabases#!#VIEW#!# +~~END~~ + + +-- case 2: when table owner is NULL +-- should return matching objects +EXEC [sys].sp_tables @table_name = 'babel_5010_vu_prepare_t1', @table_qualifier = 'babel_5010_vu_prepare_db1', @table_type = "'TABLE'"; +GO +~~START~~ +varchar#!#varchar#!#varchar#!#varchar#!#varchar +babel_5010_vu_prepare_db1#!#dbo#!#babel_5010_vu_prepare_t1#!#TABLE#!# +~~END~~ + + +EXEC [sys].sp_tables @table_name = 'babel_5010_vu_prepare_v1', @table_qualifier = 'babel_5010_vu_prepare_db1', @table_type = "'VIEW'"; +GO +~~START~~ +varchar#!#varchar#!#varchar#!#varchar#!#varchar +babel_5010_vu_prepare_db1#!#dbo#!#babel_5010_vu_prepare_v1#!#VIEW#!# +~~END~~ + + +-- should return empty set +EXEC [sys].sp_tables @table_name = 'babel_5010_vu_prepare_v1', @table_qualifier = 'babel_5010_vu_prepare_db1', @table_type = "'TABLE'"; +GO +~~START~~ +varchar#!#varchar#!#varchar#!#varchar#!#varchar +~~END~~ + + +-- case 3: when table qualifier is NULL +-- should return matching objects +EXEC [sys].sp_tables @table_name = 'babel_5010_vu_prepare_t1', @table_owner = 'dbo', @table_type = "'TABLE'"; +GO +~~START~~ +varchar#!#varchar#!#varchar#!#varchar#!#varchar +babel_5010_vu_prepare_db1#!#dbo#!#babel_5010_vu_prepare_t1#!#TABLE#!# +~~END~~ + + +EXEC [sys].sp_tables @table_name = 'babel_5010_vu_prepare_v1', @table_owner = 'dbo', @table_type = "'VIEW'"; +GO +~~START~~ +varchar#!#varchar#!#varchar#!#varchar#!#varchar +babel_5010_vu_prepare_db1#!#dbo#!#babel_5010_vu_prepare_v1#!#VIEW#!# +~~END~~ + + +SET NOCOUNT OFF; +GO + +USE master; +GO diff --git a/test/JDBC/expected/TEST_PUBLICATION.out b/test/JDBC/expected/TEST_PUBLICATION.out index f222750eff7..10a38dfd481 100644 --- a/test/JDBC/expected/TEST_PUBLICATION.out +++ b/test/JDBC/expected/TEST_PUBLICATION.out @@ -35,6 +35,9 @@ sys.babelfish_extended_properties sys.babelfish_function_ext sys.babelfish_helpcollation sys.babelfish_namespace_ext +sys.babelfish_partition_depend +sys.babelfish_partition_function +sys.babelfish_partition_scheme sys.babelfish_schema_permissions sys.babelfish_server_options sys.babelfish_sysdatabases diff --git a/test/JDBC/expected/Test-sp_rename-vu-cleanup.out b/test/JDBC/expected/Test-sp_rename-vu-cleanup.out index 20379f7e2d5..6b0c9cd260e 100644 --- a/test/JDBC/expected/Test-sp_rename-vu-cleanup.out +++ b/test/JDBC/expected/Test-sp_rename-vu-cleanup.out @@ -67,3 +67,6 @@ GO DROP SCHEMA sp_rename_vu_schema1; GO + +DROP VIEW babelfish_split_identifier_view; +GO diff --git a/test/JDBC/expected/Test-sp_rename-vu-prepare.out b/test/JDBC/expected/Test-sp_rename-vu-prepare.out index 18717c0de14..09d689fc9ab 100644 --- a/test/JDBC/expected/Test-sp_rename-vu-prepare.out +++ b/test/JDBC/expected/Test-sp_rename-vu-prepare.out @@ -99,3 +99,13 @@ GO CREATE TYPE sp_rename_vu_schema1.sp_rename_vu_alias1 FROM VARCHAR(11) NOT NULL; GO + +-- Dependency test for function babelfish_split_identifier +-- Create a view which depends upon babelfish_split_identifier function only +-- if the function exists. +IF OBJECT_ID('sys.babelfish_split_identifier') IS NOT NULL +BEGIN + EXEC sp_executesql N' + CREATE VIEW babelfish_split_identifier_view AS SELECT * FROM sys.babelfish_split_identifier(''ABC.DEF.GHI'')'; +END +GO diff --git a/test/JDBC/expected/Test-sp_rename-vu-verify.out b/test/JDBC/expected/Test-sp_rename-vu-verify.out index be0cd468f5a..2f2b7909a95 100644 --- a/test/JDBC/expected/Test-sp_rename-vu-verify.out +++ b/test/JDBC/expected/Test-sp_rename-vu-verify.out @@ -300,7 +300,7 @@ GO ~~START~~ nvarchar#!#nvarchar#!#varchar#!#varchar master#!#dbo#!#sp_rename_vu_table_delim#!#BASE TABLE -master#!#dbo#!#sp_rename_vu_table1_case_insensitive2#!#BASE TABLE +master#!#dbo#!#SP_RENAME_vu_TABLE1_case_insensitive2#!#BASE TABLE master#!#dbo#!#sp_rename_vu_table2#!#BASE TABLE master#!#dbo#!#sp_rename_vu_view1#!#VIEW master#!#sp_rename_vu_schema1#!#sp_rename_vu_table1#!#BASE TABLE @@ -318,7 +318,7 @@ GO ~~START~~ nvarchar#!#nvarchar#!#varchar#!#varchar master#!#dbo#!#sp_rename_vu_table_delim#!#BASE TABLE -master#!#dbo#!#sp_rename_vu_table1_case_insensitive2#!#BASE TABLE +master#!#dbo#!#SP_RENAME_vu_TABLE1_case_insensitive2#!#BASE TABLE master#!#dbo#!#sp_rename_vu_table2#!#BASE TABLE master#!#dbo#!#sp_rename_vu_view1_case_insensitive1#!#VIEW master#!#sp_rename_vu_schema1#!#sp_rename_vu_table1#!#BASE TABLE @@ -356,7 +356,7 @@ GO ~~START~~ nvarchar#!#nvarchar#!#varchar#!#varchar master#!#dbo#!#sp_rename_vu_table_delim#!#BASE TABLE -master#!#dbo#!#sp_rename_vu_table1_case_insensitive2#!#BASE TABLE +master#!#dbo#!#SP_RENAME_vu_TABLE1_case_insensitive2#!#BASE TABLE master#!#dbo#!#sp_rename_vu_table2#!#BASE TABLE master#!#dbo#!#sp_rename_vu_view1#!#VIEW master#!#sp_rename_vu_schema1#!#sp_rename_vu_table1#!#BASE TABLE @@ -531,7 +531,7 @@ GO ~~START~~ nvarchar#!#nvarchar#!#varchar#!#varchar master#!#dbo#!#sp_rename_vu_table_delim#!#BASE TABLE -master#!#dbo#!#sp_rename_vu_table1_case_insensitive2#!#BASE TABLE +master#!#dbo#!#SP_RENAME_vu_TABLE1_case_insensitive2#!#BASE TABLE master#!#dbo#!#sp_rename_vu_table2#!#BASE TABLE master#!#dbo#!#sp_rename_vu_view1#!#VIEW master#!#sp_rename_vu_schema1#!#sp_rename_vu_table1#!#BASE TABLE @@ -563,7 +563,7 @@ GO ~~START~~ nvarchar#!#nvarchar#!#varchar#!#varchar master#!#dbo#!#sp_rename_vu_table_delim#!#BASE TABLE -master#!#dbo#!#sp_rename_vu_table1_case_insensitive2#!#BASE TABLE +master#!#dbo#!#SP_RENAME_vu_TABLE1_case_insensitive2#!#BASE TABLE master#!#dbo#!#sp_rename_vu_table2#!#BASE TABLE master#!#dbo#!#sp_rename_vu_view1#!#VIEW master#!#sp_rename_vu_schema1#!#sp_rename_vu_table1#!#BASE TABLE @@ -826,3 +826,20 @@ GO ~~ERROR (Message: Feature not supported: renaming object type Statistics)~~ + +IF OBJECT_ID('babelfish_split_identifier_view') IS NULL +BEGIN + EXEC sp_executesql N' + CREATE VIEW babelfish_split_identifier_view AS SELECT * FROM sys.babelfish_split_identifier(''ABC.DEF.GHI'')'; +END +GO + +SELECT * FROM babelfish_split_identifier_view; +GO +~~START~~ +varchar +ABC +DEF +GHI +~~END~~ + diff --git a/test/JDBC/expected/Test-spatial-functions-vu-cleanup.out b/test/JDBC/expected/Test-spatial-functions-vu-cleanup.out new file mode 100644 index 00000000000..458cca9199b --- /dev/null +++ b/test/JDBC/expected/Test-spatial-functions-vu-cleanup.out @@ -0,0 +1,35 @@ +USE TestSpatialFunction_DB + +DROP TABLE IF EXISTS TestSpatialFunction_YourTable1Temp + +USE MASTER + +DROP TABLE IF EXISTS TestSpatialFunction_YourTableTemp2 + +DROP TABLE IF EXISTS TestSpatialFunction_TableATemp + +DROP TABLE IF EXISTS TestSpatialFunction_TableBTemp + +DROP VIEW IF EXISTS TestSpatialFunction_ValFromGeomTemp + +DROP VIEW IF EXISTS TestSpatialFunction_TextFromGeogTemp + +DROP VIEW IF EXISTS TestSpatialFunction_point_equality1Temp + +DROP VIEW IF EXISTS TestSpatialFunction_isInTemp + +DROP VIEW IF EXISTS TestSpatialFunction_point_EqualityTemp + +DROP VIEW IF EXISTS TestSpatialFunction_point_inTemp + +DROP VIEW IF EXISTS TestSpatialFunction_SRIDFromGeom + +DROP VIEW IF EXISTS TestSpatialFunction_SRIDFromGeog + +DROP TABLE IF EXISTS TestSpatialFunction_SPATIALPOINTGEOM_dttemp + +DROP TABLE IF EXISTS TestSpatialFunction_SPATIALPOINTGEOG_dttemp + +DROP TABLE IF EXISTS TestSpatialFunction_YourTableTemp + +DROP DATABASE TestSpatialFunction_DB diff --git a/test/JDBC/expected/Test-spatial-functions-vu-prepare.out b/test/JDBC/expected/Test-spatial-functions-vu-prepare.out new file mode 100644 index 00000000000..ccc9d446583 --- /dev/null +++ b/test/JDBC/expected/Test-spatial-functions-vu-prepare.out @@ -0,0 +1,114 @@ +CREATE DATABASE TestSpatialFunction_DB; + +USE TestSpatialFunction_DB; + +CREATE TABLE TestSpatialFunction_YourTable1Temp ( ID INT PRIMARY KEY, PointColumn geometry ); +INSERT INTO TestSpatialFunction_YourTable1Temp (ID, PointColumn) VALUES (1, geometry::Point(3.0, 4.0, 4326)), (2, geometry::Point(5.0, 6.0, 4326)), (3, geometry::Point(3.0, 4.0, 0)); +~~ROW COUNT: 3~~ + + +USE MASTER + +CREATE TABLE TestSpatialFunction_YourTableTemp ( ID INT PRIMARY KEY, PointColumn geometry ); + +INSERT INTO TestSpatialFunction_YourTableTemp (ID, PointColumn) VALUES (1, geometry::Point(3.0, 4.0, 4326)), (2, geometry::Point(5.0, 6.0, 4326)), (3, geometry::Point(3.0, 4.0, 0)); +~~ROW COUNT: 3~~ + + +CREATE TABLE TestSpatialFunction_YourTableTemp2 ( ID INT PRIMARY KEY, PointColumn1 geometry, PointColumn2 geometry ); +INSERT INTO TestSpatialFunction_YourTableTemp2 (ID, PointColumn1, PointColumn2) VALUES (1, geometry::Point(3.0, 4.0, 4326), geometry::Point(3.0, 4.0, 4326)); +~~ROW COUNT: 1~~ + + +CREATE TABLE TestSpatialFunction_TableATemp (ID INT PRIMARY KEY, PointA geometry); +CREATE TABLE TestSpatialFunction_TableBTemp (ID INT PRIMARY KEY, PointB geometry); +INSERT INTO TestSpatialFunction_TableATemp (ID, PointA) VALUES (1, geometry::Point(1.0, 2.0, 4326)); +~~ROW COUNT: 1~~ + +INSERT INTO TestSpatialFunction_TableBTemp (ID, PointB) VALUES (1, geometry::Point(3.0, 4.0, 4326)); +~~ROW COUNT: 1~~ + + +CREATE TABLE TestSpatialFunction_SPATIALPOINTGEOG_dttemp (location geography); +INSERT INTO TestSpatialFunction_SPATIALPOINTGEOG_dttemp (location) VALUES ( geography::STGeomFromText('Point(47.65100 -22.34900)', 4326) ); +~~ROW COUNT: 1~~ + +INSERT INTO TestSpatialFunction_SPATIALPOINTGEOG_dttemp (location) VALUES ( geography::STGeomFromText('Point(1.0 2.0)', 4326) ); +~~ROW COUNT: 1~~ + +INSERT INTO TestSpatialFunction_SPATIALPOINTGEOG_dttemp (location) VALUES ( geography::STGeomFromText('Point(1.0 2.0)', 4326) ); +~~ROW COUNT: 1~~ + +INSERT INTO TestSpatialFunction_SPATIALPOINTGEOG_dttemp (location) VALUES ( geography::STPointFromText('Point(1.0 2.0)', 4326) ); +~~ROW COUNT: 1~~ + + +#Tests for Geography type Prepared Statements +prepst#!#INSERT INTO TestSpatialFunction_SPATIALPOINTGEOG_dttemp(location) values(?) #!#GEOGRAPHY|-|location|-|Point(47.65100 -22.34900):4326 +~~ROW COUNT: 1~~ + +prepst#!#exec#!#GEOGRAPHY|-|location|-|Point(1.0 2.0):4326 +~~ROW COUNT: 1~~ + +prepst#!#exec#!#GEOGRAPHY|-|location|-|Point(-91.0 -35.0):4326 +~~ROW COUNT: 1~~ + +prepst#!#exec#!#GEOGRAPHY|-|location|-|Point(290.345 45.1234):4326 +~~ROW COUNT: 1~~ + +prepst#!#exec#!#GEOGRAPHY|-|location|-|Point(-120.345 45.1234):4326 +~~ROW COUNT: 1~~ + +prepst#!#exec#!#GEOGRAPHY|-|location|-|Point(-720.345 45.1234):4326 +~~ROW COUNT: 1~~ + + +CREATE TABLE TestSpatialFunction_SPATIALPOINTGEOM_dttemp (location geometry); +INSERT INTO TestSpatialFunction_SPATIALPOINTGEOM_dttemp (location) VALUES ( geometry::STGeomFromText('Point(47.65100 -22.34900)', 4326) ); +~~ROW COUNT: 1~~ + +INSERT INTO TestSpatialFunction_SPATIALPOINTGEOM_dttemp (location) VALUES ( geometry::STGeomFromText('Point(1.0 2.0)', 4326) ); +~~ROW COUNT: 1~~ + +INSERT INTO TestSpatialFunction_SPATIALPOINTGEOM_dttemp (location) VALUES ( geometry::STGeomFromText('Point(47.65100 -22.34900)', 0) ); +~~ROW COUNT: 1~~ + +INSERT INTO TestSpatialFunction_SPATIALPOINTGEOM_dttemp (location) VALUES ( geometry::STPointFromText('Point(1.0 2.0)', 4326) ); +~~ROW COUNT: 1~~ + +INSERT INTO TestSpatialFunction_SPATIALPOINTGEOM_dttemp (location) VALUES ( geometry::Point(47.65100, -22.34900, 4326) ); +~~ROW COUNT: 1~~ + + +#Tests for Geometry type Prepared Statements +prepst#!#INSERT INTO TestSpatialFunction_SPATIALPOINTGEOM_dttemp(location) values(?) #!#GEOMETRY|-|location|-|Point(47.65100 -22.34900):4326 +~~ROW COUNT: 1~~ + +prepst#!#exec#!#GEOMETRY|-|location|-|Point(1.0 2.0):4326 +~~ROW COUNT: 1~~ + +prepst#!#exec#!#GEOMETRY|-|location|-|Point(47.65100 -22.34900):0 +~~ROW COUNT: 1~~ + +prepst#!#exec#!#GEOMETRY|-|location|-|Point(-91.0 -35.0):4326 +~~ROW COUNT: 1~~ + +prepst#!#exec#!#GEOMETRY|-|location|-|Point(290.345 45.1234):4326 +~~ROW COUNT: 1~~ + + +CREATE VIEW TestSpatialFunction_point_equality1Temp AS SELECT p1.location.STEquals(p2.location) AS equality FROM TestSpatialFunction_SPATIALPOINTGEOM_dttemp p1 CROSS JOIN TestSpatialFunction_SPATIALPOINTGEOM_dttemp p2; + +CREATE VIEW TestSpatialFunction_isInTemp AS SELECT p1.location.STContains(p2.location) AS isIN FROM TestSpatialFunction_SPATIALPOINTGEOM_dttemp p1 CROSS JOIN TestSpatialFunction_SPATIALPOINTGEOM_dttemp p2 ORDER BY p1.location.STX; + +CREATE VIEW TestSpatialFunction_ValFromGeomTemp AS SELECT location.STArea() FROM TestSpatialFunction_SPATIALPOINTGEOM_dttemp ORDER BY location.STX; + +CREATE VIEW TestSpatialFunction_TextFromGeogTemp AS SELECT location.STArea() AS Area FROM TestSpatialFunction_SPATIALPOINTGEOG_dttemp ORDER BY location.Lat; + +CREATE VIEW TestSpatialFunction_point_EqualityTemp AS SELECT p1.location.STEquals(p2.location) AS Equality FROM TestSpatialFunction_SPATIALPOINTGEOG_dttemp p1 CROSS JOIN TestSpatialFunction_SPATIALPOINTGEOG_dttemp p2 ORDER BY p1.location.Lat; + +CREATE VIEW TestSpatialFunction_point_inTemp AS SELECT p1.location.STContains(p2.location) AS isIn FROM TestSpatialFunction_SPATIALPOINTGEOG_dttemp p1 CROSS JOIN TestSpatialFunction_SPATIALPOINTGEOG_dttemp p2; + +CREATE VIEW TestSpatialFunction_SRIDFromGeom AS SELECT PointColumn.STSrid AS SRID FROM TestSpatialFunction_YourTableTemp; + +CREATE VIEW TestSpatialFunction_SRIDFromGeog AS SELECT location.STSrid AS Area FROM TestSpatialFunction_SPATIALPOINTGEOG_dttemp ORDER BY location.Lat; diff --git a/test/JDBC/expected/Test-spatial-functions-vu-verify.out b/test/JDBC/expected/Test-spatial-functions-vu-verify.out new file mode 100644 index 00000000000..3bb3e11e8ec --- /dev/null +++ b/test/JDBC/expected/Test-spatial-functions-vu-verify.out @@ -0,0 +1,1419 @@ +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SELECT @point1.STEquals(@point2) AS Equal; +go +~~START~~ +bit +1 +~~END~~ + + +DECLARE @point1 geography, @point2 geography; +SET @point1 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SET @point2 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point1.STEquals(@point2) AS Equal; +go +~~START~~ +bit +1 +~~END~~ + + +DECLARE @point1 geography, @point2 geography; +SET @point1 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SET @point2 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point1.STContains(@point2) AS isIN; +go +~~START~~ +bit +1 +~~END~~ + + +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 0); +SELECT @point1.STEquals(@point2) AS Equal; +go +~~START~~ +bit + +~~END~~ + + +DECLARE @point1 geography, @point2 geography; +SET @point1 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SET @point2 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point1 . STEquals(@point2) AS Equal; +go +~~START~~ +bit +1 +~~END~~ + + +DECLARE @point1 geography, @point2 geography; +SET @point1 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SET @point2 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point1 . STContains(@point2) AS isIN; +go +~~START~~ +bit +1 +~~END~~ + + +DECLARE @point1 geography; +SET @point1 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point1.STSrid; +Go +~~START~~ +int +4326 +~~END~~ + + +-- Verifying with precision +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SELECT STEquals(@point1, @point2); +go +~~START~~ +bit +1 +~~END~~ + + +DECLARE @point1 geography, @point2 geography; +SET @point1 = geography::STGeomFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geography::STGeomFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SELECT @point1.STEquals(@point2) AS Equal; +go +~~START~~ +bit +1 +~~END~~ + + +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geometry::STPointFromText('POINT(-122.354657658684000 47.658678768678100)', 4326); +SELECT STEquals(@point1, @point2); +go +~~START~~ +bit +0 +~~END~~ + + +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SELECT @point1 . STEquals ( @point2 ); +go +~~START~~ +bit +1 +~~END~~ + + +SELECT PointColumn1.STEquals(PointColumn2) AS Equals FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +go +~~START~~ +bit +1 +~~END~~ + + +DECLARE @point1 geometry = geometry::Point(1.0, 2.0, 4326); +SELECT PointColumn1.STEquals(@point1) AS Equals FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +go +~~START~~ +bit +0 +~~END~~ + + +DECLARE @point1 geometry = geometry::Point(1.0, 2.0, 4326); +SELECT @point1.STEquals(PointColumn2) AS Equals FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +go +~~START~~ +bit +0 +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +DECLARE @isEqual BIT = 0; +SELECT PointColumn.STSrid FROM TestSpatialFunction_YourTableTemp WHERE PointColumn.STEquals(@referencePoint) = @isEqual ORDER BY PointColumn.STSrid; +go +~~START~~ +int +4326 +4326 +~~END~~ + + +SELECT ID, PointColumn1.STEquals(PointColumn2) AS Equal_points FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +go +~~START~~ +int#!#bit +1#!#1 +~~END~~ + + +SELECT PointA.STAsText(),PointB.STAsText() FROM TestSpatialFunction_TableATemp JOIN TestSpatialFunction_TableBTemp ON PointA.STEquals(TestSpatialFunction_TableBTemp.PointB) != 1 ORDER BY PointA.STX; +go +~~START~~ +text#!#text +POINT(1 2)#!#POINT(3 4) +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointA.STAsText(),PointB.STAsText() FROM TestSpatialFunction_TableATemp JOIN TestSpatialFunction_TableBTemp ON @referencePoint.STEquals(TestSpatialFunction_TableBTemp.PointB) = 1 ORDER BY PointA.STX; +go +~~START~~ +text#!#text +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointA.STAsText(),PointB.STAsText() FROM TestSpatialFunction_TableATemp JOIN TestSpatialFunction_TableBTemp ON PointA.STEquals(@referencePoint) != 1 ORDER BY PointA.STX; +go +~~START~~ +text#!#text +POINT(1 2)#!#POINT(3 4) +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointColumn.STSrid FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STSrid; +go +~~START~~ +int +0 +4326 +4326 +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointColumn.STSrid FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STSrid; +go +~~START~~ +int +0 +4326 +4326 +~~END~~ + + +SELECT PointColumn1.STAsText() FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +go +~~START~~ +text +POINT(3 4) +~~END~~ + + +DECLARE @isEqual BIT = 1; +SELECT ID, PointColumn1.STEquals(PointColumn2) AS isEqual, +CASE WHEN PointColumn1.STEquals(PointColumn2) = @isEqual THEN 'yes' ELSE 'no' +END AS isEqual +FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +go +~~START~~ +int#!#bit#!#text +1#!#1#!#yes +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +WITH EqualCTE AS ( SELECT ID, PointColumn.STEquals(@referencePoint) AS Equality FROM TestSpatialFunction_YourTableTemp) +SELECT * FROM EqualCTE WHERE Equality = 1 ORDER BY Equality; +go +~~START~~ +int#!#bit +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +WITH EqualCTE AS ( SELECT ID, PointColumn.STEquals(@referencePoint) AS Equal FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX) +SELECT * FROM EqualCTE WHERE Equal = 1.0 ORDER BY Equal; +GO +~~START~~ +int#!#bit +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +WITH EqualCTE AS ( SELECT ID, @referencePoint.STEquals(PointColumn) AS Equal FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX) +SELECT * FROM EqualCTE WHERE Equal != 1.0 ORDER BY Equal; +GO +~~START~~ +int#!#bit +1#!#0 +2#!#0 +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +DECLARE @isEqual BIT = 1; +SELECT ID, PointColumn.STEquals(@referencePoint) AS EqualityReferencePoint, +CASE WHEN PointColumn.STEquals(@referencePoint) = @isEqual THEN 'Close' +ELSE 'Far' +END AS Proximity +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +go +~~START~~ +int#!#bit#!#text +1#!#0#!#Far +3#!##!#Far +2#!#0#!#Far +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, @referencePoint.STEquals(PointColumn) AS EqualityReferencePoint, +CASE WHEN @referencePoint.STEquals(PointColumn) = @referencePoint.STY THEN 'Close' +ELSE 'Far' +END AS Proximity +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +go +~~START~~ +int#!#bit#!#text +1#!#0#!#Close +3#!##!#Far +2#!#0#!#Close +~~END~~ + + +DECLARE @Ranges TABLE (MinDistance float, MaxDistance float); +INSERT INTO @Ranges VALUES (0, 5), (5, 10), (10, 15); +SELECT * FROM ( SELECT ID, +CASE WHEN PointColumn1.STEquals(PointColumn2) BETWEEN 0 AND 1 THEN 'yes' +ELSE 'no' +END AS Range +FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX +) AS Source +PIVOT ( COUNT(ID) FOR Range IN ([0-5], [5.1-10], [10.1-15], [15.1+])) AS PivotTable; +go +~~ROW COUNT: 3~~ + +~~START~~ +int#!#int#!#int#!#int +0#!#0#!#0#!#0 +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, PointColumn.STEquals(@referencePoint) AS Equality FROM TestSpatialFunction_DB.dbo.TestSpatialFunction_YourTable1Temp ORDER BY PointColumn.STX; +go +~~START~~ +int#!#bit +1#!#0 +3#!# +2#!#0 +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, PointColumn.STEquals(@referencePoint) AS Equal, +JSON_QUERY('{"Equal":' + CAST(PointColumn.STEquals(@referencePoint) AS NVARCHAR(MAX)) + '}') AS Json +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +go +~~START~~ +int#!#bit#!#nvarchar +1#!#0#!#{"Equal": 0} +3#!##!# +2#!#0#!#{"Equal": 0} +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, @referencePoint.STEquals(PointColumn) AS Equal, +JSON_QUERY('{"Equal":' + CAST(@referencePoint.STEquals(PointColumn) AS NVARCHAR(MAX)) + '}') Json +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +go +~~START~~ +int#!#bit#!#nvarchar +1#!#0#!#{"Equal": 0} +3#!##!# +2#!#0#!#{"Equal": 0} +~~END~~ + + +SELECT [PointColumn1].STEquals([PointColumn2]) AS Equality FROM [TestSpatialFunction_YourTableTemp2] ORDER BY PointColumn1.STX; +go +~~START~~ +bit +1 +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +DECLARE @isEqual BIT = 1; +DECLARE @sql NVARCHAR(MAX); +DECLARE @params NVARCHAR(MAX); +SET @sql = N' +SELECT ID, PointColumn.STEquals(@referencePoint) AS EqualityReferencePoint, +CASE WHEN PointColumn.STEquals(@referencePoint) = @isEqual THEN ''Close'' +ELSE ''Far'' +END AS Proximity +FROM TestSpatialFunction_YourTableTemp +WHERE PointColumn.STEquals(@referencePoint) = @isEqual;'; +SET @params = N'@referencePoint geometry, @isEqual float'; +EXEC sp_executesql @sql, @params, @referencePoint, @isEqual; +go +~~START~~ +int#!#bit#!#text +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointColumn.STEquals(@referencePoint) AS Equality FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +SELECT TestSpatialFunction_YourTableTemp.PointColumn.STEquals(@referencePoint) AS Equality FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +SELECT dbo.TestSpatialFunction_YourTableTemp.PointColumn.STEquals(@referencePoint) AS Equality FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Remote procedure/function reference with 4-part object name is not currently supported in Babelfish)~~ + + +DECLARE @pnt geometry; +SET @pnt = geometry::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +select geometry::Point(@pnt.STY, @pnt.STX, 4326).STEquals(@pnt) +go +~~START~~ +bit +0 +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +DECLARE @equal BIT = 1; +SELECT ROUND(PointColumn.STEquals(@referencePoint) / @equal, 0) * @equal AS Equalitygroup, +COUNT(*) AS PointCount +FROM TestSpatialFunction_YourTableTemp +GROUP BY ROUND(PointColumn.STEquals(@referencePoint) / @equal, 0) * @equal +ORDER BY Equalitygroup; +GO +~~START~~ +numeric#!#int +#!#1 +0#!#2 +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(1.0, 0.0, 4326); +SELECT ROUND(PointColumn.STEquals(@referencePoint) / @referencePoint.STX, 0) * @referencePoint.STX AS Equalitygroup, +COUNT(*) AS PointCount +FROM TestSpatialFunction_YourTableTemp +GROUP BY ROUND(PointColumn.STEquals(@referencePoint) / @referencePoint.STX, 0) * @referencePoint.STX +ORDER BY Equalitygroup; +GO +~~START~~ +float#!#int +#!#1 +0.0#!#2 +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, PointColumn1.STEquals(PointColumn2) AS equal, +cast(PointColumn1.STEquals(@referencePoint) as int) - LAG(PointColumn1.STEquals(PointColumn2)) OVER (ORDER BY ID) AS Equalitygroup +FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +GO +~~START~~ +int#!#bit#!#int +1#!#1#!# +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, PointColumn.STEquals(@referencePoint) AS equal, +cast(@referencePoint.STContains(PointColumn) as int) - LAG(@referencePoint.STX) OVER (ORDER BY ID) AS Equalitygroup +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +GO +~~START~~ +int#!#bit#!#float +1#!#0#!# +3#!##!# +2#!#0#!#0.0 +~~END~~ + + +-- Verifying with precision +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SELECT STContains(@point1, @point2); +go +~~START~~ +bit +1 +~~END~~ + + +DECLARE @point1 geography, @point2 geography; +SET @point1 = geography::STGeomFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geography::STGeomFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SELECT @point1.STContains(@point2) AS isIN; +go +~~START~~ +bit +1 +~~END~~ + + +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geometry::STPointFromText('POINT(-122.354657658684000 47.658678768678100)', 4326); +SELECT STContains(@point1, @point2); +go +~~START~~ +bit +0 +~~END~~ + + +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SELECT @point1.STContains(@point2); +go +~~START~~ +bit +1 +~~END~~ + + +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SELECT @point1 . STContains ( @point2 ); +Go +~~START~~ +bit +1 +~~END~~ + + +SELECT ID, PointColumn1.STContains(PointColumn2) AS contain FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +GO +~~START~~ +int#!#bit +1#!#1 +~~END~~ + + +DECLARE @point1 geometry = geometry::Point(1.0, 2.0, 4326); +SELECT ID, PointColumn1.STContains(@point1) AS contain FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +GO +~~START~~ +int#!#bit +1#!#0 +~~END~~ + + +DECLARE @point1 geometry = geometry::Point(1.0, 2.0, 4326); +SELECT ID, @point1.STContains(PointColumn2) AS contain FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +GO +~~START~~ +int#!#bit +1#!#0 +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +DECLARE @contain BIT = 1; +SELECT PointColumn.STAsText() FROM TestSpatialFunction_YourTableTemp WHERE PointColumn.STContains(@referencePoint) = @contain ORDER BY PointColumn.STX; +GO +~~START~~ +text +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointColumn.STAsText() FROM TestSpatialFunction_YourTableTemp WHERE @referencePoint.STContains(PointColumn) = @referencePoint.STX ORDER BY PointColumn.STX; +GO +~~START~~ +text +POINT(3 4) +POINT(5 6) +~~END~~ + + +SELECT ID, PointColumn1.STContains(PointColumn2) AS contain FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +go +~~START~~ +int#!#bit +1#!#1 +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointColumn.STAsText() FROM TestSpatialFunction_YourTableTemp WHERE PointColumn.STContains(@referencePoint) != @referencePoint.STX ORDER BY PointColumn.STX; +GO +~~START~~ +text +~~END~~ + + +SELECT PointA.STAsText(),PointB.STAsText() FROM TestSpatialFunction_TableATemp JOIN TestSpatialFunction_TableBTemp ON PointA.STContains(TestSpatialFunction_TableBTemp.PointB) = 1 ORDER BY TestSpatialFunction_TableBTemp.PointB.STX; +GO +~~START~~ +text#!#text +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointA.STAsText(),PointB.STAsText() FROM TestSpatialFunction_TableATemp JOIN TestSpatialFunction_TableBTemp ON @referencePoint.STContains(TestSpatialFunction_TableBTemp.PointB) = 1 ORDER BY TestSpatialFunction_TableBTemp.PointB.STX; +GO +~~START~~ +text#!#text +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointA.STAsText(),PointB.STAsText() FROM TestSpatialFunction_TableATemp JOIN TestSpatialFunction_TableBTemp ON PointA.STContains(@referencePoint) = 1 ORDER BY TestSpatialFunction_TableBTemp.PointB.STX; +GO +~~START~~ +text#!#text +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointA.STAsText(),PointB.STAsText() FROM TestSpatialFunction_TableATemp JOIN TestSpatialFunction_TableBTemp ON TestSpatialFunction_TableBTemp.PointB.STContains(@referencePoint) = 0 ORDER BY TestSpatialFunction_TableBTemp.PointB.STX; +GO +~~START~~ +text#!#text +POINT(1 2)#!#POINT(3 4) +~~END~~ + + +SELECT PointColumn1.STAsText() FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +GO +~~START~~ +text +POINT(3 4) +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointColumn.STAsText() FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +GO +~~START~~ +text +POINT(3 4) +POINT(3 4) +POINT(5 6) +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointColumn.STAsText() FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +GO +~~START~~ +text +POINT(3 4) +POINT(3 4) +POINT(5 6) +~~END~~ + + +DECLARE @contains BIT = 1 ; +SELECT ID, PointColumn1.STContains(PointColumn2) AS doContain, +CASE WHEN PointColumn1.STContains(PointColumn2) = @contains THEN 'Contains' ELSE 'Do_not_contain' +END AS Proximity +FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +GO +~~START~~ +int#!#bit#!#text +1#!#1#!#Contains +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, PointColumn1.STContains(@referencePoint) AS contain, +CASE WHEN @referencePoint.STContains(PointColumn2) = @referencePoint.STX THEN 'Contains' ELSE 'Do_not_contain' +END AS Proximity +FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +GO +~~START~~ +int#!#bit#!#text +1#!#0#!#Contains +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +WITH CTE AS ( SELECT ID, PointColumn.STContains(@referencePoint) AS contain FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX) +SELECT * FROM CTE WHERE contain = 1 ORDER BY contain; +GO +~~START~~ +int#!#bit +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +WITH CTE AS ( SELECT ID, @referencePoint.STContains(PointColumn) AS contain FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX) +SELECT * FROM CTE WHERE contain = 1 ORDER BY contain; +GO +~~START~~ +int#!#bit +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +DECLARE @contains BIT = 1; +SELECT ID, PointColumn.STContains(@referencePoint) AS ReferencePoint, +CASE WHEN PointColumn.STContains(@referencePoint) = @contains THEN 'contain' +ELSE 'do_not_contain' +END AS Proximity +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +go +~~START~~ +int#!#bit#!#text +1#!#0#!#do_not_contain +3#!##!#do_not_contain +2#!#0#!#do_not_contain +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, @referencePoint.STContains(PointColumn) AS ReferencePoint, +CASE WHEN @referencePoint.STContains(PointColumn) = @referencePoint.STY THEN 'contain' +ELSE 'do_not_contain' +END AS Proximity +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +go +~~START~~ +int#!#bit#!#text +1#!#0#!#contain +3#!##!#do_not_contain +2#!#0#!#contain +~~END~~ + + +DECLARE @Ranges TABLE (MinDistance float, MaxDistance float); +INSERT INTO @Ranges VALUES (0, 5), (5, 10), (10, 15); +SELECT * FROM ( SELECT ID, +CASE WHEN PointColumn1.STContains(PointColumn2) BETWEEN 0 AND 1 THEN 'contain' +ELSE 'do_not_contain' +END AS Range +FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX +) AS Source +PIVOT ( COUNT(ID) FOR Range IN ([0-5], [5.1-10], [10.1-15], [15.1+])) AS PivotTable; +go +~~ROW COUNT: 3~~ + +~~START~~ +int#!#int#!#int#!#int +0#!#0#!#0#!#0 +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, PointColumn.STContains(@referencePoint) AS contain FROM TestSpatialFunction_DB.dbo.TestSpatialFunction_YourTable1Temp ORDER BY PointColumn.STX; +go +~~START~~ +int#!#bit +1#!#0 +3#!# +2#!#0 +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, PointColumn.STContains(@referencePoint) AS contain, +JSON_QUERY('{"Contain":' + CAST(PointColumn.STContains(@referencePoint) AS NVARCHAR(MAX)) + '}') AS Json +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +go +~~START~~ +int#!#bit#!#nvarchar +1#!#0#!#{"Contain": 0} +3#!##!# +2#!#0#!#{"Contain": 0} +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, @referencePoint.STContains(PointColumn) AS contain, +JSON_QUERY('{"Contain":' + CAST(@referencePoint.STContains(PointColumn) AS NVARCHAR(MAX)) + '}') Json +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +go +~~START~~ +int#!#bit#!#nvarchar +1#!#0#!#{"Contain": 0} +3#!##!# +2#!#0#!#{"Contain": 0} +~~END~~ + + +SELECT [PointColumn1].STContains([PointColumn2]) AS contain FROM [TestSpatialFunction_YourTableTemp2] ORDER BY PointColumn1.STX; +go +~~START~~ +bit +1 +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +DECLARE @contains BIT = 1; +DECLARE @sql NVARCHAR(MAX); +DECLARE @params NVARCHAR(MAX); +SET @sql = N' +SELECT ID, PointColumn.STContains(@referencePoint) AS EqualityReferencePoint, +CASE WHEN PointColumn.STContains(@referencePoint) = @contains THEN ''contains'' +ELSE ''do_not_contain'' +END AS Proximity +FROM TestSpatialFunction_YourTableTemp +WHERE PointColumn.STContains(@referencePoint) = @contains;'; +SET @params = N'@referencePoint geometry, @contains float'; +EXEC sp_executesql @sql, @params, @referencePoint, @contains; +go +~~START~~ +int#!#bit#!#text +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointColumn.STContains(@referencePoint) AS contain FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +SELECT TestSpatialFunction_YourTableTemp.PointColumn.STContains(@referencePoint) AS contain FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +SELECT dbo.TestSpatialFunction_YourTableTemp.PointColumn.STContains(@referencePoint) AS contain FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Remote procedure/function reference with 4-part object name is not currently supported in Babelfish)~~ + + + +DECLARE @pnt geometry; +SET @pnt = geometry::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +select geometry::Point(@pnt.STY, @pnt.STX, 4326).STContains(@pnt) +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +DECLARE @contains BIT = 1; +SELECT ROUND(PointColumn.STContains(@referencePoint) / @contains, 0) * @contains AS Grp, +COUNT(*) AS PointCount +FROM TestSpatialFunction_YourTableTemp +GROUP BY ROUND(PointColumn.STContains(@referencePoint) / @contains, 0) * @contains +ORDER BY Grp; +GO +~~START~~ +bit +0 +~~END~~ + +~~START~~ +numeric#!#int +#!#1 +0#!#2 +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(1.0, 0.0, 4326); +SELECT ROUND(PointColumn.STContains(@referencePoint) / @referencePoint.STX, 0) * @referencePoint.STX AS GRP, +COUNT(*) AS PointCount +FROM TestSpatialFunction_YourTableTemp +GROUP BY ROUND(PointColumn.STContains(@referencePoint) / @referencePoint.STX, 0) * @referencePoint.STX +ORDER BY Grp; +GO +~~START~~ +float#!#int +#!#1 +0.0#!#2 +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, PointColumn1.STContains(PointColumn2) AS contain, +cast(PointColumn1.STContains(@referencePoint) as int) - LAG(PointColumn1.STContains(PointColumn2)) OVER (ORDER BY ID) AS Difference +FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +GO +~~START~~ +int#!#bit#!#int +1#!#1#!# +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, PointColumn.STContains(@referencePoint) AS contain, +cast(@referencePoint.STContains(PointColumn) as int) - LAG(@referencePoint.STX) OVER (ORDER BY ID) AS Difference +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +GO +~~START~~ +int#!#bit#!#float +1#!#0#!# +3#!##!# +2#!#0#!#0.0 +~~END~~ + + +DECLARE @point geometry; +SET @point = geometry::STPointFromText('POINT(-122.34900 47.65100)', 4326); +SELECT STArea(@point); +go +~~START~~ +float +0.0 +~~END~~ + + +DECLARE @point geography; +SET @point = geography::STPointFromText('POINT(-122.34900 47.65100)', 4326); +SELECT STArea(@point); +go +~~START~~ +float +0.0 +~~END~~ + + +DECLARE @point geometry; +SET @point = geometry::STPointFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point.STArea(); +Go +~~START~~ +float +0.0 +~~END~~ + + +DECLARE @point geography; +SET @point = geography::STPointFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point.STArea(); +Go +~~START~~ +float +0.0 +~~END~~ + + +DECLARE @point geometry; +SET @point = geometry::POINT(22.34900, -47.65100, 4326); +SELECT @point . STArea ( ); +Go +~~START~~ +float +0.0 +~~END~~ + + +DECLARE @point geography; +SET @point = geography::POINT(22.34900, -47.65100, 4326); +SELECT @point . STArea ( ); +Go +~~START~~ +float +0.0 +~~END~~ + + +SELECT location.STArea() from TestSpatialFunction_SPATIALPOINTGEOM_dttemp ORDER BY location.STX; +GO +~~START~~ +float +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +~~END~~ + + +SELECT location.STArea() from TestSpatialFunction_SPATIALPOINTGEOG_dttemp ORDER BY location.Lat; +GO +~~START~~ +float +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +~~END~~ + + +DECLARE @point geography; +SET @point = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT STArea(@point); +SELECT @point.STArea(); +Go +~~START~~ +float +0.0 +~~END~~ + +~~START~~ +float +0.0 +~~END~~ + + +DECLARE @point geography; +SET @point = geography::Point(22.34900, -47.65100, 4326); +SELECT STArea(@point); +SELECT @point.STArea(); +Go +~~START~~ +float +0.0 +~~END~~ + +~~START~~ +float +0.0 +~~END~~ + + +DECLARE @point1 geometry, @point2 geometry, @point3 geometry; +SET @point1 = geometry::STPointFromText(null, 4326); +SET @point2 = geometry::STGeomFromText(null, 4326); +SET @point3 = geometry::Point(22.34900, -47.65100, 4326); +SELECT @point1.STEquals(@point2); +SELECT @point3.STEquals(@point2); +SELECT @point1.STEquals(@point3); +SELECT @point1.STContains(@point2); +SELECT @point3.STContains(@point2); +SELECT @point1.STContains(@point3); +go +~~START~~ +bit + +~~END~~ + +~~START~~ +bit + +~~END~~ + +~~START~~ +bit + +~~END~~ + +~~START~~ +bit + +~~END~~ + +~~START~~ +bit + +~~END~~ + +~~START~~ +bit + +~~END~~ + + +-- Negative test for Geospatial functions +DECLARE @point1 geometry, @point2 varchar(50), @point3 int; +SET @point1 = geometry::Point(22.34900, -47.65100, 4326); +SET @point2 = 'Test_String'; +SELECT @point1.STEquals(@point2); +SELECT @point1.STContains(@point2); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: parse error - invalid geometry)~~ + + +DECLARE @point1 geography, @point2 varchar(50), @point3 int; +SET @point1 = geography::Point(22.34900, -47.65100, 4326); +SET @point2 = 'Test_String'; +SELECT @point1.STEquals(@point2); +SELECT @point1.STContains(@point2); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: parse error - invalid geometry)~~ + + +-- Null test for Geospatial functions +DECLARE @point1 geography, @point2 geography, @point3 geography; +SET @point1 = geography::STPointFromText(null, 4326); +SET @point2 = geography::STGeomFromText(null, 4326); +SET @point3 = geography::Point(22.34900, -47.65100, 4326); +SELECT @point1.STEquals(@point2); +SELECT @point3.STEquals(@point2); +SELECT @point1.STEquals(@point3); +SELECT @point1.STContains(@point2); +SELECT @point3.STContains(@point2); +SELECT @point1.STContains(@point3); +go +~~START~~ +bit + +~~END~~ + +~~START~~ +bit + +~~END~~ + +~~START~~ +bit + +~~END~~ + +~~START~~ +bit + +~~END~~ + +~~START~~ +bit + +~~END~~ + +~~START~~ +bit + +~~END~~ + + +DECLARE @g geometry; +SELECT @g.STArea(); +go +~~START~~ +float + +~~END~~ + + +SELECT location.STArea() from TestSpatialFunction_SPATIALPOINTGEOG_dttemp ORDER BY location.Lat; +GO +~~START~~ +float +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +0.0 +~~END~~ + + +-- Combining geometry and geography in a single query +DECLARE @point1 geometry, @point2 geography; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point1.STContains(@point2); +go +~~ERROR (Code: 206)~~ + +~~ERROR (Message: The function stcontains is found but cannot be used. Possibly due to datatype mismatch and implicit casting is not allowed.)~~ + + +DECLARE @point1 geometry, @point2 geography; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point2.STContains(@point1); +go +~~ERROR (Code: 206)~~ + +~~ERROR (Message: The function stcontains is found but cannot be used. Possibly due to datatype mismatch and implicit casting is not allowed.)~~ + + +DECLARE @point1 geometry, @point2 geography; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point1.STEquals(@point2); +go +~~ERROR (Code: 206)~~ + +~~ERROR (Message: The function stequals is found but cannot be used. Possibly due to datatype mismatch and implicit casting is not allowed.)~~ + + +DECLARE @point1 geometry, @point2 geography; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point2.STEquals(@point1); +go +~~ERROR (Code: 206)~~ + +~~ERROR (Message: The function stequals is found but cannot be used. Possibly due to datatype mismatch and implicit casting is not allowed.)~~ + + +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::Point(22.34900, -47.65100, 4326); +SET @point2 = geometry::STGeomFromText('POINT(1 1)', 0); +SELECT @point1.STEquals(@point2); +go +~~START~~ +bit + +~~END~~ + + +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::Point(22.34900, -47.65100, 4326); +SET @point2 = geometry::STGeomFromText('POINT(1 1)', 0); +SELECT @point1.STContains(@point2); +go +~~START~~ +bit + +~~END~~ + + +DECLARE @point1 geometry; +SET @point1 = geometry::Point(3.0, 4.0, 4326); +SELECT PointColumn.STAsText() from TestSpatialFunction_YourTableTemp where PointColumn <> @point1; +GO +~~START~~ +text +POINT(5 6) +POINT(3 4) +~~END~~ + + +DECLARE @point1 geometry; +SET @point1 = geometry::Point(3.0, 4.0, 4326); +SELECT PointColumn.STAsText() from TestSpatialFunction_YourTableTemp where PointColumn = @point1; +GO +~~START~~ +text +POINT(3 4) +~~END~~ + + +SELECT PointColumn.STSrid from TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STSrid; +GO +~~START~~ +int +0 +4326 +4326 +~~END~~ + + +SELECT [PointColumn].[STSrid] from TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +GO +~~START~~ +int +4326 +0 +4326 +~~END~~ + + +SELECT location.STSrid from TestSpatialFunction_SPATIALPOINTGEOG_dttemp ORDER BY location.STSrid; +GO +~~START~~ +int +4326 +4326 +4326 +4326 +4326 +4326 +4326 +4326 +4326 +4326 +~~END~~ + + +SELECT [location].[STSrid] from TestSpatialFunction_SPATIALPOINTGEOG_dttemp ORDER BY location.Lat; +GO +~~START~~ +int +4326 +4326 +4326 +4326 +4326 +4326 +4326 +4326 +4326 +4326 +~~END~~ + + +DECLARE @point geometry; +SET @point = geometry::Point(1.0, 2.0, 4326); +SELECT @point.STSrid AS Srid; +GO +~~START~~ +int +4326 +~~END~~ + + +DECLARE @point geometry = geometry::Point(1.0, 2.0, 4326); +SELECT PointColumn.STSrid FROM TestSpatialFunction_YourTableTemp WHERE PointColumn.STSrid = @point.STSrid ORDER BY PointColumn.STSrid; +GO +~~START~~ +int +4326 +4326 +~~END~~ + + +DECLARE @point geography = geography::Point(1.0, 2.0, 4326); +SELECT location.STSrid FROM TestSpatialFunction_SPATIALPOINTGEOG_dttemp WHERE location.STSrid = @point.STSrid ORDER BY location.STSrid; +GO +~~START~~ +int +4326 +4326 +4326 +4326 +4326 +4326 +4326 +4326 +4326 +4326 +~~END~~ + + +SELECT * FROM TestSpatialFunction_TableATemp JOIN TestSpatialFunction_TableBTemp ON TestSpatialFunction_TableATemp.PointA.STSrid = TestSpatialFunction_TableBTemp.PointB.STSrid ORDER BY TestSpatialFunction_TableBTemp.PointB.STSrid; +GO +~~START~~ +int#!#geometry#!#int#!#geometry +1#!#E6100000010C000000000000F03F0000000000000040#!#1#!#E6100000010C00000000000008400000000000001040 +~~END~~ + + +DECLARE @point geometry = geometry::Point(1.0, 2.0, 4326); +SELECT * FROM TestSpatialFunction_TableATemp JOIN TestSpatialFunction_TableBTemp ON TestSpatialFunction_TableATemp.PointA.STSrid = @point.STSrid ORDER BY TestSpatialFunction_TableBTemp.PointB.STSrid; +GO +~~START~~ +int#!#geometry#!#int#!#geometry +1#!#E6100000010C000000000000F03F0000000000000040#!#1#!#E6100000010C00000000000008400000000000001040 +~~END~~ + + +SELECT PointColumn.STSrid FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STSrid; +GO +~~START~~ +int +0 +4326 +4326 +~~END~~ + + +DECLARE @point geometry = geometry::Point(1.0, 2.0, 4326); +SELECT PointColumn.STSrid FROM TestSpatialFunction_YourTableTemp ORDER BY @point.STSrid; +GO +~~START~~ +int +4326 +4326 +0 +~~END~~ + + +SELECT PointColumn.STSrid AS SRID FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STSrid; +GO +~~START~~ +int +0 +4326 +4326 +~~END~~ + + +SELECT TestSpatialFunction_YourTableTemp.PointColumn.STSrid AS SRID FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STSrid; +GO +~~START~~ +int +0 +4326 +4326 +~~END~~ + + +SELECT dbo.YourTable.PointColumn.STSrid AS SRID FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STSrid; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The multi-part identifier "dbo.YourTable.PointColumn.STSrid" could not be bound.)~~ + + +SELECT ID, PointColumn.STSrid AS SRID, +JSON_QUERY('{"SRID":' + CAST(PointColumn.STSrid AS NVARCHAR(MAX)) + '}') AS SRIDJson +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STSrid; +GO +~~START~~ +int#!#int#!#nvarchar +3#!#0#!#{"SRID": 0} +1#!#4326#!#{"SRID": 4326} +2#!#4326#!#{"SRID": 4326} +~~END~~ + + +SELECT TestSpatialFunction_YourTable1Temp.ID, TestSpatialFunction_YourTable1Temp.PointColumn.STSrid AS SRID +FROM TestSpatialFunction_DB.dbo.TestSpatialFunction_YourTable1Temp; +GO +~~START~~ +int#!#int +1#!#4326 +2#!#4326 +3#!#0 +~~END~~ + + +DECLARE @point geometry = geometry::Point(1.0, 2.0, 4326); +SELECT PointColumn.STSrid AS SRID, COUNT(*) AS PointCount +FROM TestSpatialFunction_YourTableTemp GROUP BY PointColumn.STSrid ORDER BY PointCount; +GO +~~START~~ +int#!#int +0#!#1 +4326#!#2 +~~END~~ + + +SELECT ID, PointColumn.STSrid AS XCoordinate, +CASE WHEN PointColumn.STSrid = 0 THEN 'Zero SRID' +ELSE 'Positive SRID' END AS SRID FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STSrid; +GO +~~START~~ +int#!#int#!#text +3#!#0#!#Zero SRID +1#!#4326#!#Positive SRID +2#!#4326#!#Positive SRID +~~END~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +UPDATE TestSpatialFunction_YourTableTemp SET PointColumn = @referencePoint +WHERE PointColumn.STSrid = @referencePoint.STSrid; +GO +~~ROW COUNT: 2~~ + + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +UPDATE TestSpatialFunction_YourTableTemp SET PointColumn = @referencePoint +WHERE PointColumn.STEquals(@referencePoint) != 1; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +UPDATE TestSpatialFunction_YourTableTemp SET PointColumn = @referencePoint +WHERE @referencePoint.STEquals(PointColumn) = 1; +go +~~ROW COUNT: 2~~ + diff --git a/test/JDBC/expected/TestHalfvecDatatype.out b/test/JDBC/expected/TestHalfvecDatatype.out new file mode 100644 index 00000000000..c1b249ebf66 --- /dev/null +++ b/test/JDBC/expected/TestHalfvecDatatype.out @@ -0,0 +1,1771 @@ +-- tsql +-- should throw error since vector is only allowed in sys +exec sp_execute_postgresql 'create extension vector'; +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'vector' extension creation is restricted to 'sys' schema)~~ + + +exec sp_execute_postgresql 'create extension vector with schema sys'; +go + +create login vector_login with password='12345678' +go + +Alter server role sysadmin add member vector_login +go + +create database vector_db; +go + +use vector_db +go + +-- tsql user=vector_login password=12345678 +use vector_db; +go + +select set_config('babelfishpg_tsql.explain_costs', 'off', false); +go +~~START~~ +text +off +~~END~~ + +select set_config('babelfishpg_tsql.explain_timing', 'off', false); +go +~~START~~ +text +off +~~END~~ + +select set_config('babelfishpg_tsql.explain_summary', 'off', false); +go +~~START~~ +text +off +~~END~~ + + +SELECT CAST('[1,2,3]' as halfvec); +go +~~START~~ +varchar +[1,2,3] +~~END~~ + + +SELECT CAST('[-1,-2,-3]' as halfvec); +go +~~START~~ +varchar +[-1,-2,-3] +~~END~~ + + +SELECT CAST('[1.,2.,3.]' as halfvec); +go +~~START~~ +varchar +[1,2,3] +~~END~~ + + +SELECT CAST(' [ 1, 2 , 3 ] ' as halfvec); +go +~~START~~ +varchar +[1,2,3] +~~END~~ + + +SELECT CAST('[1.23456]' as halfvec); +go +~~START~~ +varchar +[1.234375] +~~END~~ + + +SELECT CAST('[hello,1]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[hello,1]")~~ + + +SELECT CAST('[NaN,1]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: NaN not allowed in halfvec)~~ + + +SELECT CAST('[Infinity,1]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: infinite value not allowed in halfvec)~~ + + +SELECT CAST('[-Infinity,1]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: infinite value not allowed in halfvec)~~ + + +SELECT CAST('[65519,-65519]' as halfvec); +go +~~START~~ +varchar +[65504,-65504] +~~END~~ + + +SELECT CAST('[65520,-65520]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: "65520" is out of range for type halfvec)~~ + + +SELECT CAST('[1e-8,-1e-8]' as halfvec); +go +~~START~~ +varchar +[0,-0] +~~END~~ + + +SELECT CAST('[4e38,1]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: "4e38" is out of range for type halfvec)~~ + + +SELECT CAST('[1e-46,1]' as halfvec); +go +~~START~~ +varchar +[0,1] +~~END~~ + + +SELECT CAST('[1,2,3' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[1,2,3")~~ + + +SELECT CAST('[1,2,3]9' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[1,2,3]9")~~ + + +SELECT CAST('1,2,3' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "1,2,3")~~ + + +SELECT CAST('' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "")~~ + + +SELECT CAST('[' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[")~~ + + +SELECT CAST('[ ' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[ ")~~ + + +SELECT CAST('[,' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[,")~~ + + +SELECT CAST('[]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: halfvec must have at least 1 dimension)~~ + + +SELECT CAST('[ ]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: halfvec must have at least 1 dimension)~~ + + +SELECT CAST('[,]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[,]")~~ + + +SELECT CAST('[1,]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[1,]")~~ + + +SELECT CAST('[1a]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[1a]")~~ + + +SELECT CAST('[1,,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[1,,3]")~~ + + +SELECT CAST('[1, ,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[1, ,3]")~~ + + +SELECT CAST('[1,2,3]' as halfvec(3)); +go +~~START~~ +varchar +[1,2,3] +~~END~~ + + +SELECT CAST('[1,2,3]' as halfvec(2)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: expected 2 dimensions, not 3)~~ + + +SELECT CAST('[1,2,3]' as halfvec(3, 2)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid type modifier)~~ + + +SELECT CAST('[1,2,3]' as halfvec('a')); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '(' at line 1 and character position 32)~~ + + +SELECT CAST('[1,2,3]' as halfvec(0)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: dimensions for type halfvec must be at least 1)~~ + + +SELECT CAST('[1,2,3]' as halfvec(16001)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: dimensions for type halfvec cannot exceed 16000)~~ + + +SELECT CAST('{"[1,2,3]"}' as halfvec(2)[]); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '[]' at line 1 and character position 39)~~ + + +SELECT CAST('[1,2,3]' as halfvec) + CAST('[4,5,6]' as halfvec); +go +~~START~~ +varchar +[5,7,9] +~~END~~ + + +SELECT CAST('[65519]' as halfvec) + CAST('[65519]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: value out of range: overflow)~~ + + +SELECT CAST('[1,2]' as halfvec) + CAST('[3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT CAST('[1,2,3]' as halfvec) - CAST('[4,5,6]' as halfvec); +go +~~START~~ +varchar +[-3,-3,-3] +~~END~~ + + +SELECT CAST('[-65519]' as halfvec) - CAST('[65519]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: value out of range: overflow)~~ + + +SELECT CAST('[1,2]' as halfvec) - CAST('[3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT CAST('[1,2,3]' as halfvec) * CAST('[4,5,6]' as halfvec); +go +~~START~~ +varchar +[4,10,18] +~~END~~ + + +SELECT CAST('[65519]' as halfvec) * CAST('[65519]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: value out of range: overflow)~~ + + +SELECT CAST('[1e-7]' as halfvec) * CAST('[1e-7]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: value out of range: underflow)~~ + + +SELECT CAST('[1,2]' as halfvec) * CAST('[3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT CAST('[1,2,3]' as halfvec) + CAST('[4,5]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 3 and 2)~~ + + +SELECT CAST('[1,2,3]' as halfvec) < CAST('[1,2,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '<' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) < CAST('[1,2]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '<' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) <= CAST('[1,2,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '<' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) <= CAST('[1,2]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '<' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) = CAST('[1,2,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '=' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) = CAST('[1,2]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '=' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) != CAST('[1,2,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '!' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) != CAST('[1,2]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '!' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) >= CAST('[1,2,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '>' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) >= CAST('[1,2]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '>' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) > CAST('[1,2,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '>' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) > CAST('[1,2]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '>' at line 1 and character position 34)~~ + + +SELECT halfvec_cmp(CAST('[1,2,3]' as halfvec), CAST('[1,2,3]' as halfvec)); +go +~~START~~ +int +0 +~~END~~ + + +SELECT halfvec_cmp(CAST('[1,2,3]' as halfvec), CAST('[0,0,0]' as halfvec)); +go +~~START~~ +int +1 +~~END~~ + + +SELECT halfvec_cmp(CAST('[0,0,0]' as halfvec), CAST('[1,2,3]' as halfvec)); +go +~~START~~ +int +-1 +~~END~~ + + +SELECT halfvec_cmp(CAST('[1,2]' as halfvec), CAST('[1,2,3]' as halfvec)); +go +~~START~~ +int +-1 +~~END~~ + + +SELECT halfvec_cmp(CAST('[1,2,3]' as halfvec), CAST('[1,2]' as halfvec)); +go +~~START~~ +int +1 +~~END~~ + + +SELECT halfvec_cmp(CAST('[1,2]' as halfvec), CAST('[2,3,4]' as halfvec)); +go +~~START~~ +int +-1 +~~END~~ + + +SELECT halfvec_cmp(CAST('[2,3]' as halfvec), CAST('[1,2,3]' as halfvec)); +go +~~START~~ +int +1 +~~END~~ + + +SELECT vector_dims(CAST('[1,2,3]' as halfvec)); +go +~~START~~ +int +3 +~~END~~ + + +SELECT ROUND(CAST(l2_norm(CAST('[1,1]' as halfvec)) as numeric), 5); +go +~~START~~ +numeric +1.00000 +~~END~~ + + +SELECT l2_norm(CAST('[3,4]' as halfvec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_norm(CAST('[0,1]' as halfvec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT l2_norm(CAST('[0,0]' as halfvec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT l2_norm(CAST('[2]' as halfvec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT l2_distance(CAST('[0,0]' as halfvec), CAST('[3,4]' as halfvec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_distance(CAST('[0,0]' as halfvec), CAST('[0,1]' as halfvec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT l2_distance(CAST('[1,2]' as halfvec), CAST('[3]' as halfvec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT l2_distance(CAST('[1,1,1,1,1,1,1,1,1]' as halfvec), CAST('[1,1,1,1,1,1,1,4,5]' as halfvec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT CAST('[0,0]' as halfvec) <-> CAST('[3,4]' as halfvec); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT inner_product(CAST('[1,2]' as halfvec), CAST('[3,4]' as halfvec)); +go +~~START~~ +float +11.0 +~~END~~ + + +SELECT inner_product(CAST('[1,2]' as halfvec), CAST('[3]' as halfvec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT inner_product(CAST('[65504]' as halfvec), CAST('[65504]' as halfvec)); +go +~~START~~ +float +4.290774016E9 +~~END~~ + + +SELECT inner_product(CAST('[1,1,1,1,1,1,1,1,1]' as halfvec), CAST('[1,2,3,4,5,6,7,8,9]' as halfvec)); +go +~~START~~ +float +45.0 +~~END~~ + + +SELECT CAST('[1,2]' as halfvec) <#> CAST('[3,4]' as halfvec); +go +~~START~~ +float +-11.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,2]' as halfvec), CAST('[2,4]' as halfvec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,2]' as halfvec), CAST('[0,0]' as halfvec)); +go +~~START~~ +float +NaN +~~END~~ + + +SELECT cosine_distance(CAST('[1,1]' as halfvec), CAST('[1,1]' as halfvec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,0]' as halfvec), CAST('[0,2]' as halfvec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,1]' as halfvec), CAST('[-1,-1]' as halfvec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,2]' as halfvec), CAST('[3]' as halfvec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT cosine_distance(CAST('[1,1]' as halfvec), CAST('[1.1,1.1]' as halfvec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,1]' as halfvec), CAST('[-1.1,-1.1]' as halfvec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,2,3,4,5,6,7,8,9]' as halfvec), CAST('[1,2,3,4,5,6,7,8,9]' as halfvec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,2,3,4,5,6,7,8,9]' as halfvec), CAST('[-1,-2,-3,-4,-5,-6,-7,-8,-9]' as halfvec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT CAST('[1,2]' as halfvec) <=> CAST('[2,4]' as halfvec); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT l1_distance(CAST('[0,0]' as halfvec), CAST('[3,4]' as halfvec)); +go +~~START~~ +float +7.0 +~~END~~ + + +SELECT l1_distance(CAST('[0,0]' as halfvec), CAST('[0,1]' as halfvec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT l1_distance(CAST('[1,2]' as halfvec), CAST('[3]' as halfvec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT l1_distance(CAST('[1,2,3,4,5,6,7,8,9]' as halfvec), CAST('[1,2,3,4,5,6,7,8,9]' as halfvec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT l1_distance(CAST('[1,2,3,4,5,6,7,8,9]' as halfvec), CAST('[0,3,2,5,4,7,6,9,8]' as halfvec)); +go +~~START~~ +float +9.0 +~~END~~ + + +SELECT CAST('[0,0]' as halfvec) <+> CAST('[3,4]' as halfvec); +go +~~START~~ +float +7.0 +~~END~~ + + +SELECT l2_normalize(CAST('[3,4]' as halfvec)); +go +~~START~~ +varchar +[0.60009766,0.7998047] +~~END~~ + + +SELECT l2_normalize(CAST('[3,0]' as halfvec)); +go +~~START~~ +varchar +[1,0] +~~END~~ + + +SELECT l2_normalize(CAST('[0,0.1]' as halfvec)); +go +~~START~~ +varchar +[0,1] +~~END~~ + + +SELECT l2_normalize(CAST('[0,0]' as halfvec)); +go +~~START~~ +varchar +[0,0] +~~END~~ + + +SELECT l2_normalize(CAST('[65504]' as halfvec)); +go +~~START~~ +varchar +[1] +~~END~~ + + +SELECT binary_quantize(CAST('[1,0,-1]' as halfvec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: data type bit is not supported yet)~~ + + +SELECT binary_quantize(CAST('[0,0.1,-0.2,-0.3,0.4,0.5,0.6,-0.7,0.8,-0.9,1]' as halfvec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: data type bit is not supported yet)~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 1, 3); +go +~~START~~ +varchar +[1,2,3] +~~END~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 3, 2); +go +~~START~~ +varchar +[3,4] +~~END~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), -1, 3); +go +~~START~~ +varchar +[1] +~~END~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 3, 9); +go +~~START~~ +varchar +[3,4,5] +~~END~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 1, 0); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: halfvec must have at least 1 dimension)~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 3, -1); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: halfvec must have at least 1 dimension)~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), -1, 2); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: halfvec must have at least 1 dimension)~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 2147483647, 10); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: halfvec must have at least 1 dimension)~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 3, 2147483647); +go +~~START~~ +varchar +[3,4,5] +~~END~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), -2147483644, 2147483647); +go +~~START~~ +varchar +[1,2] +~~END~~ + + +SELECT halfvec_avg(array_agg(CAST(n as halfvec))) FROM generate_series(1, 16002) n; +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cannot cast type integer to halfvec)~~ + + +-- hnsw_halfvec +-- l2 +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING hnsw (val halfvec_l2_ops); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,2,3] +[1,2,4] +[1,1,1] +[0,0,0] +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec) NULLS LAST +Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <-> '[3,3,3]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <-> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <-> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <-> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SELECT COUNT(*) FROM halfvec_table; +go +~~START~~ +int +5 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM halfvec_table +Aggregate (actual rows=1 loops=1) + -> Seq Scan on halfvec_table (actual rows=5 loops=1) +~~END~~ + + +TRUNCATE TABLE halfvec_table; +go + +SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec) NULLS LAST +Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=0 loops=1) + Order By: (val <-> '[3,3,3]'::halfvec) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- inner product +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING hnsw (val halfvec_ip_ops); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <#> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,2,4] +[1,2,3] +[1,1,1] +[0,0,0] +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <#> CAST('[3,3,3]' AS halfvec) NULLS LAST +Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <#> '[3,3,3]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <#> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <#> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <#> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- cosine +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING hnsw (val halfvec_cosine_ops); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <=> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,1,1] +[1,2,3] +[1,2,4] +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <=> CAST('[3,3,3]' AS halfvec) NULLS LAST +Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=3 loops=1) + Order By: (val <=> '[3,3,3]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> CAST('[0,0,0]' AS halfvec)) t2; +go +~~START~~ +int +3 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> CAST('[0,0,0]' AS halfvec) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=3 loops=1) + Order By: (val <=> '[0,0,0]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +3 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=3 loops=1) + Order By: (val <=> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- L1 +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING hnsw (val halfvec_l1_ops); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <+> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,2,3] +[1,2,4] +[1,1,1] +[0,0,0] +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <+> CAST('[3,3,3]' AS halfvec) NULLS LAST +Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <+> '[3,3,3]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <+> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <+> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <+> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + +-- ivfflat +-- l2 +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING ivfflat (val halfvec_l2_ops) WITH (lists = 1); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,2,3] +[1,2,4] +[1,1,1] +[0,0,0] +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec) NULLS LAST +Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <-> '[3,3,3]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <-> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <-> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <-> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SELECT COUNT(*) FROM halfvec_table; +go +~~START~~ +int +5 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM halfvec_table +Aggregate (actual rows=1 loops=1) + -> Seq Scan on halfvec_table (actual rows=5 loops=1) +~~END~~ + + +TRUNCATE TABLE halfvec_table; +go + +SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec) NULLS LAST +Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=0 loops=1) + Order By: (val <-> '[3,3,3]'::halfvec) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- inner product +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING ivfflat (val halfvec_ip_ops) WITH (lists = 1) WITH (lists = 1); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near 'lists' at line 1 and character position 92)~~ + + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <#> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,2,4] +[1,2,3] +[1,1,1] +[0,0,0] + +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <#> CAST('[3,3,3]' AS halfvec) NULLS LAST +Sort (actual rows=5 loops=1) + Sort Key: ((val <#> '[3,3,3]'::halfvec)) + Sort Method: quicksort Memory: 25kB + -> Seq Scan on halfvec_table (actual rows=5 loops=1) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <#> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +5 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <#> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Sort (actual rows=5 loops=1) + Sort Key: ((halfvec_table.val <#> $0)) + Sort Method: quicksort Memory: 25kB + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) + -> Seq Scan on halfvec_table (actual rows=5 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- cosine +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING ivfflat (val halfvec_cosine_ops) WITH (lists = 1); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <=> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,1,1] +[1,2,3] +[1,2,4] +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <=> CAST('[3,3,3]' AS halfvec) NULLS LAST +Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=3 loops=1) + Order By: (val <=> '[3,3,3]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> CAST('[0,0,0]' AS halfvec)) t2; +go +~~START~~ +int +3 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> CAST('[0,0,0]' AS halfvec) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=3 loops=1) + Order By: (val <=> '[0,0,0]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +3 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=3 loops=1) + Order By: (val <=> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + +select set_config('babelfishpg_tsql.explain_costs', 'on', false); +go +~~START~~ +text +on +~~END~~ + +select set_config('babelfishpg_tsql.explain_timing', 'on', false); +go +~~START~~ +text +on +~~END~~ + +select set_config('babelfishpg_tsql.explain_summary', 'on', false); +go +~~START~~ +text +on +~~END~~ + + +-- system metadata, all objects get their datatype info from one of: +-- typecodes or datatype_info data we have created. Testing sys.types for typecodes +-- and sp_sproc_columns_100 for datatype_info is enough +select count(*) from sys.types where name = 'halfvec'; +go +~~START~~ +int +1 +~~END~~ + + +create procedure halfvec_proc_1 @a halfvec, @b varchar(max) as select @a as a, @b as b; +go + +exec sp_sproc_columns_100 @procedure_name= 'halfvec_proc_1' +go +~~START~~ +varchar#!#varchar#!#nvarchar#!#varchar#!#smallint#!#smallint#!#varchar#!#int#!#int#!#smallint#!#smallint#!#smallint#!#varchar#!#nvarchar#!#smallint#!#smallint#!#int#!#int#!#varchar#!#tinyint +vector_db#!#dbo#!#halfvec_proc_1;1#!#@RETURN_VALUE#!#5#!#4#!#int#!#10#!#4#!#0#!#10#!#0#!##!##!#4#!##!##!#0#!#NO#!#56 +vector_db#!#dbo#!#halfvec_proc_1;1#!#@a#!#1#!##!#halfvec#!#0#!#-1#!#0#!##!##!##!##!##!##!##!#1#!#NO#!# +vector_db#!#dbo#!#halfvec_proc_1;1#!#@b#!#1#!#12#!#varchar#!#0#!#8000#!#0#!##!#1#!##!##!#12#!##!##!#2#!#YES#!#39 +~~END~~ + + +drop procedure halfvec_proc_1; +go + +create table t(a halfvec(3), b varchar(max)) +go +select * from information_schema.columns where table_name = 't' +go +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#int#!#nvarchar#!#varchar#!#nvarchar#!#int#!#int#!#tinyint#!#smallint#!#int#!#smallint#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +vector_db#!#dbo#!#t#!#a#!#1#!##!#YES#!#halfvec#!#-1#!##!##!##!##!##!##!##!##!##!##!##!##!##!# +vector_db#!#dbo#!#t#!#b#!#2#!##!#YES#!#varchar#!#-1#!#-1#!##!##!##!##!##!##!##!##!##!#bbf_unicode_cp1_ci_as#!##!##!# +~~END~~ + +select count(*) from sys.columns where object_id = sys.object_id('t') +go +~~START~~ +int +2 +~~END~~ + +drop table t; +go + +-- Testing with different typmod +CREATE TABLE document_embeddings ( + id int PRIMARY KEY, + embedding halfvec(4) NOT NULL +); +go +CREATE INDEX document_embeddings_embedding_idx ON document_embeddings USING hnsw (embedding vector_l2_ops); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: operator class "vector_l2_ops" does not accept data type halfvec)~~ + +INSERT INTO document_embeddings(id, embedding) VALUES(1, CAST('[21,-2,0,2.5]' as halfvec)); +INSERT INTO document_embeddings(id, embedding) VALUES(2, CAST('[5, 10000, -9.75, 8]' as halfvec)); +INSERT INTO document_embeddings(id, embedding) VALUES(3, CAST('[-0.02,23,3.14,00]' as halfvec)); +WITH cte AS ( + SELECT CAST(2e2 AS real) a, 80 b, CAST('-65519' AS real) c, -1 d +) +INSERT INTO document_embeddings(id, embedding) SELECT 4, CAST(CONCAT('[',a, ',', b, ',', c, ',', d, ']') as halfvec) FROM cte; +go +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +SELECT * FROM document_embeddings; +go +~~START~~ +int#!#varchar +1#!#[21,-2,0,2.5] +2#!#[5,10000,-9.75,8] +3#!#[-0.020004272,23,3.140625,0] +4#!#[200,80,-65504,-1] +~~END~~ + +SELECT TOP 5 * FROM document_embeddings ORDER BY embedding <=> '[3,1,2,4]'; +go +~~START~~ +int#!#varchar +1#!#[21,-2,0,2.5] +3#!#[-0.020004272,23,3.140625,0] +2#!#[5,10000,-9.75,8] +4#!#[200,80,-65504,-1] +~~END~~ + +-- extending PG syntax to have generic vector expression support +SELECT count(embedding <-> '[3,1,2,0]') FROM document_embeddings; +SELECT count(embedding <=> '[3,1,2,0]') FROM document_embeddings; +SELECT count(embedding <#> '[3,1,2,0]') FROM document_embeddings; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +int +4 +~~END~~ + +~~START~~ +int +4 +~~END~~ + + +-- WHERE clause expressions +SELECT * FROM document_embeddings WHERE embedding <-> '[3,20, 1,-2.5]' < 5; +SELECT * FROM document_embeddings WHERE embedding <=> '[3,20, 1,-2.5]' < 5; +SELECT * FROM document_embeddings WHERE embedding <#> '[3,20, 1,-2.5]' < 5; +go +~~START~~ +int#!#varchar +~~END~~ + +~~START~~ +int#!#varchar +1#!#[21,-2,0,2.5] +2#!#[5,10000,-9.75,8] +3#!#[-0.020004272,23,3.140625,0] +4#!#[200,80,-65504,-1] +~~END~~ + +~~START~~ +int#!#varchar +1#!#[21,-2,0,2.5] +2#!#[5,10000,-9.75,8] +3#!#[-0.020004272,23,3.140625,0] +~~END~~ + + +SELECT AVG(embedding) FROM document_embeddings; +go +~~START~~ +varchar +[56.5,2526,-16376,2.375] +~~END~~ + + +SELECT id, AVG(embedding) FROM document_embeddings GROUP BY id; +go +~~START~~ +int#!#varchar +2#!#[5,10000,-9.75,8] +3#!#[-0.020004272,23,3.140625,0] +4#!#[200,80,-65504,-1] +1#!#[21,-2,0,2.5] +~~END~~ + + +Drop table document_embeddings +go + +-- psql +-- Need to terminate active session before cleaning up the login +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'vector_login' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +GO +~~START~~ +bool +t +~~END~~ + + +-- tsql +use master +go + +exec sp_execute_postgresql 'drop extension vector'; +go + +drop login vector_login +go + +drop database vector_db; +go diff --git a/test/JDBC/expected/TestProcedureWithTransactions.out b/test/JDBC/expected/TestProcedureWithTransactions.out index ecd765871ec..e1c98a5f4bc 100644 --- a/test/JDBC/expected/TestProcedureWithTransactions.out +++ b/test/JDBC/expected/TestProcedureWithTransactions.out @@ -760,7 +760,7 @@ datetime ~~END~~ ~~START~~ -text#!#text#!#int#!#int#!#int#!#int#!#int +varchar#!#varchar#!#int#!#int#!#int#!#int#!#int a #!#a #!#0#!#97#!#5#!#5#!#3 ~~END~~ @@ -804,7 +804,7 @@ datetime ~~END~~ ~~START~~ -text#!#text#!#int#!#int#!#int#!#int#!#int +varchar#!#varchar#!#int#!#int#!#int#!#int#!#int a #!#a #!#0#!#97#!#5#!#5#!#3 ~~END~~ diff --git a/test/JDBC/expected/TestSparsevecDatatype.out b/test/JDBC/expected/TestSparsevecDatatype.out new file mode 100644 index 00000000000..42b9df510d4 --- /dev/null +++ b/test/JDBC/expected/TestSparsevecDatatype.out @@ -0,0 +1,1583 @@ +-- tsql +-- should throw error since vector is only allowed in sys +exec sp_execute_postgresql 'create extension vector'; +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'vector' extension creation is restricted to 'sys' schema)~~ + + +exec sp_execute_postgresql 'create extension vector with schema sys'; +go + +create login vector_login with password='12345678' +go + +Alter server role sysadmin add member vector_login +go + +create database vector_db; +go + +use vector_db +go + +-- tsql user=vector_login password=12345678 +use vector_db; +go + +select set_config('babelfishpg_tsql.explain_costs', 'off', false); +go +~~START~~ +text +off +~~END~~ + +select set_config('babelfishpg_tsql.explain_timing', 'off', false); +go +~~START~~ +text +off +~~END~~ + +select set_config('babelfishpg_tsql.explain_summary', 'off', false); +go +~~START~~ +text +off +~~END~~ + + +SELECT CAST('{1:1.5,3:3.5}/5' as sparsevec); +go +~~START~~ +varchar +{1:1.5,3:3.5}/5 +~~END~~ + + +SELECT CAST('{1:-2,3:-4}/5' as sparsevec); +go +~~START~~ +varchar +{1:-2,3:-4}/5 +~~END~~ + + +SELECT CAST('{1:2.,3:4.}/5' as sparsevec); +go +~~START~~ +varchar +{1:2,3:4}/5 +~~END~~ + + +SELECT CAST(' { 1 : 1.5 , 3 : 3.5 } / 5 ' as sparsevec); +go +~~START~~ +varchar +{1:1.5,3:3.5}/5 +~~END~~ + + +SELECT CAST('{1:1.23456}/1' as sparsevec); +go +~~START~~ +varchar +{1:1.23456}/1 +~~END~~ + + +SELECT CAST('{1:hello,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{1:hello,2:1}/2")~~ + + +SELECT CAST('{1:NaN,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: NaN not allowed in sparsevec)~~ + + +SELECT CAST('{1:Infinity,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: infinite value not allowed in sparsevec)~~ + + +SELECT CAST('{1:-Infinity,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: infinite value not allowed in sparsevec)~~ + + +SELECT CAST('{1:1.5e38,2:-1.5e38}/2' as sparsevec); +go +~~START~~ +varchar +{1:1.5e+38,2:-1.5e+38}/2 +~~END~~ + + +SELECT CAST('{1:1.5e+38,2:-1.5e+38}/2' as sparsevec); +go +~~START~~ +varchar +{1:1.5e+38,2:-1.5e+38}/2 +~~END~~ + + +SELECT CAST('{1:1.5e-38,2:-1.5e-38}/2' as sparsevec); +go +~~START~~ +varchar +{1:1.5e-38,2:-1.5e-38}/2 +~~END~~ + + +SELECT CAST('{1:4e38,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: "4e38" is out of range for type sparsevec)~~ + + +SELECT CAST('{1:-4e38,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: "-4e38" is out of range for type sparsevec)~~ + + +SELECT CAST('{1:1e-46,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: "1e-46" is out of range for type sparsevec)~~ + + +SELECT CAST('{1:-1e-46,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: "-1e-46" is out of range for type sparsevec)~~ + + +SELECT CAST('' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "")~~ + + +SELECT CAST('{' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{")~~ + + +SELECT CAST('{ ' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{ ")~~ + + +SELECT CAST('{:' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{:")~~ + + +SELECT CAST('{,' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{,")~~ + + +SELECT CAST('{}' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{}")~~ + + +SELECT CAST('{}/'' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near ''{}/'' at line 1 and character position 12)~~ + + +SELECT CAST('{}/1' as sparsevec); +go +~~START~~ +varchar +{}/1 +~~END~~ + + +SELECT CAST('{}/1a' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{}/1a")~~ + + +SELECT CAST('{ }/1' as sparsevec); +go +~~START~~ +varchar +{}/1 +~~END~~ + + +SELECT CAST('{:}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{:}/1")~~ + + +SELECT CAST('{,}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{,}/1")~~ + + +SELECT CAST('{1,}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{1,}/1")~~ + + +SELECT CAST('{:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{:1}/1")~~ + + +SELECT CAST('{1:}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{1:}/1")~~ + + +SELECT CAST('{1a:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{1a:1}/1")~~ + + +SELECT CAST('{1:1a}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{1:1a}/1")~~ + + +SELECT CAST('{1:1,}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{1:1,}/1")~~ + + +SELECT CAST('{1:0,2:1,3:0}/3' as sparsevec); +go +~~START~~ +varchar +{2:1}/3 +~~END~~ + + +SELECT CAST('{2:1,1:1}/2' as sparsevec); +go +~~START~~ +varchar +{1:1,2:1}/2 +~~END~~ + + +SELECT CAST('{1:1,1:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec indices must not contain duplicates)~~ + + +SELECT CAST('{1:1,2:1,1:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec indices must not contain duplicates)~~ + + +SELECT CAST('{}/5' as sparsevec); +go +~~START~~ +varchar +{}/5 +~~END~~ + + +SELECT CAST('{}/-1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec must have at least 1 dimension)~~ + + +SELECT CAST('{}/1000000001' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec cannot have more than 1000000000 dimensions)~~ + + +SELECT CAST('{}/2147483648' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec cannot have more than 1000000000 dimensions)~~ + + +SELECT CAST('{}/-2147483649' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec must have at least 1 dimension)~~ + + +SELECT CAST('{}/9223372036854775808' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec cannot have more than 1000000000 dimensions)~~ + + +SELECT CAST('{}/-9223372036854775809' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec must have at least 1 dimension)~~ + + +SELECT CAST('{2147483647:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec index out of bounds)~~ + + +SELECT CAST('{2147483648:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec index out of bounds)~~ + + +SELECT CAST('{-2147483648:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec index out of bounds)~~ + + +SELECT CAST('{-2147483649:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec index out of bounds)~~ + + +SELECT CAST('{0:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec index out of bounds)~~ + + +SELECT CAST('{2:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec index out of bounds)~~ + + +SELECT CAST('{}/3' as sparsevec(3)); +go +~~START~~ +varchar +{}/3 +~~END~~ + + +SELECT CAST('{}/3' as sparsevec(2)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: expected 2 dimensions, not 3)~~ + + +SELECT CAST('{}/3' as sparsevec(3, 2)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid type modifier)~~ + + +SELECT CAST('{}/3' as sparsevec('a')); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '(' at line 1 and character position 31)~~ + + +SELECT CAST('{}/3' as sparsevec(0)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: dimensions for type sparsevec must be at least 1)~~ + + +SELECT CAST('{}/3' as sparsevec(1000000001)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: dimensions for type sparsevec cannot exceed 1000000000)~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) < CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +0 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) < CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +0 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) <= CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +1 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) <= CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +0 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) = CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +1 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) = CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +0 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) != CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +0 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) != CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +1 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) >= CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +1 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) >= CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +1 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) > CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +0 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) > CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +1 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{1:1,2:2,3:3}/3' as sparsevec), CAST('{1:1,2:2,3:3}/3' as sparsevec)); +go +~~START~~ +int +0 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{1:1,2:2,3:3}/3' as sparsevec), CAST('{}/3' as sparsevec)); +go +~~START~~ +int +1 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{}/3' as sparsevec), CAST('{1:1,2:2,3:3}/3' as sparsevec)); +go +~~START~~ +int +-1 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:1,2:2,3:3}/3' as sparsevec)); +go +~~START~~ +int +-1 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{1:1,2:2,3:3}/3' as sparsevec), CAST('{1:1,2:2}/2' as sparsevec)); +go +~~START~~ +int +1 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:2,2:3,3:4}/3' as sparsevec)); +go +~~START~~ +int +-1 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{1:2,2:3}/2' as sparsevec), CAST('{1:1,2:2,3:3}/3' as sparsevec)); +go +~~START~~ +int +1 +~~END~~ + + +SELECT ROUND(l2_norm(CAST('{1:1,2:1}/2' as sparsevec)), 5); +go +~~START~~ +numeric +1.41421 +~~END~~ + + +SELECT l2_norm(CAST('{1:3,2:4}/2' as sparsevec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_norm(CAST('{2:1}/2' as sparsevec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT l2_norm(CAST('{1:3e37,2:4e37}/2' as sparsevec)); +go +~~START~~ +float +5.000000042966943E37 +~~END~~ + + +SELECT l2_norm(CAST('{}/2' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT l2_norm(CAST('{1:2}/1' as sparsevec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT l2_distance(CAST('{}/2' as sparsevec), CAST('{1:3,2:4}/2' as sparsevec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_distance(CAST('{1:3}/2' as sparsevec), CAST('{2:4}/2' as sparsevec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_distance(CAST('{2:4}/2' as sparsevec), CAST('{1:3}/2' as sparsevec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_distance(CAST('{1:3,2:4}/2' as sparsevec), CAST('{}/2' as sparsevec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_distance(CAST('{}/2' as sparsevec), CAST('{2:1}/2' as sparsevec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT CAST('{}/2' as sparsevec) <-> CAST('{1:3,2:4}/2' as sparsevec); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT inner_product(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:2,2:4}/2' as sparsevec)); +go +~~START~~ +float +10.0 +~~END~~ + + +SELECT inner_product(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:3}/1' as sparsevec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different sparsevec dimensions 2 and 1)~~ + + +SELECT inner_product(CAST('{1:1,3:3}/4' as sparsevec), CAST('{2:2,4:4}/4' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT inner_product(CAST('{2:2,4:4}/4' as sparsevec), CAST('{1:1,3:3}/4' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT inner_product(CAST('{1:1,3:3,5:5}/5' as sparsevec), CAST('{2:4,3:6,4:8}/5' as sparsevec)); +go +~~START~~ +float +18.0 +~~END~~ + + +SELECT inner_product(CAST('{1:1}/2' as sparsevec), CAST('{}/2' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT inner_product(CAST('{}/2' as sparsevec), CAST('{1:1}/2' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT inner_product(CAST('{1:3e38}/1' as sparsevec), CAST('{1:3e38}/1' as sparsevec)); +go +~~START~~ +float +Infinity +~~END~~ + + +SELECT inner_product(CAST('{1:1,3:3,5:5}/5' as sparsevec), CAST('{2:4,3:6,4:8}/5' as sparsevec)); +go +~~START~~ +float +18.0 +~~END~~ + + +SELECT CAST('{1:1,2:2}/2' as sparsevec) <#> CAST('{1:3,2:4}/2' as sparsevec); +go +~~START~~ +float +-11.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:2,2:4}/2' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:1,2:2}/2' as sparsevec), CAST('{}/2' as sparsevec)); +go +~~START~~ +float +NaN +~~END~~ + + +SELECT cosine_distance(CAST('{1:1,2:1}/2' as sparsevec), CAST('{1:1,2:1}/2' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:1}/2' as sparsevec), CAST('{2:2}/2' as sparsevec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:1,2:1}/2' as sparsevec), CAST('{1:-1,2:-1}/2' as sparsevec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:2}/2' as sparsevec), CAST('{2:2}/2' as sparsevec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT cosine_distance(CAST('{2:2}/2' as sparsevec), CAST('{1:2}/2' as sparsevec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:3}/1' as sparsevec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different sparsevec dimensions 2 and 1)~~ + + +SELECT cosine_distance(CAST('{1:1,2:1}/2' as sparsevec), CAST('{1:1.1,2:1.1}/2' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:1,2:1}/2' as sparsevec), CAST('{1:-1.1,2:-1.1}/2' as sparsevec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:3e38}/1' as sparsevec), CAST('{1:3e38}/1' as sparsevec)); +go +~~START~~ +float +NaN +~~END~~ + + +SELECT cosine_distance(CAST('{}/1' as sparsevec), CAST('{}/1' as sparsevec)); +go +~~START~~ +float +NaN +~~END~~ + + +SELECT CAST('{1:1,2:2}/2' as sparsevec) <=> CAST('{1:2,2:4}/2' as sparsevec); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT l1_distance(CAST('{}/2' as sparsevec), CAST('{1:3,2:4}/2' as sparsevec)); +go +~~START~~ +float +7.0 +~~END~~ + + +SELECT l1_distance(CAST('{}/2' as sparsevec), CAST('{2:1}/2' as sparsevec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT l1_distance(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:3}/1' as sparsevec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different sparsevec dimensions 2 and 1)~~ + + +SELECT l1_distance(CAST('{1:3e38}/1' as sparsevec), CAST('{1:-3e38}/1' as sparsevec)); +go +~~START~~ +float +Infinity +~~END~~ + + +SELECT l1_distance(CAST('{1:1,3:3,5:5,7:7}/8' as sparsevec), CAST('{2:2,4:4,6:6,8:8}/8' as sparsevec)); +go +~~START~~ +float +36.0 +~~END~~ + + +SELECT l1_distance(CAST('{1:1,3:3,5:5,7:7,9:9}/9' as sparsevec), CAST('{2:2,4:4,6:6,8:8}/9' as sparsevec)); +go +~~START~~ +float +45.0 +~~END~~ + + +SELECT CAST('{}/2' as sparsevec) <+> CAST('{1:3,2:4}/2' as sparsevec); +go +~~START~~ +float +7.0 +~~END~~ + + +SELECT l2_normalize(CAST('{1:3,2:4}/2' as sparsevec)); +go +~~START~~ +varchar +{1:0.6,2:0.8}/2 +~~END~~ + + +SELECT l2_normalize(CAST('{1:3}/2' as sparsevec)); +go +~~START~~ +varchar +{1:1}/2 +~~END~~ + + +SELECT l2_normalize(CAST('{2:0.1}/2' as sparsevec)); +go +~~START~~ +varchar +{2:1}/2 +~~END~~ + + +SELECT l2_normalize(CAST('{}/2' as sparsevec)); +go +~~START~~ +varchar +{}/2 +~~END~~ + + +SELECT l2_normalize(CAST('{1:3e38}/1' as sparsevec)); +go +~~START~~ +varchar +{1:1}/1 +~~END~~ + + +SELECT l2_normalize(CAST('{1:3e38,2:1e-37}/2' as sparsevec)); +go +~~START~~ +varchar +{1:1}/2 +~~END~~ + + +SELECT l2_normalize(CAST('{2:3e37,4:3e-37,6:4e37,8:4e-37}/9' as sparsevec)); +go +~~START~~ +varchar +{2:0.6,6:0.8}/9 +~~END~~ + + + +-- L2 +CREATE TABLE sparsevec_table (val sparsevec(3)); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{}/3' AS sparsevec)), (CAST('{1:1,2:2,3:3}/3' AS sparsevec)), (CAST('{1:1,2:1,3:1}/3' AS sparsevec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON sparsevec_table USING hnsw (val sparsevec_l2_ops); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{1:1,2:2,3:4}/3' AS sparsevec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM sparsevec_table ORDER BY val <-> CAST('{1:3,2:3,3:3}/3' AS sparsevec); +go +~~START~~ +varchar +{1:1,2:2,3:3}/3 +{1:1,2:2,3:4}/3 +{1:1,2:1,3:1}/3 +{}/3 +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM sparsevec_table ORDER BY val <-> CAST('{1:3,2:3,3:3}/3' AS sparsevec) NULLS LAST +Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=4 loops=1) + Order By: (val <-> '{1:3,2:3,3:3}/3'::sparsevec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <-> (SELECT CAST(NULL as sparsevec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <-> (SELECT CAST(NULL as sparsevec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=4 loops=1) + Order By: (val <-> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SELECT COUNT(*) FROM sparsevec_table; +go +~~START~~ +int +5 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM sparsevec_table +Aggregate (actual rows=1 loops=1) + -> Seq Scan on sparsevec_table (actual rows=5 loops=1) +~~END~~ + + +TRUNCATE TABLE sparsevec_table; +go + +SELECT * FROM sparsevec_table ORDER BY val <-> CAST('{1:3,2:3,3:3}/3' AS sparsevec); +go +~~START~~ +varchar +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM sparsevec_table ORDER BY val <-> CAST('{1:3,2:3,3:3}/3' AS sparsevec) NULLS LAST +Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=0 loops=1) + Order By: (val <-> '{1:3,2:3,3:3}/3'::sparsevec) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE sparsevec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- inner product +CREATE TABLE sparsevec_table (val sparsevec(3)); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{}/3' AS sparsevec)), (CAST('{1:1,2:2,3:3}/3' AS sparsevec)), (CAST('{1:1,2:1,3:1}/3' AS sparsevec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON sparsevec_table USING hnsw (val sparsevec_ip_ops); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{1:1,2:2,3:4}/3' AS sparsevec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM sparsevec_table ORDER BY val <#> CAST('{1:3,2:3,3:3}/3' AS sparsevec); +go +~~START~~ +varchar +{1:1,2:2,3:4}/3 +{1:1,2:2,3:3}/3 +{1:1,2:1,3:1}/3 +{}/3 +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM sparsevec_table ORDER BY val <#> CAST('{1:3,2:3,3:3}/3' AS sparsevec) NULLS LAST +Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=4 loops=1) + Order By: (val <#> '{1:3,2:3,3:3}/3'::sparsevec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <#> (SELECT CAST(NULL as sparsevec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <#> (SELECT CAST(NULL as sparsevec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=4 loops=1) + Order By: (val <#> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE sparsevec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- cosine +CREATE TABLE sparsevec_table (val sparsevec(3)); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{}/3' AS sparsevec)), (CAST('{1:1,2:2,3:3}/3' AS sparsevec)), (CAST('{1:1,2:1,3:1}/3' AS sparsevec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON sparsevec_table USING hnsw (val sparsevec_cosine_ops); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{1:1,2:2,3:4}/3' AS sparsevec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM sparsevec_table ORDER BY val <=> CAST('{1:3,2:3,3:3}/3' AS sparsevec); +go +~~START~~ +varchar +{1:1,2:1,3:1}/3 +{1:1,2:2,3:3}/3 +{1:1,2:2,3:4}/3 +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM sparsevec_table ORDER BY val <=> CAST('{1:3,2:3,3:3}/3' AS sparsevec) NULLS LAST +Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=3 loops=1) + Order By: (val <=> '{1:3,2:3,3:3}/3'::sparsevec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <=> CAST('{}/3' AS sparsevec)) t2; +go +~~START~~ +int +3 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <=> CAST('{}/3' AS sparsevec) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=3 loops=1) + Order By: (val <=> '{}/3'::sparsevec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <=> (SELECT CAST(NULL as sparsevec))) t2; +go +~~START~~ +int +3 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <=> (SELECT CAST(NULL as sparsevec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=3 loops=1) + Order By: (val <=> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE sparsevec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- L1 +CREATE TABLE sparsevec_table (val sparsevec(3)); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{}/3' AS sparsevec)), (CAST('{1:1,2:2,3:3}/3' AS sparsevec)), (CAST('{1:1,2:1,3:1}/3' AS sparsevec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON sparsevec_table USING hnsw (val sparsevec_l1_ops); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{1:1,2:2,3:4}/3' AS sparsevec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM sparsevec_table ORDER BY val <+> CAST('{1:3,2:3,3:3}/3' AS sparsevec); +go +~~START~~ +varchar +{1:1,2:2,3:3}/3 +{1:1,2:2,3:4}/3 +{1:1,2:1,3:1}/3 +{}/3 +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM sparsevec_table ORDER BY val <+> CAST('{1:3,2:3,3:3}/3' AS sparsevec) NULLS LAST +Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=4 loops=1) + Order By: (val <+> '{1:3,2:3,3:3}/3'::sparsevec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <+> (SELECT CAST(NULL as sparsevec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <+> (SELECT CAST(NULL as sparsevec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=4 loops=1) + Order By: (val <+> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE sparsevec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- non-zero elements +CREATE TABLE sparsevec_table (val sparsevec(1001)); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST(array_fill(1, ARRAY[1001]) AS sparsevec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '(' at line 1 and character position 46)~~ + + +CREATE INDEX idx ON sparsevec_table USING hnsw (val sparsevec_l2_ops); +go + +TRUNCATE TABLE sparsevec_table; +go + +DROP TABLE sparsevec_table; +go + +select set_config('babelfishpg_tsql.explain_costs', 'on', false); +go +~~START~~ +text +on +~~END~~ + +select set_config('babelfishpg_tsql.explain_timing', 'on', false); +go +~~START~~ +text +on +~~END~~ + +select set_config('babelfishpg_tsql.explain_summary', 'on', false); +go +~~START~~ +text +on +~~END~~ + + +-- system metadata, all objects get their datatype info from one of: +-- typecodes or datatype_info data we have created. Testing sys.types for typecodes +-- and sp_sproc_columns_100 for datatype_info is enough +select count(*) from sys.types where name = 'sparsevec'; +go +~~START~~ +int +1 +~~END~~ + + +create procedure sparsevec_proc_1 @a sparsevec, @b varchar(max) as select @a as a, @b as b; +go + +exec sp_sproc_columns_100 @procedure_name= 'sparsevec_proc_1' +go +~~START~~ +varchar#!#varchar#!#nvarchar#!#varchar#!#smallint#!#smallint#!#varchar#!#int#!#int#!#smallint#!#smallint#!#smallint#!#varchar#!#nvarchar#!#smallint#!#smallint#!#int#!#int#!#varchar#!#tinyint +vector_db#!#dbo#!#sparsevec_proc_1;1#!#@RETURN_VALUE#!#5#!#4#!#int#!#10#!#4#!#0#!#10#!#0#!##!##!#4#!##!##!#0#!#NO#!#56 +vector_db#!#dbo#!#sparsevec_proc_1;1#!#@a#!#1#!##!#sparsevec#!#0#!#-1#!#0#!##!##!##!##!##!##!##!#1#!#NO#!# +vector_db#!#dbo#!#sparsevec_proc_1;1#!#@b#!#1#!#12#!#varchar#!#0#!#8000#!#0#!##!#1#!##!##!#12#!##!##!#2#!#YES#!#39 +~~END~~ + + +drop procedure sparsevec_proc_1; +go + +create table t(a sparsevec(3), b varchar(max)) +go +select * from information_schema.columns where table_name = 't' +go +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#int#!#nvarchar#!#varchar#!#nvarchar#!#int#!#int#!#tinyint#!#smallint#!#int#!#smallint#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +vector_db#!#dbo#!#t#!#a#!#1#!##!#YES#!#sparsevec#!#-1#!##!##!##!##!##!##!##!##!##!##!##!##!##!# +vector_db#!#dbo#!#t#!#b#!#2#!##!#YES#!#varchar#!#-1#!#-1#!##!##!##!##!##!##!##!##!##!#bbf_unicode_cp1_ci_as#!##!##!# +~~END~~ + +select count(*) from sys.columns where object_id = sys.object_id('t') +go +~~START~~ +int +2 +~~END~~ + +drop table t; +go + +-- Testing with different typmod +CREATE TABLE document_embeddings ( + id int PRIMARY KEY, + embedding sparsevec(5) NOT NULL +); +go +CREATE INDEX document_embeddings_embedding_idx ON document_embeddings USING hnsw (embedding vector_l2_ops); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: operator class "vector_l2_ops" does not accept data type sparsevec)~~ + +INSERT INTO document_embeddings(id, embedding) VALUES(1, CAST('{1:5,2:1}/5' as sparsevec)); +INSERT INTO document_embeddings(id, embedding) VALUES(2, CAST('{1:5, 2:10000, 3:-9.75, 4:8}/5' as sparsevec)); +INSERT INTO document_embeddings(id, embedding) VALUES(3, CAST('{1:-0.02,2:23,4:3.14,5:00}/5' as sparsevec)); +WITH cte AS ( + SELECT CAST(2e2 AS real) a, 80 b, CAST('-305' AS real) c, -1 d +) +INSERT INTO document_embeddings(id, embedding) SELECT 4, CAST(CONCAT('{1:',a, ',3:', b, ',4:', c, ',5:', d, '}/5') as sparsevec) FROM cte; +go +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +SELECT * FROM document_embeddings; +go +~~START~~ +int#!#varchar +1#!#{1:5,2:1}/5 +2#!#{1:5,2:10000,3:-9.75,4:8}/5 +3#!#{1:-0.02,2:23,4:3.14}/5 +4#!#{1:200,3:80,4:-305,5:-1}/5 +~~END~~ + +SELECT TOP 5 * FROM document_embeddings ORDER BY embedding <=> '{1:1,2:2,3:4}/5'; +go +~~START~~ +int#!#varchar +2#!#{1:5,2:10000,3:-9.75,4:8}/5 +3#!#{1:-0.02,2:23,4:3.14}/5 +4#!#{1:200,3:80,4:-305,5:-1}/5 +1#!#{1:5,2:1}/5 +~~END~~ + +-- extending PG syntax to have generic vector expression support +SELECT count(embedding <-> '{1:1,2:2,3:4}/5') FROM document_embeddings; +SELECT count(embedding <=> '{1:1,2:2,3:4}/5') FROM document_embeddings; +SELECT count(embedding <#> '{1:1,2:2,3:4}/5') FROM document_embeddings; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +int +4 +~~END~~ + +~~START~~ +int +4 +~~END~~ + + +-- WHERE clause expressions +SELECT * FROM document_embeddings WHERE embedding <-> '{1:1,2:2,4:4}/5' < 5; +SELECT * FROM document_embeddings WHERE embedding <=> '{1:1,2:2,4:4}/5' < 5; +SELECT * FROM document_embeddings WHERE embedding <#> '{1:1,2:2,4:4}/5' < 5; +go +~~START~~ +int#!#varchar +~~END~~ + +~~START~~ +int#!#varchar +1#!#{1:5,2:1}/5 +2#!#{1:5,2:10000,3:-9.75,4:8}/5 +3#!#{1:-0.02,2:23,4:3.14}/5 +4#!#{1:200,3:80,4:-305,5:-1}/5 +~~END~~ + +~~START~~ +int#!#varchar +1#!#{1:5,2:1}/5 +2#!#{1:5,2:10000,3:-9.75,4:8}/5 +3#!#{1:-0.02,2:23,4:3.14}/5 +~~END~~ + + +SELECT AVG(embedding) FROM document_embeddings; +go +~~ERROR (Code: 206)~~ + +~~ERROR (Message: The function avg is found but cannot be used. Possibly due to datatype mismatch and implicit casting is not allowed.)~~ + + +SELECT id, AVG(embedding) FROM document_embeddings GROUP BY id; +go +~~ERROR (Code: 206)~~ + +~~ERROR (Message: The function avg is found but cannot be used. Possibly due to datatype mismatch and implicit casting is not allowed.)~~ + + +Drop table document_embeddings +go + +-- psql +-- Need to terminate active session before cleaning up the login +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'vector_login' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +GO +~~START~~ +bool +t +~~END~~ + + +-- tsql +use master +go + +exec sp_execute_postgresql 'drop extension vector'; +go + +drop login vector_login +go + +drop database vector_db; +go diff --git a/test/JDBC/expected/TestSpatialPoint-vu-verify.out b/test/JDBC/expected/TestSpatialPoint-vu-verify.out index 5bbfc7274ba..7b6341fd074 100644 --- a/test/JDBC/expected/TestSpatialPoint-vu-verify.out +++ b/test/JDBC/expected/TestSpatialPoint-vu-verify.out @@ -85,7 +85,7 @@ float DECLARE @point geometry; -SET @point = geometry::POINT(22.34900, -47.65100, 4326); +SET @point = geometry::Point(22.34900, -47.65100, 4326); SELECT STX(@point); SELECT STY(@point); SELECT @point.STX; @@ -172,7 +172,7 @@ POINT(-122.349 47.651)#!#01010000007593180456965EC017D9CEF753D34740#!#0.0 DECLARE @point1 geometry, @point2 geometry, @point3 geometry; SET @point1 = geometry::STPointFromText(null, 4326); SET @point2 = geometry::STGeomFromText(null, 4326); -SET @point3 = geometry::POINT(22.34900, -47.65100, 4326); +SET @point3 = geometry::Point(22.34900, -47.65100, 4326); SELECT @point1.STX; SELECT @point1.STY; SELECT @point1.STAsText(); @@ -219,7 +219,7 @@ float -- Negative test for Geospatial functions DECLARE @point1 geometry, @point2 varchar(50), @point3 int; -SET @point1 = geometry::POINT(22.34900, -47.65100, 4326);; +SET @point1 = geometry::Point(22.34900, -47.65100, 4326);; SET @point2 = 'Test_String'; SELECT @point1.STDistance(@point2); Go @@ -1874,7 +1874,7 @@ POINT(-122.349 47.651) DECLARE @point geography; -SET @point = geography::POINT(22.34900, -47.65100, 4326); +SET @point = geography::Point(22.34900, -47.65100, 4326); SELECT STAsText(@point); SELECT @point.STAsText(); Go @@ -1918,7 +1918,7 @@ float DECLARE @point geography; -SET @point = geography::POINT(22.34900, -47.65100, 4326); +SET @point = geography::Point(22.34900, -47.65100, 4326); SELECT Long(@point); SELECT Lat(@point); SELECT @point.Long; @@ -2263,7 +2263,7 @@ POINT(-22.349 47.651) DECLARE @point1 geography, @point2 geography, @point3 geography; SET @point1 = geography::STPointFromText(null, 4326); SET @point2 = geography::STGeomFromText(null, 4326); -SET @point3 = geography::POINT(22.34900, -47.65100, 4326); +SET @point3 = geography::Point(22.34900, -47.65100, 4326); SELECT @point1.Long; SELECT @point1.Lat; SELECT @point1.STAsText(); @@ -2310,7 +2310,7 @@ float -- Negative test for Geospatial functions DECLARE @point1 geography, @point2 varchar(50), @point3 int; -SET @point1 = geography::POINT(22.34900, -47.65100, 4326); +SET @point1 = geography::Point(22.34900, -47.65100, 4326); SET @point2 = 'Test_String'; SELECT @point2.STDistance(@point1); Go diff --git a/test/JDBC/expected/TestVectorDatatype.out b/test/JDBC/expected/TestVectorDatatype.out index 0839d65c4d7..24f62cc3125 100644 --- a/test/JDBC/expected/TestVectorDatatype.out +++ b/test/JDBC/expected/TestVectorDatatype.out @@ -101,7 +101,7 @@ go ~~ERROR (Message: value out of range: underflow)~~ -SELECT vector_dims('[1,2,3]'); +SELECT vector_dims(CAST('[1,2,3]' as vector)); go ~~START~~ int @@ -140,7 +140,7 @@ go ~~ERROR (Message: syntax error near 'Cast' at line 1 and character position 19)~~ -SELECT l2_distance('[0,0]', '[3,4]'); +SELECT l2_distance(CAST('[0,0]' as vector), CAST('[3,4]' as vector)); go ~~START~~ float @@ -148,7 +148,7 @@ float ~~END~~ -SELECT l2_distance('[0,0]', '[0,1]'); +SELECT l2_distance(CAST('[0,0]' as vector), CAST('[0,1]' as vector)); go ~~START~~ float @@ -156,14 +156,14 @@ float ~~END~~ -SELECT l2_distance('[1,2]', '[3]'); +SELECT l2_distance(CAST('[1,2]' as vector), CAST('[3]' as vector)); go ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: different vector dimensions 2 and 1)~~ -SELECT l2_distance('[3e38]', '[-3e38]'); +SELECT l2_distance(CAST('[3e38]' as vector), CAST('[-3e38]' as vector)); go ~~START~~ float @@ -171,7 +171,7 @@ Infinity ~~END~~ -SELECT inner_product('[1,2]', '[3,4]'); +SELECT inner_product(CAST('[1,2]' as vector), CAST('[3,4]' as vector)); go ~~START~~ float @@ -179,14 +179,14 @@ float ~~END~~ -SELECT inner_product('[1,2]', '[3]'); +SELECT inner_product(CAST('[1,2]' as vector), CAST('[3]' as vector)); go ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: different vector dimensions 2 and 1)~~ -SELECT inner_product('[3e38]', '[3e38]'); +SELECT inner_product(CAST('[3e38]' as vector), CAST('[3e38]' as vector)); go ~~START~~ float @@ -194,7 +194,7 @@ Infinity ~~END~~ -SELECT cosine_distance('[1,2]', '[2,4]'); +SELECT cosine_distance(CAST('[1,2]' as vector), CAST('[2,4]' as vector)); go ~~START~~ float @@ -202,7 +202,7 @@ float ~~END~~ -SELECT cosine_distance('[1,2]', '[0,0]'); +SELECT cosine_distance(CAST('[1,2]' as vector), CAST('[0,0]' as vector)); go ~~START~~ float @@ -210,7 +210,7 @@ NaN ~~END~~ -SELECT cosine_distance('[1,1]', '[1,1]'); +SELECT cosine_distance(CAST('[1,1]' as vector), CAST('[1,1]' as vector)); go ~~START~~ float @@ -218,7 +218,7 @@ float ~~END~~ -SELECT cosine_distance('[1,0]', '[0,2]'); +SELECT cosine_distance(CAST('[1,0]' as vector), CAST('[0,2]' as vector)); go ~~START~~ float @@ -226,7 +226,7 @@ float ~~END~~ -SELECT cosine_distance('[1,1]', '[-1,-1]'); +SELECT cosine_distance(CAST('[1,1]' as vector), CAST('[-1,-1]' as vector)); go ~~START~~ float @@ -234,14 +234,14 @@ float ~~END~~ -SELECT cosine_distance('[1,2]', '[3]'); +SELECT cosine_distance(CAST('[1,2]' as vector), CAST('[3]' as vector)); go ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: different vector dimensions 2 and 1)~~ -SELECT cosine_distance('[1,1]', '[1.1,1.1]'); +SELECT cosine_distance(CAST('[1,1]' as vector), CAST('[1.1,1.1]' as vector)); go ~~START~~ float @@ -249,7 +249,7 @@ float ~~END~~ -SELECT cosine_distance('[1,1]', '[-1.1,-1.1]'); +SELECT cosine_distance(CAST('[1,1]' as vector), CAST('[-1.1,-1.1]' as vector)); go ~~START~~ float @@ -257,7 +257,7 @@ float ~~END~~ -SELECT cosine_distance('[3e38]', '[3e38]'); +SELECT cosine_distance(CAST('[3e38]' as vector), CAST('[3e38]' as vector)); go ~~START~~ float @@ -265,7 +265,7 @@ NaN ~~END~~ -SELECT l1_distance('[0,0]', '[3,4]'); +SELECT l1_distance(CAST('[0,0]' as vector), CAST('[3,4]' as vector)); go ~~START~~ float @@ -273,7 +273,7 @@ float ~~END~~ -SELECT l1_distance('[0,0]', '[0,1]'); +SELECT l1_distance(CAST('[0,0]' as vector), CAST('[0,1]' as vector)); go ~~START~~ float @@ -281,14 +281,14 @@ float ~~END~~ -SELECT l1_distance('[1,2]', '[3]'); +SELECT l1_distance(CAST('[1,2]' as vector), CAST('[3]' as vector)); go ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: different vector dimensions 2 and 1)~~ -SELECT l1_distance('[3e38]', '[-3e38]'); +SELECT l1_distance(CAST('[3e38]' as vector), CAST('[-3e38]' as vector)); go ~~START~~ float @@ -1160,49 +1160,49 @@ SELECT CAST('[4e38,1]' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: infinite value not allowed in vector)~~ +~~ERROR (Message: "4e38" is out of range for type vector)~~ SELECT CAST('[1,2,3' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "[1,2,3")~~ +~~ERROR (Message: invalid input syntax for type vector: "[1,2,3")~~ SELECT CAST('[1,2,3]9' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "[1,2,3]9")~~ +~~ERROR (Message: invalid input syntax for type vector: "[1,2,3]9")~~ SELECT CAST('1,2,3' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "1,2,3")~~ +~~ERROR (Message: invalid input syntax for type vector: "1,2,3")~~ SELECT CAST('' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "")~~ +~~ERROR (Message: invalid input syntax for type vector: "")~~ SELECT CAST('[' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "[")~~ +~~ERROR (Message: invalid input syntax for type vector: "[")~~ SELECT CAST('[,' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "[,")~~ +~~ERROR (Message: invalid input syntax for type vector: "[,")~~ SELECT CAST('[]' as vector); @@ -1230,7 +1230,7 @@ SELECT CAST('[1,,3]' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "[1,,3]")~~ +~~ERROR (Message: invalid input syntax for type vector: "[1,,3]")~~ SELECT CAST('[1, ,3]' as vector); diff --git a/test/JDBC/expected/Test_rename_db_single-db.out b/test/JDBC/expected/Test_rename_db_single-db.out index a17b66ff8a5..da14b309aad 100644 --- a/test/JDBC/expected/Test_rename_db_single-db.out +++ b/test/JDBC/expected/Test_rename_db_single-db.out @@ -13,10 +13,10 @@ Create login rename_db_login1 with password = '1234', default_database = rename_ go -- sanity checks for metadata stored in babelfish catalog -select owner, name from sys.babelfish_sysdatabases where name LIKE 'rename_db_database%'; -select nspname, orig_name from sys.babelfish_namespace_ext where nspname IN ('dbo', 'guest', 'rename_db_schema1'); -select rolname, login_name, orig_username, database_name from sys.babelfish_authid_user_ext where database_name LIKE 'rename_db_database%'; -select rolname, default_database_name from sys.babelfish_authid_login_ext where default_database_name LIKE 'rename_db_database%'; +select owner, name from sys.babelfish_sysdatabases where name LIKE 'rename_db_database%' ORDER BY name; +select nspname, orig_name from sys.babelfish_namespace_ext where nspname IN ('dbo', 'guest', 'rename_db_schema1') ORDER BY nspname; +select rolname, login_name, orig_username, database_name from sys.babelfish_authid_user_ext where database_name LIKE 'rename_db_database%' ORDER BY rolname; +select rolname, default_database_name from sys.babelfish_authid_login_ext where default_database_name LIKE 'rename_db_database%' ORDER BY rolname; go ~~START~~ varchar#!#text @@ -32,8 +32,8 @@ rename_db_schema1#!#rename_db_schema1 ~~START~~ varchar#!#varchar#!#nvarchar#!#nvarchar -dbo#!##!#dbo#!#rename_db_database1 db_owner#!##!#db_owner#!#rename_db_database1 +dbo#!##!#dbo#!#rename_db_database1 rename_db_database1_guest#!##!#guest#!#rename_db_database1 rename_db_database1_rename_db_role1#!##!#rename_db_role1#!#rename_db_database1 ~~END~~ @@ -61,10 +61,10 @@ use master; go -- should return updated rows -select owner, name from sys.babelfish_sysdatabases where name LIKE 'rename_db_database%'; -select nspname, orig_name from sys.babelfish_namespace_ext where nspname IN ('dbo', 'guest', 'rename_db_schema1'); -select rolname, login_name, orig_username, database_name from sys.babelfish_authid_user_ext where database_name LIKE 'rename_db_database%'; -select rolname, default_database_name from sys.babelfish_authid_login_ext where default_database_name LIKE 'rename_db_database%'; +select owner, name from sys.babelfish_sysdatabases where name LIKE 'rename_db_database%' ORDER BY name; +select nspname, orig_name from sys.babelfish_namespace_ext where nspname IN ('dbo', 'guest', 'rename_db_schema1') ORDER BY nspname; +select rolname, login_name, orig_username, database_name from sys.babelfish_authid_user_ext where database_name LIKE 'rename_db_database%' ORDER BY rolname; +select rolname, default_database_name from sys.babelfish_authid_login_ext where default_database_name LIKE 'rename_db_database%' ORDER BY rolname; go ~~START~~ varchar#!#text @@ -80,8 +80,8 @@ rename_db_schema1#!#rename_db_schema1 ~~START~~ varchar#!#varchar#!#nvarchar#!#nvarchar -dbo#!##!#dbo#!#rename_db_database2 db_owner#!##!#db_owner#!#rename_db_database2 +dbo#!##!#dbo#!#rename_db_database2 rename_db_database2_guest#!##!#guest#!#rename_db_database2 rename_db_database2_rename_db_role1#!##!#rename_db_role1#!#rename_db_database2 ~~END~~ @@ -109,10 +109,10 @@ use master; go -- should return updated rows -select owner, name from sys.babelfish_sysdatabases where name LIKE 'rename_db_database%'; -select nspname, orig_name from sys.babelfish_namespace_ext where nspname IN ('dbo', 'guest', 'rename_db_schema1'); -select rolname, login_name, orig_username, database_name from sys.babelfish_authid_user_ext where database_name LIKE 'rename_db_database%'; -select rolname, default_database_name from sys.babelfish_authid_login_ext where default_database_name LIKE 'rename_db_database%'; +select owner, name from sys.babelfish_sysdatabases where name LIKE 'rename_db_database%' ORDER BY name; +select nspname, orig_name from sys.babelfish_namespace_ext where nspname IN ('dbo', 'guest', 'rename_db_schema1') ORDER BY nspname; +select rolname, login_name, orig_username, database_name from sys.babelfish_authid_user_ext where database_name LIKE 'rename_db_database%' ORDER BY rolname; +select rolname, default_database_name from sys.babelfish_authid_login_ext where default_database_name LIKE 'rename_db_database%' ORDER BY rolname; go ~~START~~ varchar#!#text @@ -128,8 +128,8 @@ rename_db_schema1#!#rename_db_schema1 ~~START~~ varchar#!#varchar#!#nvarchar#!#nvarchar -dbo#!##!#dbo#!#rename_db_database1 db_owner#!##!#db_owner#!#rename_db_database1 +dbo#!##!#dbo#!#rename_db_database1 rename_db_database1_guest#!##!#guest#!#rename_db_database1 rename_db_database1_rename_db_role1#!##!#rename_db_role1#!#rename_db_database1 ~~END~~ @@ -157,10 +157,10 @@ use master; go -- should return updated rows -select owner, name from sys.babelfish_sysdatabases where name LIKE 'rename_db_database%'; -select nspname, orig_name from sys.babelfish_namespace_ext where nspname IN ('dbo', 'guest', 'rename_db_schema1'); -select rolname, login_name, orig_username, database_name from sys.babelfish_authid_user_ext where database_name LIKE 'rename_db_database%'; -select rolname, default_database_name from sys.babelfish_authid_login_ext where default_database_name LIKE 'rename_db_database%'; +select owner, name from sys.babelfish_sysdatabases where name LIKE 'rename_db_database%' ORDER BY name; +select nspname, orig_name from sys.babelfish_namespace_ext where nspname IN ('dbo', 'guest', 'rename_db_schema1') ORDER BY nspname; +select rolname, login_name, orig_username, database_name from sys.babelfish_authid_user_ext where database_name LIKE 'rename_db_database%' ORDER BY rolname; +select rolname, default_database_name from sys.babelfish_authid_login_ext where default_database_name LIKE 'rename_db_database%' ORDER BY rolname; go ~~START~~ varchar#!#text @@ -176,8 +176,8 @@ rename_db_schema1#!#rename_db_schema1 ~~START~~ varchar#!#varchar#!#nvarchar#!#nvarchar -dbo#!##!#dbo#!#rename_db_database2 db_owner#!##!#db_owner#!#rename_db_database2 +dbo#!##!#dbo#!#rename_db_database2 rename_db_database2_guest#!##!#guest#!#rename_db_database2 rename_db_database2_rename_db_role1#!##!#rename_db_role1#!#rename_db_database2 ~~END~~ diff --git a/test/JDBC/expected/alter-procedure-before-15_8-or-16_4-vu-cleanup.out b/test/JDBC/expected/alter-procedure-before-15_8-or-16_4-vu-cleanup.out new file mode 100644 index 00000000000..85b1be8cf4e --- /dev/null +++ b/test/JDBC/expected/alter-procedure-before-15_8-or-16_4-vu-cleanup.out @@ -0,0 +1,21 @@ +DROP PROCEDURE alter_proc_p1 +GO + +DROP PROCEDURE alter_proc_p2 +GO + +DROP PROCEDURE alter_proc_p3 +GO + +DROP PROCEDURE alter_proc_p4 +GO + +DROP PROCEDURE alter_proc_p5 +GO + +DROP TABLE alter_proc_users +DROP TABLE alter_proc_orders +GO + +drop function alter_proc_f1 +go diff --git a/test/JDBC/expected/alter-procedure-before-15_8-or-16_4-vu-prepare.out b/test/JDBC/expected/alter-procedure-before-15_8-or-16_4-vu-prepare.out new file mode 100644 index 00000000000..cc0b1922a7c --- /dev/null +++ b/test/JDBC/expected/alter-procedure-before-15_8-or-16_4-vu-prepare.out @@ -0,0 +1,75 @@ + +CREATE TABLE alter_proc_users ([Id] int, [firstname] varchar(50), [lastname] varchar(50), [email] varchar(50)); +CREATE TABLE alter_proc_orders ([Id] int, [userid] int, [productid] int, [quantity] int, [orderdate] Date); +INSERT INTO alter_proc_users VALUES (1, 'j', 'o', 'testemail'), (1, 'e', 'l', 'testemail2'); +INSERT INTO alter_proc_orders VALUES (1, 1, 1, 5, '2023-06-25'), (2, 1, 1, 6, '2023-06-25'); +GO +~~ROW COUNT: 2~~ + +~~ROW COUNT: 2~~ + + +CREATE PROCEDURE alter_proc_p1 +AS + select * from alter_proc_users +GO + +-- Test Case: Modify the procedure body +ALTER -- test comment + PROCEDURE alter_proc_p1 +AS + select * from alter_proc_orders +GO + +create procedure alter_proc_p2 +AS + exec alter_proc_p1 +go + +create procedure alter_proc_p3 as select 1 +go + +-- Test Case: Transaction - begin, alter proc, modify row, commit +-- - expect both changes to take place +BEGIN TRANSACTION +go + +alter procedure alter_proc_p3 @z int as select 500 + @z +go + +INSERT INTO alter_proc_users VALUES (3, 'newuser', 'lastname', 'testemail3') +go +~~ROW COUNT: 1~~ + + +COMMIT +GO + +create procedure alter_proc_p4 as select 1 +go + + + + +-- Test Case: confirm information_schema.routines is updated properly with comments +alter +/* + * test comment 1 + */ +-- test comment 2 +procedure alter_proc_p4 as select 3 +go + + +create function alter_proc_f1() +returns int +AS BEGIN + return 1 +END +go + +create procedure alter_proc_p5 as select 10 +go + +alter procedure alter_proc_p5 @dateParam date as select @dateParam +go diff --git a/test/JDBC/expected/alter-procedure-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/alter-procedure-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..a5ef2b4435c --- /dev/null +++ b/test/JDBC/expected/alter-procedure-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,198 @@ +-- Test Case: Expect error for procedure with same name +CREATE PROCEDURE alter_proc_p1 @param1 int +AS + select * from alter_proc_orders +GO +~~ERROR (Code: 2714)~~ + +~~ERROR (Message: Function 'alter_proc_p1' already exists with the same name)~~ + + +-- Test Case: Expect error for altering proc that does not exist +ALTER PROCEDURE alter_fake_proc @param1 int +AS + select * from alter_proc_orders +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: No existing procedure found with the name for ALTER PROCEDURE)~~ + + +-- Test Case: Expect p1 and p2 to be altered properly with new definition +exec alter_proc_p1 +go +~~START~~ +int#!#int#!#int#!#int#!#date +1#!#1#!#1#!#5#!#2023-06-25 +2#!#1#!#1#!#6#!#2023-06-25 +~~END~~ + + +exec alter_proc_p2 +go +~~START~~ +int#!#int#!#int#!#int#!#date +1#!#1#!#1#!#5#!#2023-06-25 +2#!#1#!#1#!#6#!#2023-06-25 +~~END~~ + + +-- Information_schema routine definition should still show "alter" +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p1'; +go +~~START~~ +nvarchar#!#nvarchar#!#nvarchar +alter_proc_p1#!#SQL#!#ALTER -- test comment PROCEDURE alter_proc_p1AS select * from alter_proc_orders +~~END~~ + + + +-- Test Case: Modify the procedure body, add a parameter, use "proc" +-- instead of "procedure" + ALTER /* TEST COMMENT */ + PROC alter_proc_p1 + @param INT +AS + IF (@param = 1) + BEGIN + select * from alter_proc_users + END + ELSE + BEGIN + select * from alter_proc_orders + END +GO + +exec alter_proc_p1 @param = 1 +GO +~~START~~ +int#!#varchar#!#varchar#!#varchar +1#!#j#!#o#!#testemail +1#!#e#!#l#!#testemail2 +3#!#newuser#!#lastname#!#testemail3 +~~END~~ + + +exec alter_proc_p1 @param = 2 +GO +~~START~~ +int#!#int#!#int#!#int#!#date +1#!#1#!#1#!#5#!#2023-06-25 +2#!#1#!#1#!#6#!#2023-06-25 +~~END~~ + + +-- Test Case: Expect error because no parameter provided +exec alter_proc_p2 +go +~~ERROR (Code: 201)~~ + +~~ERROR (Message: procedure alter_proc_p1 expects parameter "@param", which was not supplied.)~~ + + + +-- Test Case: Alter the parameter type and procedure body +ALTER PROCEDURE alter_proc_p1 + @param date +AS + IF (@param = '2020-01-01') + BEGIN + select * from alter_proc_users + END + ELSE + BEGIN + select * from alter_proc_orders + END +GO + +exec alter_proc_p1 @param = '2020-01-01' +GO +~~START~~ +int#!#varchar#!#varchar#!#varchar +1#!#j#!#o#!#testemail +1#!#e#!#l#!#testemail2 +3#!#newuser#!#lastname#!#testemail3 +~~END~~ + + +exec alter_proc_p1 @param = '2020-01-02' +GO +~~START~~ +int#!#int#!#int#!#int#!#date +1#!#1#!#1#!#5#!#2023-06-25 +2#!#1#!#1#!#6#!#2023-06-25 +~~END~~ + + +-- Test Case: attempt to alter function, expect error for being unsupported +alter function alter_proc_f1() +returns int +as +BEGIN + return 5 +END +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'ALTER FUNCTION' is not currently supported in Babelfish)~~ + + +-- Test Case: Confirm transaction updates procedure correctly +exec alter_proc_p3 @z = 500 +go +~~START~~ +int +1000 +~~END~~ + + +-- Ensure information schema uses "CREATE" instead of "ALTER" with updated definition +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p3'; +go +~~START~~ +nvarchar#!#nvarchar#!#nvarchar +alter_proc_p3#!#SQL#!#alter procedure alter_proc_p3 @z int as select 500 + @z +~~END~~ + + +-- Expect this to error with no param provided +exec alter_proc_p3 +go +~~ERROR (Code: 201)~~ + +~~ERROR (Message: procedure alter_proc_p3 expects parameter "@z", which was not supplied.)~~ + + +-- Expect procedure altered correctly and information_schema contains comments +exec alter_proc_p4 +go +~~START~~ +int +3 +~~END~~ + + +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p4'; +go +~~START~~ +nvarchar#!#nvarchar#!#nvarchar +alter_proc_p4#!#SQL#!#alter /* * test comment 1 */-- test comment 2procedure alter_proc_p4 as select 3 +~~END~~ + + +-- Test Case: confirm procedure altered to add parameter +exec alter_proc_p5 @dateParam = '2000-01-01' +go +~~START~~ +date +2000-01-01 +~~END~~ + + +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p5'; +go +~~START~~ +nvarchar#!#nvarchar#!#nvarchar +alter_proc_p5#!#SQL#!#alter procedure alter_proc_p5 @dateParam date as select @dateParam +~~END~~ + diff --git a/test/JDBC/expected/alter-procedure-schema.out b/test/JDBC/expected/alter-procedure-schema.out index 7244daaf355..0427cbc0bcb 100644 --- a/test/JDBC/expected/alter-procedure-schema.out +++ b/test/JDBC/expected/alter-procedure-schema.out @@ -425,3 +425,41 @@ void -- tsql drop login alter_proc_l4; go + +-- psql currentSchema=master_dbo,public +-- Test psql procedures altered with security definer do not throw StartTransactionCommand: unexpected state STARTED error +-- Test alter procedure using tsql dialect in PSQL port throws error +CREATE PROCEDURE master_dbo.p1() AS $$ BEGIN SELECT 1; END $$ LANGUAGE plpgsql; +go + +alter procedure master_dbo.p1 security definer; +go + +drop procedure master_dbo.p1; +go + +set babelfishpg_tsql.sql_dialect = "tsql"; +GO + +CREATE PROCEDURE tsqlp1 as select 1 +go + +ALTER PROCEDURE tsqlp1 as select 2 +go +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: TSQL ALTER PROCEDURE is not supported from PostgreSQL endpoint. + Server SQLState: 0A000)~~ + + +drop procedure tsqlp1 +go + +-- Set dialect back to postgres +select set_config('babelfishpg_tsql.sql_dialect', 'postgres', null); +GO +~~START~~ +text +postgres +~~END~~ + diff --git a/test/JDBC/expected/alter-procedure-vu-cleanup.out b/test/JDBC/expected/alter-procedure-vu-cleanup.out index 83e05e6a3f2..85b1be8cf4e 100644 --- a/test/JDBC/expected/alter-procedure-vu-cleanup.out +++ b/test/JDBC/expected/alter-procedure-vu-cleanup.out @@ -7,6 +7,12 @@ GO DROP PROCEDURE alter_proc_p3 GO +DROP PROCEDURE alter_proc_p4 +GO + +DROP PROCEDURE alter_proc_p5 +GO + DROP TABLE alter_proc_users DROP TABLE alter_proc_orders GO diff --git a/test/JDBC/expected/alter-procedure-vu-prepare.out b/test/JDBC/expected/alter-procedure-vu-prepare.out index ec470b7b4d2..c6dbecb1298 100644 --- a/test/JDBC/expected/alter-procedure-vu-prepare.out +++ b/test/JDBC/expected/alter-procedure-vu-prepare.out @@ -22,6 +22,9 @@ go create procedure alter_proc_p3 as select 1 go +create procedure alter_proc_p4 as select 1 +go + create function alter_proc_f1() returns int @@ -29,3 +32,9 @@ AS BEGIN return 1 END go + +create procedure alter_proc_p5 as select 10 +go + +alter procedure alter_proc_p5 @dateParam date as select @dateParam +go diff --git a/test/JDBC/expected/alter-procedure-vu-verify.out b/test/JDBC/expected/alter-procedure-vu-verify.out index dbb0289c608..ba6c7e137c1 100644 --- a/test/JDBC/expected/alter-procedure-vu-verify.out +++ b/test/JDBC/expected/alter-procedure-vu-verify.out @@ -27,8 +27,9 @@ GO ~~ERROR (Message: No existing procedure found with the name for ALTER PROCEDURE)~~ --- Test Case: Modify the procedure body -ALTER PROCEDURE alter_proc_p1 +-- Test Case: Modify the procedure body, and check information_schema updated with spaces +/* Leading comment not included: BABEL-5140 */ ALTER -- test comment + PROCEDURE alter_proc_p1 AS select * from alter_proc_orders GO @@ -51,11 +52,20 @@ int#!#int#!#int#!#int#!#date ~~END~~ +-- Ensure information schema uses "CREATE" instead of "ALTER" with updated definition +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p1'; +go +~~START~~ +nvarchar#!#nvarchar#!#nvarchar +alter_proc_p1#!#SQL#!#CREATE -- test comment PROCEDURE alter_proc_p1AS select * from alter_proc_orders +~~END~~ + -- Test Case: Modify the procedure body, add a parameter, use "proc" --- instead of "procedure" -ALTER PROC alter_proc_p1 +-- instead of "procedure" + ALTER /* TEST COMMENT */ + PROC alter_proc_p1 @param INT AS IF (@param = 1) @@ -86,6 +96,15 @@ int#!#int#!#int#!#int#!#date ~~END~~ +-- Ensure information schema uses "CREATE" instead of "ALTER" with updated definition +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p1'; +go +~~START~~ +nvarchar#!#nvarchar#!#nvarchar +alter_proc_p1#!#SQL#!#CREATE /* TEST COMMENT */ PROC alter_proc_p1 @param INTAS IF (@param = 1) BEGIN select * from alter_proc_users END ELSE BEGIN select * from alter_proc_orders END +~~END~~ + + -- Test Case: Expect error because no parameter provided exec alter_proc_p2 go @@ -127,6 +146,15 @@ int#!#int#!#int#!#int#!#date ~~END~~ +-- Ensure information schema uses "CREATE" instead of "ALTER" with updated definition +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p1'; +go +~~START~~ +nvarchar#!#nvarchar#!#nvarchar +alter_proc_p1#!#SQL#!#CREATE PROCEDURE alter_proc_p1 @param dateAS IF (@param = '2020-01-01') BEGIN select * from alter_proc_users END ELSE BEGIN select * from alter_proc_orders END +~~END~~ + + -- Test Case: Modify the procedure body to call another modified proc alter procedure alter_proc_p2 AS @@ -142,6 +170,15 @@ int#!#varchar#!#varchar#!#varchar ~~END~~ +-- Ensure information schema uses "CREATE" instead of "ALTER" with updated definition +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p2'; +go +~~START~~ +nvarchar#!#nvarchar#!#nvarchar +alter_proc_p2#!#SQL#!#CREATE procedure alter_proc_p2AS exec alter_proc_p1 @param = '2020-01-01' +~~END~~ + + -- Test Case: attempt to alter function, expect error for being unsupported alter function alter_proc_f1() @@ -209,6 +246,15 @@ int#!#varchar#!#varchar#!#varchar ~~END~~ +-- Ensure information schema uses "CREATE" instead of "ALTER" with updated definition +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p3'; +go +~~START~~ +nvarchar#!#nvarchar#!#nvarchar +alter_proc_p3#!#SQL#!#CREATE procedure alter_proc_p3 @z int as select 500 + @z +~~END~~ + + -- Test Case: Transaction - begin, alter proc, modify row, commit -- - expect both changes to not go through @@ -264,3 +310,73 @@ go ~~ERROR (Message: procedure alter_proc_p3 expects parameter "@z", which was not supplied.)~~ + + + + + +-- Test Case: confirm information_schema.routines is updated properly with comments +alter +/* + * test comment 1 + */ +-- test comment 2 +procedure alter_proc_p4 as select 3 +go + +exec alter_proc_p4 +go +~~START~~ +int +3 +~~END~~ + + +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p4'; +go +~~START~~ +nvarchar#!#nvarchar#!#nvarchar +alter_proc_p4#!#SQL#!#CREATE /* * test comment 1 */-- test comment 2procedure alter_proc_p4 as select 3 +~~END~~ + + + + +-- Test Case: confirm information_schema.routines is updated properly with comments +alter +-- test comment 1 +procedure alter_proc_p4 as select 4 +go + +exec alter_proc_p4 +go +~~START~~ +int +4 +~~END~~ + + +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p4'; +go +~~START~~ +nvarchar#!#nvarchar#!#nvarchar +alter_proc_p4#!#SQL#!#CREATE -- test comment 1procedure alter_proc_p4 as select 4 +~~END~~ + + +-- Test Case: confirm procedure altered in 'alter-procedure-vu-prepare' is properly updated +exec alter_proc_p5 @dateParam = '2000-01-01' +go +~~START~~ +date +2000-01-01 +~~END~~ + + +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p4'; +go +~~START~~ +nvarchar#!#nvarchar#!#nvarchar +alter_proc_p4#!#SQL#!#CREATE -- test comment 1procedure alter_proc_p4 as select 4 +~~END~~ + diff --git a/test/JDBC/expected/babel_726.out b/test/JDBC/expected/babel_726.out index c4ea1fa6b59..85eed0e9bc8 100644 --- a/test/JDBC/expected/babel_726.out +++ b/test/JDBC/expected/babel_726.out @@ -638,6 +638,20 @@ x ~~END~~ +-- check that duplicate view with varbinary cast does not cause crash (#2693) +create view babel_726_v1 as select cast('a' as varbinary) +go + +create view babel_726_v1 as select cast('a' as varbinary) +go +~~ERROR (Code: 2714)~~ + +~~ERROR (Message: relation "babel_726_v1" already exists)~~ + + +drop view babel_726_v1 +go + drop table babel_726_t1 go diff --git a/test/JDBC/expected/babel_collation.out b/test/JDBC/expected/babel_collation.out index 488adfced42..a6b57ad1721 100644 --- a/test/JDBC/expected/babel_collation.out +++ b/test/JDBC/expected/babel_collation.out @@ -322,11 +322,11 @@ int#!#int DECLARE @haystack VARCHAR(100); SELECT @haystack = 'This is a haystack'; -SELECT CHARINDEX('', @haystack); -- empty string - expect 1 +SELECT CHARINDEX('', @haystack); -- empty string - expect 0 go ~~START~~ int -1 +0 ~~END~~ @@ -395,32 +395,32 @@ bike ~~END~~ ~~START~~ -text +varchar B A R bar B A RBar ~~END~~ ~~START~~ -text +varchar empty pattern ~~END~~ ~~START~~ -text +varchar ~~END~~ ~~START~~ -text +varchar ~~END~~ ~~START~~ -text +varchar bar bar FooBar ~~END~~ ~~START~~ -text +varchar nothing to do ~~END~~ diff --git a/test/JDBC/expected/babel_function.out b/test/JDBC/expected/babel_function.out index 65f281fe951..7fc4b20e46a 100644 --- a/test/JDBC/expected/babel_function.out +++ b/test/JDBC/expected/babel_function.out @@ -1795,7 +1795,7 @@ aijklmn select STUFF(N'abcdef', 2, 3, NULL); GO ~~START~~ -text +nvarchar aef ~~END~~ @@ -1803,21 +1803,21 @@ aef select STUFF('abcdef', 2, 3, 'ijklmn'); GO ~~START~~ -text +varchar aijklmnef ~~END~~ select STUFF('abcdef', 2, 3, N'ijklmn'); GO ~~START~~ -text +nvarchar aijklmnef ~~END~~ select STUFF(N'abcdef', 2, 3, 'ijklmn'); GO ~~START~~ -text +nvarchar aijklmnef ~~END~~ @@ -1825,21 +1825,21 @@ aijklmnef SELECT STUFF(CAST('abcdef' as text), 2, 3, CAST('ijklmn' as text)); GO ~~START~~ -text +varchar aijklmnef ~~END~~ SELECT STUFF(CAST('abcdef' as text), 2, 3, 'ijklmn'); GO ~~START~~ -text +varchar aijklmnef ~~END~~ SELECT STUFF('abcdef', 2, 3, CAST('ijklmn' as text)); GO ~~START~~ -text +varchar aijklmnef ~~END~~ @@ -1854,14 +1854,14 @@ aijklmnef SELECT STUFF('abcdef', 2, 3, CAST('ijklmn' as sys.varchar)); GO ~~START~~ -text +varchar aijklmnef ~~END~~ SELECT STUFF(CAST('abcdef' as sys.varchar), 2, 3, 'ijklmn'); GO ~~START~~ -text +varchar aijklmnef ~~END~~ diff --git a/test/JDBC/expected/babel_function_string-before-15-5-or-14-10-vu-verify.out b/test/JDBC/expected/babel_function_string-before-15-5-or-14-10-vu-verify.out index 4e0207f9ffa..0ef3564cf12 100644 --- a/test/JDBC/expected/babel_function_string-before-15-5-or-14-10-vu-verify.out +++ b/test/JDBC/expected/babel_function_string-before-15-5-or-14-10-vu-verify.out @@ -10,7 +10,7 @@ varchar SELECT REPLICATE(N'abc', 3) GO ~~START~~ -varchar +nvarchar abcabcabc ~~END~~ diff --git a/test/JDBC/expected/babel_function_string-vu-verify.out b/test/JDBC/expected/babel_function_string-vu-verify.out index b63ef75e2df..e75fb2bc406 100644 --- a/test/JDBC/expected/babel_function_string-vu-verify.out +++ b/test/JDBC/expected/babel_function_string-vu-verify.out @@ -10,7 +10,7 @@ varchar SELECT REPLICATE(N'abc', 3) GO ~~START~~ -varchar +nvarchar abcabcabc ~~END~~ diff --git a/test/JDBC/expected/babel_function_string.out b/test/JDBC/expected/babel_function_string.out index 82cd9cddf3a..000b949d4dc 100644 --- a/test/JDBC/expected/babel_function_string.out +++ b/test/JDBC/expected/babel_function_string.out @@ -10,7 +10,7 @@ varchar SELECT REPLICATE(N'abc', 3) GO ~~START~~ -varchar +nvarchar abcabcabc ~~END~~ diff --git a/test/JDBC/expected/babel_numeric.out b/test/JDBC/expected/babel_numeric.out index 40988a68576..8d3bb92a090 100644 --- a/test/JDBC/expected/babel_numeric.out +++ b/test/JDBC/expected/babel_numeric.out @@ -121,3 +121,368 @@ numeric drop table t1; go + +select * from +( + select cast(1.23 as decimal(18,2)) as col + union all + select cast(1.23 as decimal(7,2)) as col +) dummy order by col; +go +~~START~~ +numeric +1.23 +1.23 +~~END~~ + + +select * from +( + select cast(NULL as decimal(18,2)) as col + union all + select cast(1.23 as decimal(7,2)) as col +) dummy order by col; +go +~~START~~ +numeric + +1.23 +~~END~~ + + +select * from +( + select cast(9999999999999999.99 as decimal(18,2)) as col + union all + select cast(99999.99 as decimal(7,2)) as col +) dummy order by col; +go +~~START~~ +numeric +99999.99 +9999999999999999.99 +~~END~~ + + +create type decimal_18_2 from decimal(18,2); +go + +create type decimal_7_2 from decimal(7,2); +go + +select * from +( + select cast(1.23 as decimal_18_2) as col + union all + select cast(1.23 as decimal_7_2) as col +) dummy order by col; +go +~~START~~ +numeric +1.23 +1.23 +~~END~~ + + +select * from +( + select cast(1.23 as decimal_18_2) as col + union all + select cast(NULL as decimal_7_2) as col +) dummy order by col; +go +~~START~~ +numeric + +1.23 +~~END~~ + + +select * from +( + select cast(9999999999999999.99 as decimal_18_2) as col + union all + select cast(99999.99 as decimal_7_2) as col +) dummy order by col; +go +~~START~~ +numeric +99999.99 +9999999999999999.99 +~~END~~ + + +create table babel_5086_t1 (a decimal(18,2), b decimal(7,2), c decimal_18_2, d decimal_7_2); +go + +insert into babel_5086_t1 values (1.23, 1.23, 1.23, 1.23); +insert into babel_5086_t1 values (9999999999999999.99, NULL, 9999999999999999.99, NULL); +insert into babel_5086_t1 values (NULL, 99999.99, NULL, 99999.99); +go +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +select * from +( + select a as col from babel_5086_t1 + union all + select b as col from babel_5086_t1 +) dummy order by col; +go +~~START~~ +numeric + + +1.23 +1.23 +99999.99 +9999999999999999.99 +~~END~~ + + +select * from +( + select c as col from babel_5086_t1 + union all + select d as col from babel_5086_t1 +) dummy order by col; +go +~~START~~ +numeric + + +1.23000000 +1.23000000 +99999.99000000 +9999999999999999.99000000 +~~END~~ + + +select * from +( + select a as col from babel_5086_t1 + union all + select b as col from babel_5086_t1 + union all + select c as col from babel_5086_t1 + union all + select d as col from babel_5086_t1 +) dummy order by col; +go +~~START~~ +numeric + + + + +1.23 +1.23 +1.23 +1.23 +99999.99 +99999.99 +9999999999999999.99 +9999999999999999.99 +~~END~~ + + +select * from +( + select a as col from babel_5086_t1 + union all + select c as col from babel_5086_t1 +) dummy order by col; +go +~~START~~ +numeric + + +1.23 +1.23 +9999999999999999.99 +9999999999999999.99 +~~END~~ + + +select * from +( + select b as col from babel_5086_t1 + union all + select d as col from babel_5086_t1 +) dummy order by col; +go +~~START~~ +numeric + + +1.23 +1.23 +99999.99 +99999.99 +~~END~~ + + +create type numeric_18_2 from numeric(18,2); +go + +create type numeric_7_2 from numeric(7,2); +go + +select * from +( + select cast(1.23 as numeric_18_2) as col + union all + select cast(1.23 as numeric_7_2) as col +) dummy order by col; +go +~~START~~ +numeric +1.23 +1.23 +~~END~~ + + +select * from +( + select cast(12344.234 as numeric_18_2) as col + union all + select cast(1.23 as numeric_7_2) as col +) dummy order by col; +go +~~START~~ +numeric +1.23 +12344.23 +~~END~~ + + +create table babel_5086_t2 (a numeric(18,2), b numeric(7,2), c numeric_18_2, d numeric_7_2); +go + +insert into babel_5086_t2 values (1.23, 1.23, 1.23, 1.23); +insert into babel_5086_t2 values (9999999999999999.99, NULL, 9999999999999999.99, NULL); +insert into babel_5086_t2 values (NULL, 99999.99, NULL, 99999.99); +go +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +select * from +( + select a as col from babel_5086_t2 + union all + select b as col from babel_5086_t2 +) dummy order by col; +go +~~START~~ +numeric + + +1.23 +1.23 +99999.99 +9999999999999999.99 +~~END~~ + + +select * from +( + select c as col from babel_5086_t2 + union all + select d as col from babel_5086_t2 +) dummy order by col; +go +~~START~~ +numeric + + +1.23000000 +1.23000000 +99999.99000000 +9999999999999999.99000000 +~~END~~ + + +select * from +( + select a as col from babel_5086_t2 + union all + select b as col from babel_5086_t2 + union all + select c as col from babel_5086_t2 + union all + select d as col from babel_5086_t2 +) dummy order by col; +go +~~START~~ +numeric + + + + +1.23 +1.23 +1.23 +1.23 +99999.99 +99999.99 +9999999999999999.99 +9999999999999999.99 +~~END~~ + + +select * from +( + select a as col from babel_5086_t2 + union all + select c as col from babel_5086_t2 +) dummy order by col; +go +~~START~~ +numeric + + +1.23 +1.23 +9999999999999999.99 +9999999999999999.99 +~~END~~ + + + +select * from +( + select b as col from babel_5086_t2 + union all + select d as col from babel_5086_t2 +) dummy order by col; +go +~~START~~ +numeric + + +1.23 +1.23 +99999.99 +99999.99 +~~END~~ + + +drop table babel_5086_t1; +go + +drop table babel_5086_t2; +go + +drop type decimal_18_2; +drop type decimal_7_2; +drop type numeric_18_2; +drop type numeric_7_2; +go diff --git a/test/JDBC/expected/babel_trigger.out b/test/JDBC/expected/babel_trigger.out index 029a7255e67..01bc3ba21e5 100644 --- a/test/JDBC/expected/babel_trigger.out +++ b/test/JDBC/expected/babel_trigger.out @@ -435,6 +435,23 @@ babel_trigger_trig2#!#babel_trigger_sch1 ~~END~~ +CREATE TABLE #babel_2177(id int) +go + +-- will fail and print error when trying to create trigger on temp table +CREATE TRIGGER trigger_babel_2177 ON #babel_2177 +AFTER INSERT +AS + INSERT into #babel_2177 VALUES (7) +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot create trigger on a temporary object.)~~ + + +drop table #babel_2177; +GO + -- clean up drop trigger babel_trigger_sch1.babel_trigger_trig1 GO diff --git a/test/JDBC/expected/babel_typecode.out b/test/JDBC/expected/babel_typecode.out index 9bd049143a1..275df8bed10 100644 --- a/test/JDBC/expected/babel_typecode.out +++ b/test/JDBC/expected/babel_typecode.out @@ -37,6 +37,8 @@ sys#!#sysname#!#sysname#!#5#!#31#!#5 sys#!#rowversion#!#timestamp#!#8#!#32#!#3 sys#!#timestamp#!#timestamp#!#8#!#33#!#3 sys#!#vector#!#vector#!#9#!#34#!#3 +sys#!#sparsevec#!#sparsevec#!#9#!#34#!#3 +sys#!#halfvec#!#halfvec#!#9#!#34#!#3 sys#!#geometry#!#geometry#!#5#!#34#!#1 sys#!#geography#!#geography#!#5#!#35#!#1 ~~END~~ diff --git a/test/JDBC/expected/babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-cleanup.out b/test/JDBC/expected/babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-cleanup.out new file mode 100644 index 00000000000..726983f8855 --- /dev/null +++ b/test/JDBC/expected/babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-cleanup.out @@ -0,0 +1,58 @@ +DROP VIEW babel_2877_vu_prepare_view1; +GO + +DROP VIEW babel_2877_vu_prepare_view2; +GO + +DROP VIEW babel_2877_vu_prepare_view3; +GO + +DROP FUNCTION IF EXISTS babel_2877_vu_prepare_func1; +GO + +DROP FUNCTION IF EXISTS babel_2877_vu_prepare_func2; +GO + +DROP FUNCTION IF EXISTS babel_2877_vu_prepare_func3; +GO + +DROP PROCEDURE IF EXISTS babel_2877_vu_prepare_proc1; +GO + +DROP PROCEDURE IF EXISTS babel_2877_vu_prepare_proc2; +GO + +DROP PROCEDURE IF EXISTS babel_2877_vu_prepare_proc3; +GO + +DROP FUNCTION IF EXISTS [BABEL-2877-vu-prepare_FUNC_ANSI_NULLON_QIDON]; +GO + +DROP FUNCTION IF EXISTS [BABEL-2877-vu-prepare_FUNC_ANSI_NULLOFF_QIDON]; +GO + +DROP FUNCTION IF EXISTS [BABEL-2877-vu-prepare_FUNC_ANSI_NULLOFF_QIDOFF]; +GO + +DROP FUNCTION IF EXISTS [BABEL-2877-vu-prepare_FUNC_ANSI_NULLON_QIDOFF]; +GO + +DROP FUNCTION [BABEL-2877-vu-prepare_FUNC_Schema].[BABEL-2877-vu-prepare_FUNC]; +GO + +DROP FUNCTION [BABEL-2877-vu-prepare Schema . WITH .. DOTS].[BABEL-2877-vu-prepare Function . WITH .. DOTS2]; +GO + +DROP SCHEMA [BABEL-2877-vu-prepare_FUNC_Schema]; +GO + +DROP SCHEMA [BABEL-2877-vu-prepare Schema . WITH .. DOTS]; +GO + +-- babelfish_function_ext entry should have been removed after dropping all these functions/procedure +SELECT * FROM sys.babelfish_function_ext WHERE funcname LIKE 'babel_2877_vu_prepare%'; +GO +~~START~~ +varchar#!#varchar#!#nvarchar#!#text#!#text#!#bigint#!#bigint#!#datetime#!#datetime#!#ntext +~~END~~ + diff --git a/test/JDBC/expected/BABEL-2877-vu-prepare.out b/test/JDBC/expected/babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-prepare.out similarity index 84% rename from test/JDBC/expected/BABEL-2877-vu-prepare.out rename to test/JDBC/expected/babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-prepare.out index aa91e6afde9..34f13e297af 100644 --- a/test/JDBC/expected/BABEL-2877-vu-prepare.out +++ b/test/JDBC/expected/babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-prepare.out @@ -98,3 +98,18 @@ GO SET QUOTED_IDENTIFIER ON; GO + +CREATE SCHEMA [BABEL-2877-vu-prepare_FUNC_Schema] +GO + +CREATE SCHEMA [BABEL-2877-vu-prepare Schema . WITH .. DOTS] +GO + +-- Function name which is prefix of schema name +CREATE FUNCTION [BABEL-2877-vu-prepare_FUNC_Schema] . [BABEL-2877-vu-prepare_FUNC] (@a int) +RETURNS INT AS BEGIN RETURN 1; END; +GO + +CREATE FUNCTION [BABEL-2877-vu-prepare Schema . WITH .. DOTS] . [BABEL-2877-vu-prepare Function . WITH .. DOTS] (@a int) +RETURNS INT AS BEGIN RETURN 1; END; +GO diff --git a/test/JDBC/expected/babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-verify.out b/test/JDBC/expected/babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-verify.out new file mode 100644 index 00000000000..41cfe25c3ff --- /dev/null +++ b/test/JDBC/expected/babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-verify.out @@ -0,0 +1,283 @@ +SELECT pg_get_functiondef(cast('babel_2877_vu_prepare_func1' as regproc)); +GO +~~START~~ +text +CREATE OR REPLACE FUNCTION master_dbo.babel_2877_vu_prepare_func1("@a" integer, "@b" "varchar" DEFAULT 'abc'::"varchar", "@c" money, "@d" double precision DEFAULT 1.2) RETURNS "varchar" LANGUAGE pltsql STABLEAS '{"version_num": "1", "typmod_array": ["-1", "10", "-1", "-1", "100"], "original_probin": ""}', $function$BEGIN RETURN CAST(@a AS varchar(10)) + @b + CAST(@c AS varchar(10)) + CAST(@d AS varchar(10));END$function$ +~~END~~ + + +SELECT pg_get_functiondef(cast('babel_2877_vu_prepare_func2' as regproc)); +GO +~~START~~ +text +CREATE OR REPLACE FUNCTION master_dbo.babel_2877_vu_prepare_func2("@a" integer DEFAULT 10, "@b" "varchar" DEFAULT 'abc'::"varchar", "@c" money DEFAULT 5, "@d" double precision DEFAULT 1.2) RETURNS "varchar" LANGUAGE pltsql STABLEAS '{"version_num": "1", "typmod_array": ["-1", "10", "-1", "-1", "100"], "original_probin": ""}', $function$BEGIN RETURN CAST(@a AS varchar(10)) + @b + CAST(@c AS varchar(10)) + CAST(@d AS varchar(10));END$function$ +~~END~~ + + +SELECT pg_get_functiondef(cast('babel_2877_vu_prepare_func3' as regproc)); +GO +~~START~~ +text +CREATE OR REPLACE FUNCTION master_dbo.babel_2877_vu_prepare_func3("@a" integer, "@b" "varchar", "@c" money, "@d" double precision) RETURNS "varchar" LANGUAGE pltsql STABLEAS '{"version_num": "1", "typmod_array": ["-1", "10", "-1", "-1", "100"], "original_probin": ""}', $function$BEGIN RETURN CAST(@a AS varchar(10)) + @b + CAST(@c AS varchar(10)) + CAST(@d AS varchar(10));END$function$ +~~END~~ + + +SELECT pg_get_functiondef(cast('babel_2877_vu_prepare_proc1' as regproc)); +GO +~~START~~ +text +CREATE OR REPLACE PROCEDURE master_dbo.babel_2877_vu_prepare_proc1(IN "@a" integer, IN "@b" "varchar" DEFAULT 'abc'::"varchar", IN "@c" money DEFAULT 5, IN "@d" double precision) LANGUAGE pltsqlAS '{"version_num": "1", "typmod_array": ["-1", "10", "-1", "-1"], "original_probin": ""}', $procedure$BEGIN SELECT @a, @b, @c, @d;END$procedure$ +~~END~~ + + +SELECT pg_get_functiondef(cast('babel_2877_vu_prepare_proc2' as regproc)); +GO +~~START~~ +text +CREATE OR REPLACE PROCEDURE master_dbo.babel_2877_vu_prepare_proc2(IN "@a" integer DEFAULT 10, IN "@b" "varchar" DEFAULT 'abc'::"varchar", IN "@c" money DEFAULT 5, IN "@d" double precision DEFAULT 1.2) LANGUAGE pltsqlAS '{"version_num": "1", "typmod_array": ["-1", "10", "-1", "-1"], "original_probin": ""}', $procedure$BEGIN SELECT @a, @b, @c, @d;END$procedure$ +~~END~~ + + +SELECT pg_get_functiondef(cast('babel_2877_vu_prepare_proc3' as regproc)); +GO +~~START~~ +text +CREATE OR REPLACE PROCEDURE master_dbo.babel_2877_vu_prepare_proc3(IN "@a" integer, IN "@b" "varchar", IN "@c" money, IN "@d" double precision) LANGUAGE pltsqlAS '{"version_num": "1", "typmod_array": ["-1", "10", "-1", "-1"], "original_probin": ""}', $procedure$BEGIN SELECT @a, @b, @c, @d;END$procedure$ +~~END~~ + + +SELECT * FROM babel_2877_vu_prepare_func1(10); -- should fail, required argument @c not supplied +GO +~~ERROR (Code: 201)~~ + +~~ERROR (Message: function babel_2877_vu_prepare_func1 expects parameter "@c", which was not supplied.)~~ + + +SELECT * FROM babel_2877_vu_prepare_func1(10, 'abc', $5); +GO +~~START~~ +varchar +10abc5.00001.2 +~~END~~ + + +SELECT * FROM babel_2877_vu_prepare_func2(); +GO +~~START~~ +varchar +10abc5.00001.2 +~~END~~ + + +SELECT * FROM babel_2877_vu_prepare_func3(); -- should fail, all parameters are required +GO +~~ERROR (Code: 201)~~ + +~~ERROR (Message: function babel_2877_vu_prepare_func3 expects parameter "@a", which was not supplied.)~~ + + +SELECT * FROM babel_2877_vu_prepare_func3(10, 'abc', $5, 1.2); +GO +~~START~~ +varchar +10abc5.00001.2 +~~END~~ + + +SELECT * FROM babel_2877_vu_prepare_view1; +GO +~~START~~ +varchar +20def5.00001.2 +~~END~~ + + +SELECT * FROM babel_2877_vu_prepare_view2; +GO +~~START~~ +varchar +10abc5.00001.2 +~~END~~ + + +SELECT * FROM babel_2877_vu_prepare_view3; +GO +~~START~~ +varchar +20def10.00001.8 +~~END~~ + + +EXEC babel_2877_vu_prepare_proc1; -- should fail, required arguments @a and @d not supplied +GO +~~ERROR (Code: 201)~~ + +~~ERROR (Message: procedure babel_2877_vu_prepare_proc1 expects parameter "@a", which was not supplied.)~~ + + +EXEC babel_2877_vu_prepare_proc1 10; -- should fail, required argument @d not supplied +GO +~~ERROR (Code: 201)~~ + +~~ERROR (Message: procedure babel_2877_vu_prepare_proc1 expects parameter "@d", which was not supplied.)~~ + + +EXEC babel_2877_vu_prepare_proc1 @d=40; -- should fail, required argument @a not supplied +GO +~~ERROR (Code: 201)~~ + +~~ERROR (Message: procedure babel_2877_vu_prepare_proc1 expects parameter "@a", which was not supplied.)~~ + + +EXEC babel_2877_vu_prepare_proc1 @a = 10, @d = 1.8; +GO +~~START~~ +int#!#varchar#!#money#!#float +10#!#abc#!#5.0000#!#1.8 +~~END~~ + + +EXEC babel_2877_vu_prepare_proc1 @a = 10, @b = 20, @c = 30, @d = 40; +GO +~~START~~ +int#!#varchar#!#money#!#float +10#!#20#!#30.0000#!#40.0 +~~END~~ + + +EXEC babel_2877_vu_prepare_proc2; +GO +~~START~~ +int#!#varchar#!#money#!#float +10#!#abc#!#5.0000#!#1.2 +~~END~~ + + +EXEC babel_2877_vu_prepare_proc2 @d = 1.5; +GO +~~START~~ +int#!#varchar#!#money#!#float +10#!#abc#!#5.0000#!#1.5 +~~END~~ + + +EXEC babel_2877_vu_prepare_proc3; -- should fail, all parameters are required +GO +~~ERROR (Code: 201)~~ + +~~ERROR (Message: procedure babel_2877_vu_prepare_proc3 expects parameter "@a", which was not supplied.)~~ + + +EXEC babel_2877_vu_prepare_proc3 10, 'def', $10, 1.8; -- should fail, all parameters are required +GO +~~START~~ +int#!#varchar#!#money#!#float +10#!#def#!#10.0000#!#1.8 +~~END~~ + + +-- babelfish_function_ext table should have entry for all the above functions and procedures +SELECT nspname, + funcname, + funcsignature, + default_positions +FROM sys.babelfish_function_ext + WHERE funcname LIKE 'babel_2877_vu_prepare%' + AND funcname NOT LIKE '%ansi%' ORDER BY funcname; +GO +~~START~~ +varchar#!#varchar#!#text#!#text +master_babel-2877-vu-prepare schema . with .. dots#!#babel-2877-vu-prepare function . with .. dots#!#babel-2877-vu-prepare function . with .. dots(integer)#!# +master_babel-2877-vu-prepare_func_schema#!#babel-2877-vu-prepare_func#!#babel-2877-vu-prepare_func(integer)#!# +master_dbo#!#babel_2877_vu_prepare_func1#!#babel_2877_vu_prepare_func1(integer, "sys"."varchar", "sys"."money", double precision)#!#(1 3) +master_dbo#!#babel_2877_vu_prepare_func2#!#babel_2877_vu_prepare_func2(integer, "sys"."varchar", "sys"."money", double precision)#!#(0 1 2 3) +master_dbo#!#babel_2877_vu_prepare_func3#!#babel_2877_vu_prepare_func3(integer, "sys"."varchar", "sys"."money", double precision)#!# +master_dbo#!#babel_2877_vu_prepare_proc1#!#babel_2877_vu_prepare_proc1(integer, "sys"."varchar", "sys"."money", double precision)#!#(1 2) +master_dbo#!#babel_2877_vu_prepare_proc2#!#babel_2877_vu_prepare_proc2(integer, "sys"."varchar", "sys"."money", double precision)#!#(0 1 2 3) +master_dbo#!#babel_2877_vu_prepare_proc3#!#babel_2877_vu_prepare_proc3(integer, "sys"."varchar", "sys"."money", double precision)#!# +~~END~~ + + +SELECT orig_name, + CASE flag_validity & 1 + WHEN 0 + THEN NULL + ELSE + CASE flag_values & 1 + WHEN 0 + THEN 0 + ELSE 1 + END + END AS ansi_null, + CASE flag_validity & 2 + WHEN 0 + THEN NULL + ELSE + CASE flag_values & 2 + WHEN 0 + THEN 0 + ELSE 1 + END + END AS quoted_identifier +FROM sys.babelfish_function_ext WHERE funcname LIKE 'babel-2877-vu-prepare%' ORDER BY funcname; +GO +~~START~~ +nvarchar#!#int#!#int +BABEL-2877-vu-prepare Schema . WITH .. DOTS#!#1#!#1 +BABEL-2877-vu-prepare_FUNC_Schema#!#1#!#1 +BABEL-2877-vu-prepare_FUNC_ANSI_NULLOFF_QIDOFF#!#0#!#0 +BABEL-2877-vu-prepare_FUNC_ANSI_NULLOFF_QIDON#!#0#!#1 +BABEL-2877-vu-prepare_FUNC_ANSI_NULLON_QIDOFF#!#1#!#0 +BABEL-2877-vu-prepare_FUNC_ANSI_NULLON_QIDON#!#1#!#1 +~~END~~ + + +-- Rename the existing functions to fix the originally stored incorrect orig_name +EXEC sp_rename 'BABEL-2877-vu-prepare_FUNC_Schema.BABEL-2877-vu-prepare_FUNC', 'BABEL-2877-vu-prepare_FUNC2', 'OBJECT' +GO + +EXEC sp_rename '"BABEL-2877-vu-prepare Schema . WITH .. DOTS"."BABEL-2877-vu-prepare Function . WITH .. DOTS"', 'BABEL-2877-vu-prepare Function . WITH .. DOTS2', 'OBJECT' +GO + +-- create a new function with name which is prefix of schema name to verify new behavior +CREATE FUNCTION [BABEL-2877-vu-prepare_FUNC_Schema] . [BABEL-2877-vu-prepare_FUNC] (@a int) +RETURNS INT AS BEGIN RETURN 1; END; +GO + +SELECT orig_name, + CASE flag_validity & 1 + WHEN 0 + THEN NULL + ELSE + CASE flag_values & 1 + WHEN 0 + THEN 0 + ELSE 1 + END + END AS ansi_null, + CASE flag_validity & 2 + WHEN 0 + THEN NULL + ELSE + CASE flag_values & 2 + WHEN 0 + THEN 0 + ELSE 1 + END + END AS quoted_identifier +FROM sys.babelfish_function_ext WHERE funcname LIKE 'babel-2877-vu-prepare%' ORDER BY funcname; +GO +~~START~~ +nvarchar#!#int#!#int +BABEL-2877-vu-prepare Function . WITH .. DOTS2#!#1#!#1 +BABEL-2877-vu-prepare_FUNC#!#1#!#1 +BABEL-2877-vu-prepare_FUNC2#!#1#!#1 +BABEL-2877-vu-prepare_FUNC_ANSI_NULLOFF_QIDOFF#!#0#!#0 +BABEL-2877-vu-prepare_FUNC_ANSI_NULLOFF_QIDON#!#0#!#1 +BABEL-2877-vu-prepare_FUNC_ANSI_NULLON_QIDOFF#!#1#!#0 +BABEL-2877-vu-prepare_FUNC_ANSI_NULLON_QIDON#!#1#!#1 +~~END~~ + + +DROP FUNCTION [BABEL-2877-vu-prepare_FUNC_Schema] . [BABEL-2877-vu-prepare_FUNC2] +GO diff --git a/test/JDBC/expected/BABEL-2877-vu-cleanup.out b/test/JDBC/expected/babelfish_function_ext-vu-cleanup.out similarity index 77% rename from test/JDBC/expected/BABEL-2877-vu-cleanup.out rename to test/JDBC/expected/babelfish_function_ext-vu-cleanup.out index 2b3ac2c3920..7518ce549de 100644 --- a/test/JDBC/expected/BABEL-2877-vu-cleanup.out +++ b/test/JDBC/expected/babelfish_function_ext-vu-cleanup.out @@ -37,6 +37,18 @@ GO DROP FUNCTION IF EXISTS [BABEL-2877-vu-prepare_FUNC_ANSI_NULLON_QIDOFF]; GO +DROP FUNCTION [BABEL-2877-vu-prepare_FUNC_Schema].[BABEL-2877-vu-prepare_FUNC]; +GO + +DROP FUNCTION [BABEL-2877-vu-prepare Schema . WITH .. DOTS].[BABEL-2877-vu-prepare Function . WITH .. DOTS]; +GO + +DROP SCHEMA [BABEL-2877-vu-prepare_FUNC_Schema]; +GO + +DROP SCHEMA [BABEL-2877-vu-prepare Schema . WITH .. DOTS]; +GO + -- babelfish_function_ext entry should have been removed after dropping all these functions/procedure SELECT * FROM sys.babelfish_function_ext WHERE funcname LIKE 'babel_2877_vu_prepare%'; GO diff --git a/test/JDBC/input/BABEL-2877-vu-prepare.sql b/test/JDBC/expected/babelfish_function_ext-vu-prepare.out similarity index 84% rename from test/JDBC/input/BABEL-2877-vu-prepare.sql rename to test/JDBC/expected/babelfish_function_ext-vu-prepare.out index b740c68c1ec..34f13e297af 100644 --- a/test/JDBC/input/BABEL-2877-vu-prepare.sql +++ b/test/JDBC/expected/babelfish_function_ext-vu-prepare.out @@ -97,4 +97,19 @@ SET ANSI_NULLS ON; GO SET QUOTED_IDENTIFIER ON; -GO \ No newline at end of file +GO + +CREATE SCHEMA [BABEL-2877-vu-prepare_FUNC_Schema] +GO + +CREATE SCHEMA [BABEL-2877-vu-prepare Schema . WITH .. DOTS] +GO + +-- Function name which is prefix of schema name +CREATE FUNCTION [BABEL-2877-vu-prepare_FUNC_Schema] . [BABEL-2877-vu-prepare_FUNC] (@a int) +RETURNS INT AS BEGIN RETURN 1; END; +GO + +CREATE FUNCTION [BABEL-2877-vu-prepare Schema . WITH .. DOTS] . [BABEL-2877-vu-prepare Function . WITH .. DOTS] (@a int) +RETURNS INT AS BEGIN RETURN 1; END; +GO diff --git a/test/JDBC/expected/BABEL-2877-vu-verify.out b/test/JDBC/expected/babelfish_function_ext-vu-verify.out similarity index 95% rename from test/JDBC/expected/BABEL-2877-vu-verify.out rename to test/JDBC/expected/babelfish_function_ext-vu-verify.out index de27044b493..301309e561d 100644 --- a/test/JDBC/expected/BABEL-2877-vu-verify.out +++ b/test/JDBC/expected/babelfish_function_ext-vu-verify.out @@ -187,6 +187,8 @@ FROM sys.babelfish_function_ext GO ~~START~~ varchar#!#varchar#!#text#!#text +master_babel-2877-vu-prepare schema . with .. dots#!#babel-2877-vu-prepare function . with .. dots#!#babel-2877-vu-prepare function . with .. dots(integer)#!# +master_babel-2877-vu-prepare_func_schema#!#babel-2877-vu-prepare_func#!#babel-2877-vu-prepare_func(integer)#!# master_dbo#!#babel_2877_vu_prepare_func1#!#babel_2877_vu_prepare_func1(integer, "sys"."varchar", "sys"."money", double precision)#!#(1 3) master_dbo#!#babel_2877_vu_prepare_func2#!#babel_2877_vu_prepare_func2(integer, "sys"."varchar", "sys"."money", double precision)#!#(0 1 2 3) master_dbo#!#babel_2877_vu_prepare_func3#!#babel_2877_vu_prepare_func3(integer, "sys"."varchar", "sys"."money", double precision)#!# @@ -221,6 +223,8 @@ FROM sys.babelfish_function_ext WHERE funcname LIKE 'babel-2877-vu-prepare%' ORD GO ~~START~~ nvarchar#!#int#!#int +BABEL-2877-vu-prepare Function . WITH .. DOTS#!#1#!#1 +BABEL-2877-vu-prepare_FUNC#!#1#!#1 BABEL-2877-vu-prepare_FUNC_ANSI_NULLOFF_QIDOFF#!#0#!#0 BABEL-2877-vu-prepare_FUNC_ANSI_NULLOFF_QIDON#!#0#!#1 BABEL-2877-vu-prepare_FUNC_ANSI_NULLON_QIDOFF#!#1#!#0 diff --git a/test/JDBC/expected/babelfish_integrity_checker-vu-verify.out b/test/JDBC/expected/babelfish_integrity_checker-vu-verify.out index 8f1881c2d91..0cb4470f70c 100644 --- a/test/JDBC/expected/babelfish_integrity_checker-vu-verify.out +++ b/test/JDBC/expected/babelfish_integrity_checker-vu-verify.out @@ -36,6 +36,11 @@ babelfish_domain_mapping babelfish_extended_properties babelfish_function_ext babelfish_namespace_ext +babelfish_partition_depend +babelfish_partition_function +babelfish_partition_function_seq +babelfish_partition_scheme +babelfish_partition_scheme_seq babelfish_schema_permissions babelfish_server_options babelfish_sysdatabases diff --git a/test/JDBC/expected/binary-datatype-operators-vu-cleanup.out b/test/JDBC/expected/binary-datatype-operators-vu-cleanup.out new file mode 100644 index 00000000000..55480b4a3c8 --- /dev/null +++ b/test/JDBC/expected/binary-datatype-operators-vu-cleanup.out @@ -0,0 +1,57 @@ +-- drop views +DROP VIEW binary_datatype_operators_less_than_view +GO + +DROP VIEW binary_datatype_operators_less_than_equal_view +GO + +DROP VIEW binary_datatype_operators_greater_than_view +GO + +DROP VIEW binary_datatype_operators_greater_than_equal_view +GO + +DROP VIEW binary_datatype_operators_equal_view +GO + +DROP VIEW binary_datatype_operators_not_equal_view +GO +-- drop procedure +DROP PROCEDURE binary_datatype_operators_less_than_proc +GO + +DROP PROCEDURE binary_datatype_operators_less_than_equal_proc +GO + +DROP PROCEDURE binary_datatype_operators_greater_than_proc +GO + +DROP PROCEDURE binary_datatype_operators_greater_than_equal_proc +GO + +DROP PROCEDURE binary_datatype_operators_equal_proc +GO + +DROP PROCEDURE binary_datatype_operators_not_equal_proc +GO +-- drop function +DROP FUNCTION binary_datatype_operators_less_than_func +GO + +DROP FUNCTION binary_datatype_operators_less_than_equal_func +GO + +DROP FUNCTION binary_datatype_operators_greater_than_func +GO + +DROP FUNCTION binary_datatype_operators_greater_than_equal_func +GO + +DROP FUNCTION binary_datatype_operators_equal_func +GO + +DROP FUNCTION binary_datatype_operators_not_equal_func +GO +-- drop table +DROP TABLE binary_datatype_operators_test_table +GO diff --git a/test/JDBC/expected/binary-datatype-operators-vu-prepare.out b/test/JDBC/expected/binary-datatype-operators-vu-prepare.out new file mode 100644 index 00000000000..de17a6061c0 --- /dev/null +++ b/test/JDBC/expected/binary-datatype-operators-vu-prepare.out @@ -0,0 +1,161 @@ +-- Create the table +CREATE TABLE binary_datatype_operators_test_table ( + col1 BINARY(3), + col2 BINARY(3) +); +GO + +-- Insert data for testing +INSERT INTO binary_datatype_operators_test_table (col1, col2) VALUES + (0x121212, 0x121212), -- col1 = col2 + (0x111111, 0x121212), -- col1 < col2 + (0x121212, 0x111111); -- col1 > col2 +GO +~~ROW COUNT: 3~~ + + +-- Inside Views +CREATE VIEW binary_datatype_operators_less_than_view +AS + SELECT col1, col2, 'col1 < col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 < col2; +GO + +CREATE VIEW binary_datatype_operators_less_than_equal_view +AS + SELECT col1, col2, 'col1 <= col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 <= col2; +GO + + +CREATE VIEW binary_datatype_operators_greater_than_view +AS + SELECT col1, col2, 'col1 > col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 > col2; +GO + +CREATE VIEW binary_datatype_operators_greater_than_equal_view +AS + SELECT col1, col2, 'col1 >= col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 >= col2; +GO + +CREATE VIEW binary_datatype_operators_equal_view +AS + SELECT col1, col2, 'col1 = col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 = col2; +GO + +CREATE VIEW binary_datatype_operators_not_equal_view +AS + SELECT col1, col2, 'col1 <> col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 <> col2; +GO + +-- Inside Procedure +CREATE PROC binary_datatype_operators_less_than_proc +AS + SELECT col1, col2, 'col1 < col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 < col2; +GO + +CREATE PROC binary_datatype_operators_less_than_equal_proc +AS + SELECT col1, col2, 'col1 <= col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 <= col2; +GO + + +CREATE PROC binary_datatype_operators_greater_than_proc +AS + SELECT col1, col2, 'col1 > col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 > col2; +GO + +CREATE PROC binary_datatype_operators_greater_than_equal_proc +AS + SELECT col1, col2, 'col1 >= col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 >= col2; +GO + +CREATE PROC binary_datatype_operators_equal_proc +AS + SELECT col1, col2, 'col1 = col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 = col2; +GO + +CREATE PROC binary_datatype_operators_not_equal_proc +AS + SELECT col1, col2, 'col1 <> col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 <> col2; +GO + +-- Inside Function +CREATE FUNCTION binary_datatype_operators_less_than_func() +RETURNS TABLE AS +RETURN( + SELECT col1, col2, 'col1 < col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 < col2 +); +GO + +CREATE FUNCTION binary_datatype_operators_less_than_equal_func() +RETURNS TABLE AS +RETURN( + SELECT col1, col2, 'col1 <= col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 <= col2 +); +GO + + +CREATE FUNCTION binary_datatype_operators_greater_than_func() +RETURNS TABLE AS +RETURN( + SELECT col1, col2, 'col1 > col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 > col2 +); +GO + +CREATE FUNCTION binary_datatype_operators_greater_than_equal_func() +RETURNS TABLE AS +RETURN( + SELECT col1, col2, 'col1 >= col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 >= col2 +); +GO + +CREATE FUNCTION binary_datatype_operators_equal_func() +RETURNS TABLE AS +RETURN( + SELECT col1, col2, 'col1 = col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 = col2 +); +GO + +CREATE FUNCTION binary_datatype_operators_not_equal_func() +RETURNS TABLE AS +RETURN( + SELECT col1, col2, 'col1 <> col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 <> col2 +); +GO + + diff --git a/test/JDBC/expected/binary-datatype-operators-vu-verify.out b/test/JDBC/expected/binary-datatype-operators-vu-verify.out new file mode 100644 index 00000000000..d0f7d278278 --- /dev/null +++ b/test/JDBC/expected/binary-datatype-operators-vu-verify.out @@ -0,0 +1,155 @@ +-- inside view +SELECT * FROM binary_datatype_operators_less_than_view +GO +~~START~~ +binary#!#binary#!#varchar +111111#!#121212#!#col1 < col2 +~~END~~ + + +SELECT * FROM binary_datatype_operators_less_than_equal_view +GO +~~START~~ +binary#!#binary#!#varchar +121212#!#121212#!#col1 <= col2 +111111#!#121212#!#col1 <= col2 +~~END~~ + + +SELECT * FROM binary_datatype_operators_greater_than_view +GO +~~START~~ +binary#!#binary#!#varchar +121212#!#111111#!#col1 > col2 +~~END~~ + + +SELECT * FROM binary_datatype_operators_greater_than_equal_view +GO +~~START~~ +binary#!#binary#!#varchar +121212#!#121212#!#col1 >= col2 +121212#!#111111#!#col1 >= col2 +~~END~~ + + +SELECT * FROM binary_datatype_operators_equal_view +GO +~~START~~ +binary#!#binary#!#varchar +121212#!#121212#!#col1 = col2 +~~END~~ + + +SELECT * FROM binary_datatype_operators_not_equal_view +GO +~~START~~ +binary#!#binary#!#varchar +111111#!#121212#!#col1 <> col2 +121212#!#111111#!#col1 <> col2 +~~END~~ + + +-- inside procedure +EXEC binary_datatype_operators_less_than_proc +GO +~~START~~ +binary#!#binary#!#varchar +111111#!#121212#!#col1 < col2 +~~END~~ + + +EXEC binary_datatype_operators_less_than_equal_proc +GO +~~START~~ +binary#!#binary#!#varchar +121212#!#121212#!#col1 <= col2 +111111#!#121212#!#col1 <= col2 +~~END~~ + + +EXEC binary_datatype_operators_greater_than_proc +GO +~~START~~ +binary#!#binary#!#varchar +121212#!#111111#!#col1 > col2 +~~END~~ + + +EXEC binary_datatype_operators_greater_than_equal_proc +GO +~~START~~ +binary#!#binary#!#varchar +121212#!#121212#!#col1 >= col2 +121212#!#111111#!#col1 >= col2 +~~END~~ + + +EXEC binary_datatype_operators_equal_proc +GO +~~START~~ +binary#!#binary#!#varchar +121212#!#121212#!#col1 = col2 +~~END~~ + + +EXEC binary_datatype_operators_not_equal_proc +GO +~~START~~ +binary#!#binary#!#varchar +111111#!#121212#!#col1 <> col2 +121212#!#111111#!#col1 <> col2 +~~END~~ + + +-- inside function +SELECT * FROM binary_datatype_operators_less_than_func() +GO +~~START~~ +binary#!#binary#!#varchar +11#!#12#!#col1 < col2 +~~END~~ + + +SELECT * FROM binary_datatype_operators_less_than_equal_func() +GO +~~START~~ +binary#!#binary#!#varchar +12#!#12#!#col1 <= col2 +11#!#12#!#col1 <= col2 +~~END~~ + + +SELECT * FROM binary_datatype_operators_greater_than_func() +GO +~~START~~ +binary#!#binary#!#varchar +12#!#11#!#col1 > col2 +~~END~~ + + +SELECT * FROM binary_datatype_operators_greater_than_equal_func() +GO +~~START~~ +binary#!#binary#!#varchar +12#!#12#!#col1 >= col2 +12#!#11#!#col1 >= col2 +~~END~~ + + +SELECT * FROM binary_datatype_operators_equal_func() +GO +~~START~~ +binary#!#binary#!#varchar +12#!#12#!#col1 = col2 +~~END~~ + + +SELECT * FROM binary_datatype_operators_not_equal_func() +GO +~~START~~ +binary#!#binary#!#varchar +11#!#12#!#col1 <> col2 +12#!#11#!#col1 <> col2 +~~END~~ + diff --git a/test/JDBC/expected/catalogs_dbo_sys_schema-upgrade-vu-cleanup.out b/test/JDBC/expected/catalogs_dbo_sys_schema-upgrade-vu-cleanup.out new file mode 100644 index 00000000000..469dde7a5d8 --- /dev/null +++ b/test/JDBC/expected/catalogs_dbo_sys_schema-upgrade-vu-cleanup.out @@ -0,0 +1,42 @@ +use master +go +drop database myschematest_mydb +go +use master +go +drop table tb_myschematest_master +go +drop type type_myschematest_master +go +drop user user_myschematest_master +go +drop schema myschema +go +drop procedure p_myschematest +go +drop view vw_myschematest +go +use tempdb +go +drop table tb_myschematest_tempdb +go +drop type type_myschematest_tempdb +go +drop user user_myschematest_tempdb +go +drop schema myschema +go +drop procedure p_myschematest +go +drop view vw_myschematest +go +use master +go +drop login login_myschematest_master +go +drop login login_myschematest_tempdb +go +drop login login_myschematest_mydb +go + + diff --git a/test/JDBC/expected/catalogs_dbo_sys_schema-upgrade-vu-prepare.out b/test/JDBC/expected/catalogs_dbo_sys_schema-upgrade-vu-prepare.out new file mode 100644 index 00000000000..292075bfbc2 --- /dev/null +++ b/test/JDBC/expected/catalogs_dbo_sys_schema-upgrade-vu-prepare.out @@ -0,0 +1,295 @@ +use master +go +create database myschematest_mydb +go +create login login_myschematest_master with password = '12345678' +go +create login login_myschematest_tempdb with password = '12345678' +go +create login login_myschematest_mydb with password = '12345678' +go + +use master +go +create table tb_myschematest_master(col_master int) +go +create type type_myschematest_master from int +go +create user user_myschematest_master for login login_myschematest_master +go +create schema myschema +go +create procedure p_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +create view vw_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' +union +select name from .sysdatabases where name = 'myschematest_mydb' +union +select name from ..sysdatabases where name = 'myschematest_mydb' +union +select name from ...sysdatabases where name = 'myschematest_mydb' +union +select name from dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from master..sysdatabases where name = 'myschematest_mydb' +union +select name from .master..sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +go + +use tempdb +go +create table tb_myschematest_tempdb(col_tempdb int) +go +create type type_myschematest_tempdb from int +go +create user user_myschematest_tempdb for login login_myschematest_tempdb +go +create schema myschema +go +create procedure p_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +create view vw_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' +union +select name from .sysdatabases where name = 'myschematest_mydb' +union +select name from ..sysdatabases where name = 'myschematest_mydb' +union +select name from ...sysdatabases where name = 'myschematest_mydb' +union +select name from dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from master..sysdatabases where name = 'myschematest_mydb' +union +select name from .master..sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +go + +use myschematest_mydb +go +create table dbo.tb_myschematest_mydb(col_mydb varchar(40)) +insert dbo.tb_myschematest_mydb values ('dbo.tb_myschematest_mydb') +go +~~ROW COUNT: 1~~ + +grant select on dbo.tb_myschematest_mydb to public +go +create type type_myschematest_mydb from int +go +create schema myschema +go +create table myschema.tb_myschematest_mydb(col_myschema varchar(40)) +insert myschema.tb_myschematest_mydb values ('myschema.tb_myschematest_mydb') +go +~~ROW COUNT: 1~~ + +grant select on myschema.tb_myschematest_mydb to public +go +create user user_myschematest_mydb for login login_myschematest_mydb with default_schema = myschema +go +create procedure p_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +create view vw_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' +union +select name from .sysdatabases where name = 'myschematest_mydb' +union +select name from ..sysdatabases where name = 'myschematest_mydb' +union +select name from ...sysdatabases where name = 'myschematest_mydb' +union +select name from dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from master..sysdatabases where name = 'myschematest_mydb' +union +select name from .master..sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +go diff --git a/test/JDBC/expected/catalogs_dbo_sys_schema-upgrade-vu-verify.out b/test/JDBC/expected/catalogs_dbo_sys_schema-upgrade-vu-verify.out new file mode 100644 index 00000000000..6b3d658a5f2 --- /dev/null +++ b/test/JDBC/expected/catalogs_dbo_sys_schema-upgrade-vu-verify.out @@ -0,0 +1,7724 @@ +-- Note: this test is identical to catalogs_dbo_sys_schema, but has different output in 3 places for negative tests +-- since these upgrade tests report the schema name for a not-found object from PG perspective, while the regular +-- tests report the T-SQL schema name +use master +go +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select distinct type from syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from ..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from ...syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from ..dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from master.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .master.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from master.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .master.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from master..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .master..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from tempdb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .tempdb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from tempdb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .tempdb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from tempdb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .tempdb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from myschematest_mydb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .myschematest_mydb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from myschematest_mydb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .myschematest_mydb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from myschematest_mydb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .myschematest_mydb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select top 3 config from sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ...sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ...syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 alias from syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from ..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from ...syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from ..dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from master.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .master.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from master.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .master.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from master..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .master..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from tempdb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .tempdb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from tempdb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .tempdb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from tempdb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .tempdb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from myschematest_mydb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .myschematest_mydb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from myschematest_mydb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .myschematest_mydb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from myschematest_mydb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .myschematest_mydb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select name from syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from ..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from ...syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from ..dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from master..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .master..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select 0 from sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ...sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select object_name(id) from syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from ..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from ...syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from ..dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select 0 from sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ...sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select object_name(id) from sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from ..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from ...sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from ..dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_name(id) from sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from ..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from ...sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from ..dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select schema_name(uid), object_name(id) from myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select name from systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from ..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from ...systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from ..dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from master..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .master..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from ..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from ...sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from ..dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from master..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .master..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +exec p_myschematest +go +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from vw_myschematest order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + + +-- non-catalog table +select * from master..tb_myschematest_master +go +~~START~~ +int +~~END~~ + +select * from .master..tb_myschematest_master +go +~~START~~ +int +~~END~~ + +go +select * from master.dbo.tb_myschematest_master +go +~~START~~ +int +~~END~~ + +select * from .master.dbo.tb_myschematest_master +go +~~START~~ +int +~~END~~ + + +select * from tempdb..tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + +select * from .tempdb..tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + +go +select * from tempdb.dbo.tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + +select * from .tempdb.dbo.tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + + +select * from myschematest_mydb..tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + +select * from .myschematest_mydb..tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + +go +select * from myschematest_mydb.dbo.tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + +select * from .myschematest_mydb.dbo.tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + + +-- negative tests +select count(*) from master.myschema.sysobjects +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "master_myschema.sysobjects" does not exist)~~ + +select count(*) from tempdb.myschema.sysobjects +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "tempdb_myschema.sysobjects" does not exist)~~ + +select count(*) from myschematest_mydb.myschema.sysobjects +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "myschematest_mydb_myschema.sysobjects" does not exist)~~ + + + +use tempdb +go +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select distinct type from syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from ..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from ...syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from ..dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from master.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .master.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from master.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .master.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from master..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .master..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from tempdb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .tempdb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from tempdb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .tempdb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from tempdb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .tempdb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from myschematest_mydb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .myschematest_mydb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from myschematest_mydb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .myschematest_mydb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from myschematest_mydb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .myschematest_mydb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select top 3 config from sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ...sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ...syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 alias from syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from ..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from ...syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from ..dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from master.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .master.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from master.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .master.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from master..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .master..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from tempdb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .tempdb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from tempdb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .tempdb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from tempdb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .tempdb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from myschematest_mydb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .myschematest_mydb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from myschematest_mydb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .myschematest_mydb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from myschematest_mydb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .myschematest_mydb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select name from syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from ..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from ...syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from ..dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from master..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .master..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select 0 from sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ...sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select object_name(id) from syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from ..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from ...syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from ..dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select 0 from sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ...sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select object_name(id) from sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from ..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from ...sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from ..dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_name(id) from sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from ..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from ...sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from ..dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select schema_name(uid), object_name(id) from myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select name from master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from master..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .master..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from master..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .master..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +exec p_myschematest +go +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from vw_myschematest order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + + +-- non-catalog table +select * from master..tb_myschematest_master +go +~~START~~ +int +~~END~~ + +select * from .master..tb_myschematest_master +go +~~START~~ +int +~~END~~ + +go +select * from master.dbo.tb_myschematest_master +go +~~START~~ +int +~~END~~ + +select * from .master.dbo.tb_myschematest_master +go +~~START~~ +int +~~END~~ + + +select * from tempdb..tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + +select * from .tempdb..tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + +go +select * from tempdb.dbo.tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + +select * from .tempdb.dbo.tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + + +select * from myschematest_mydb..tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + +select * from .myschematest_mydb..tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + +go +select * from myschematest_mydb.dbo.tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + +select * from .myschematest_mydb.dbo.tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + + +-- negative tests +select count(*) from master.myschema.sysobjects +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "master_myschema.sysobjects" does not exist)~~ + +select count(*) from tempdb.myschema.sysobjects +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "tempdb_myschema.sysobjects" does not exist)~~ + +select count(*) from myschematest_mydb.myschema.sysobjects +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "myschematest_mydb_myschema.sysobjects" does not exist)~~ + + +use myschematest_mydb +go +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select distinct type from syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from ..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from ...syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from ..dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from master.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .master.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from master.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .master.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from master..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .master..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from tempdb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .tempdb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from tempdb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .tempdb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from tempdb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .tempdb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from myschematest_mydb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .myschematest_mydb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from myschematest_mydb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .myschematest_mydb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from myschematest_mydb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .myschematest_mydb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select top 3 config from sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ...sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ...syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 alias from syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from ..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from ...syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from ..dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from master.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .master.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from master.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .master.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from master..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .master..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from tempdb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .tempdb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from tempdb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .tempdb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from tempdb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .tempdb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from myschematest_mydb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .myschematest_mydb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from myschematest_mydb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .myschematest_mydb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from myschematest_mydb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .myschematest_mydb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select name from syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from ..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from ...syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from ..dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from master..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .master..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select 0 from sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ...sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ...syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ..dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_name(id) from master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select 0 from sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ...sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ...sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ..dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_name(id) from master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from ..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from ...sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from ..dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_name(id) from master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select schema_name(uid), object_name(id) from myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select name from systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from ..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from ...systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from ..dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from master..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .master..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from ..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from ...sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from ..dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from master..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .master..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +exec p_myschematest +go +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from vw_myschematest order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + + +-- non-catalog table +select * from master..tb_myschematest_master +go +~~START~~ +int +~~END~~ + +select * from .master..tb_myschematest_master +go +~~START~~ +int +~~END~~ + +go +select * from master.dbo.tb_myschematest_master +go +~~START~~ +int +~~END~~ + +select * from .master.dbo.tb_myschematest_master +go +~~START~~ +int +~~END~~ + + +select * from tempdb..tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + +select * from .tempdb..tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + +go +select * from tempdb.dbo.tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + +select * from .tempdb.dbo.tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + + +select * from myschematest_mydb..tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + +select * from .myschematest_mydb..tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + +go +select * from myschematest_mydb.dbo.tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + +select * from .myschematest_mydb.dbo.tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + + +-- negative tests +select count(*) from master.myschema.sysobjects +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "master_myschema.sysobjects" does not exist)~~ + +select count(*) from tempdb.myschema.sysobjects +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "tempdb_myschema.sysobjects" does not exist)~~ + +select count(*) from myschematest_mydb.myschema.sysobjects +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "myschematest_mydb_myschema.sysobjects" does not exist)~~ + + diff --git a/test/JDBC/expected/catalogs_dbo_sys_schema-vu-cleanup.out b/test/JDBC/expected/catalogs_dbo_sys_schema-vu-cleanup.out new file mode 100644 index 00000000000..469dde7a5d8 --- /dev/null +++ b/test/JDBC/expected/catalogs_dbo_sys_schema-vu-cleanup.out @@ -0,0 +1,42 @@ +use master +go +drop database myschematest_mydb +go +use master +go +drop table tb_myschematest_master +go +drop type type_myschematest_master +go +drop user user_myschematest_master +go +drop schema myschema +go +drop procedure p_myschematest +go +drop view vw_myschematest +go +use tempdb +go +drop table tb_myschematest_tempdb +go +drop type type_myschematest_tempdb +go +drop user user_myschematest_tempdb +go +drop schema myschema +go +drop procedure p_myschematest +go +drop view vw_myschematest +go +use master +go +drop login login_myschematest_master +go +drop login login_myschematest_tempdb +go +drop login login_myschematest_mydb +go + + diff --git a/test/JDBC/expected/catalogs_dbo_sys_schema-vu-prepare.out b/test/JDBC/expected/catalogs_dbo_sys_schema-vu-prepare.out new file mode 100644 index 00000000000..a0a421f87ef --- /dev/null +++ b/test/JDBC/expected/catalogs_dbo_sys_schema-vu-prepare.out @@ -0,0 +1,297 @@ +use master +go +create database myschematest_mydb +go +create login login_myschematest_master with password = '12345678' +go +create login login_myschematest_tempdb with password = '12345678' +go +create login login_myschematest_mydb with password = '12345678' +go + +use master +go +create table tb_myschematest_master(col_master int) +go +create type type_myschematest_master from int +go +create user user_myschematest_master for login login_myschematest_master +go +create schema myschema +go +create procedure p_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +create view vw_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' +union +select name from .sysdatabases where name = 'myschematest_mydb' +union +select name from ..sysdatabases where name = 'myschematest_mydb' +union +select name from ...sysdatabases where name = 'myschematest_mydb' +union +select name from dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from master..sysdatabases where name = 'myschematest_mydb' +union +select name from .master..sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +go + +use tempdb +go +create table tb_myschematest_tempdb(col_tempdb int) +go +create type type_myschematest_tempdb from int +go +create user user_myschematest_tempdb for login login_myschematest_tempdb +go +create schema myschema +go +create procedure p_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +create view vw_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' +union +select name from .sysdatabases where name = 'myschematest_mydb' +union +select name from ..sysdatabases where name = 'myschematest_mydb' +union +select name from ...sysdatabases where name = 'myschematest_mydb' +union +select name from dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from master..sysdatabases where name = 'myschematest_mydb' +union +select name from .master..sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +go + + +use myschematest_mydb +go +create table dbo.tb_myschematest_mydb(col_mydb varchar(40)) +insert dbo.tb_myschematest_mydb values ('dbo.tb_myschematest_mydb') +go +~~ROW COUNT: 1~~ + +grant select on dbo.tb_myschematest_mydb to public +go +create type type_myschematest_mydb from int +go +create schema myschema +go +create table myschema.tb_myschematest_mydb(col_myschema varchar(40)) +insert myschema.tb_myschematest_mydb values ('myschema.tb_myschematest_mydb') +go +~~ROW COUNT: 1~~ + +grant select on myschema.tb_myschematest_mydb to public +go +create user user_myschematest_mydb for login login_myschematest_mydb with default_schema = myschema +go +create procedure p_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +create view vw_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' +union +select name from .sysdatabases where name = 'myschematest_mydb' +union +select name from ..sysdatabases where name = 'myschematest_mydb' +union +select name from ...sysdatabases where name = 'myschematest_mydb' +union +select name from dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from master..sysdatabases where name = 'myschematest_mydb' +union +select name from .master..sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +go + diff --git a/test/JDBC/expected/catalogs_dbo_sys_schema-vu-verify.out b/test/JDBC/expected/catalogs_dbo_sys_schema-vu-verify.out new file mode 100644 index 00000000000..3e564396864 --- /dev/null +++ b/test/JDBC/expected/catalogs_dbo_sys_schema-vu-verify.out @@ -0,0 +1,7778 @@ +use master +go +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select distinct type from syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from ..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from ...syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from ..dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from master.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .master.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from master.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .master.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from master..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .master..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from tempdb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .tempdb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from tempdb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .tempdb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from tempdb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .tempdb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from myschematest_mydb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .myschematest_mydb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from myschematest_mydb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .myschematest_mydb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from myschematest_mydb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .myschematest_mydb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select top 3 config from sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ...sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ...syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 alias from syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from ..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from ...syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from ..dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from master.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .master.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from master.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .master.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from master..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .master..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from tempdb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .tempdb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from tempdb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .tempdb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from tempdb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .tempdb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from myschematest_mydb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .myschematest_mydb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from myschematest_mydb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .myschematest_mydb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from myschematest_mydb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .myschematest_mydb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select name from syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from ..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from ...syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from ..dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from master..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .master..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select 0 from sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ...sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select object_name(id) from syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from ..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from ...syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from ..dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select 0 from sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ...sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select object_name(id) from sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from ..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from ...sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from ..dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_name(id) from sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from ..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from ...sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from ..dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select schema_name(uid), object_name(id) from myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select name from systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from ..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from ...systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from ..dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from master..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .master..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from ..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from ...sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from ..dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from master..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .master..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +exec p_myschematest +go +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from vw_myschematest order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + + +-- non-catalog table +select * from master..tb_myschematest_master +go +~~START~~ +int +~~END~~ + +select * from .master..tb_myschematest_master +go +~~START~~ +int +~~END~~ + +go +select * from master.dbo.tb_myschematest_master +go +~~START~~ +int +~~END~~ + +select * from .master.dbo.tb_myschematest_master +go +~~START~~ +int +~~END~~ + + +select * from tempdb..tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + +select * from .tempdb..tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + +go +select * from tempdb.dbo.tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + +select * from .tempdb.dbo.tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + + +select * from myschematest_mydb..tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + +select * from .myschematest_mydb..tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + +go +select * from myschematest_mydb.dbo.tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + +select * from .myschematest_mydb.dbo.tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + + +-- negative tests +select count(*) from master.myschema.sysobjects +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "master_myschema.sysobjects" does not exist)~~ + +select count(*) from tempdb.myschema.sysobjects +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "tempdb_myschema.sysobjects" does not exist)~~ + +select count(*) from myschematest_mydb.myschema.sysobjects +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "myschema.sysobjects" does not exist)~~ + + + +use tempdb +go +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select distinct type from syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from ..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from ...syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from ..dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from master.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .master.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from master.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .master.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from master..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .master..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from tempdb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .tempdb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from tempdb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .tempdb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from tempdb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .tempdb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from myschematest_mydb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .myschematest_mydb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from myschematest_mydb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .myschematest_mydb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from myschematest_mydb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .myschematest_mydb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select top 3 config from sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ...sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ...syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 alias from syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from ..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from ...syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from ..dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from master.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .master.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from master.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .master.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from master..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .master..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from tempdb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .tempdb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from tempdb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .tempdb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from tempdb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .tempdb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from myschematest_mydb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .myschematest_mydb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from myschematest_mydb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .myschematest_mydb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from myschematest_mydb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .myschematest_mydb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select name from syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from ..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from ...syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from ..dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from master..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .master..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select 0 from sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ...sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select object_name(id) from syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from ..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from ...syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from ..dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select 0 from sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ...sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select object_name(id) from sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from ..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from ...sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from ..dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_name(id) from sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from ..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from ...sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from ..dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select schema_name(uid), object_name(id) from myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select name from master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from master..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .master..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from master..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .master..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +exec p_myschematest +go +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from vw_myschematest order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + + +-- non-catalog table +select * from master..tb_myschematest_master +go +~~START~~ +int +~~END~~ + +select * from .master..tb_myschematest_master +go +~~START~~ +int +~~END~~ + +go +select * from master.dbo.tb_myschematest_master +go +~~START~~ +int +~~END~~ + +select * from .master.dbo.tb_myschematest_master +go +~~START~~ +int +~~END~~ + + +select * from tempdb..tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + +select * from .tempdb..tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + +go +select * from tempdb.dbo.tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + +select * from .tempdb.dbo.tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + + +select * from myschematest_mydb..tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + +select * from .myschematest_mydb..tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + +go +select * from myschematest_mydb.dbo.tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + +select * from .myschematest_mydb.dbo.tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + + +-- negative tests +select count(*) from master.myschema.sysobjects +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "master_myschema.sysobjects" does not exist)~~ + +select count(*) from tempdb.myschema.sysobjects +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "tempdb_myschema.sysobjects" does not exist)~~ + +select count(*) from myschematest_mydb.myschema.sysobjects +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "myschema.sysobjects" does not exist)~~ + + +use myschematest_mydb +go +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + +select distinct type from syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from ..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from ...syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from ..dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from master.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .master.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from master.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .master.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from master..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .master..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from tempdb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .tempdb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from tempdb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .tempdb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from tempdb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .tempdb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from myschematest_mydb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .myschematest_mydb.dbo.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from myschematest_mydb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .myschematest_mydb.sys.syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from myschematest_mydb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select distinct type from .myschematest_mydb..syscharsets order by 1 +go +~~START~~ +int +1001 +~~END~~ + +select top 3 config from sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ...sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.dbo.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.sys.sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb..sysconfigures order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ...syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from ..dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from master..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .master..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from tempdb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .tempdb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.dbo.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb.sys.syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from myschematest_mydb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 config from .myschematest_mydb..syscurconfigs order by 1 +go +~~START~~ +int +115 +124 +1126 +~~END~~ + +select top 3 alias from syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from ..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from ...syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from ..dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from master.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .master.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from master.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .master.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from master..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .master..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from tempdb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .tempdb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from tempdb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .tempdb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from tempdb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .tempdb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from myschematest_mydb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .myschematest_mydb.dbo.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from myschematest_mydb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .myschematest_mydb.sys.syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from myschematest_mydb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select top 3 alias from .myschematest_mydb..syslanguages order by 1 +go +~~START~~ +varchar +ARABIC +ARABIC (ALGERIA) +ARABIC (BAHRAIN) +~~END~~ + +select name from syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from ..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from ...syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from ..dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from master..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .master..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select name from .myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +~~START~~ +varchar +login_myschematest_master +login_myschematest_mydb +login_myschematest_tempdb +~~END~~ + +select 0 from sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ...sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ...syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ..dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_name(id) from master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select 0 from sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ...sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from ..dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from master..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .master..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from tempdb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .tempdb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select 0 from .myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +~~START~~ +int +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ...sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ..dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_name(id) from master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from ..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from ...sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from ..dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select object_name(id) from master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from .master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_master +~~END~~ + +select object_name(id) from tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select object_name(id) from .tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +~~START~~ +varchar +tb_myschematest_tempdb +~~END~~ + +select schema_name(uid), object_name(id) from myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select schema_name(uid), object_name(id) from .myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +~~START~~ +varchar#!#varchar +dbo#!#tb_myschematest_mydb +myschema#!#tb_myschematest_mydb +~~END~~ + +select name from systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from ..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from ...systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from ..dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from master..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from .master..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_master +~~END~~ + +select name from myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +~~START~~ +varchar +type_myschematest_mydb +~~END~~ + +select name from sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from ..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from ...sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from ..dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from master..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from .master..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_master +~~END~~ + +select name from myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +select name from .myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +~~START~~ +varchar +user_myschematest_mydb +~~END~~ + +exec p_myschematest +go +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +~~START~~ +text +myschematest_mydb +~~END~~ + +select name from vw_myschematest order by 1 +go +~~START~~ +text +myschematest_mydb +~~END~~ + + +-- non-catalog table +select * from master..tb_myschematest_master +go +~~START~~ +int +~~END~~ + +select * from .master..tb_myschematest_master +go +~~START~~ +int +~~END~~ + +go +select * from master.dbo.tb_myschematest_master +go +~~START~~ +int +~~END~~ + +select * from .master.dbo.tb_myschematest_master +go +~~START~~ +int +~~END~~ + + +select * from tempdb..tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + +select * from .tempdb..tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + +go +select * from tempdb.dbo.tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + +select * from .tempdb.dbo.tb_myschematest_tempdb +go +~~START~~ +int +~~END~~ + + +select * from myschematest_mydb..tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + +select * from .myschematest_mydb..tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + +go +select * from myschematest_mydb.dbo.tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + +select * from .myschematest_mydb.dbo.tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + + +-- negative tests +select count(*) from master.myschema.sysobjects +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "master_myschema.sysobjects" does not exist)~~ + +select count(*) from tempdb.myschema.sysobjects +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "tempdb_myschema.sysobjects" does not exist)~~ + +select count(*) from myschematest_mydb.myschema.sysobjects +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "myschema.sysobjects" does not exist)~~ + + + +-- test for correct resolution of 'object' and '.object' notation in case of a non-dbo default schema +go +-- tsql user=login_myschematest_mydb password=12345678 +use myschematest_mydb +go +select db_name(), user_name(), suser_name() +go +~~START~~ +nvarchar#!#nvarchar#!#nvarchar +myschematest_mydb#!#user_myschematest_mydb#!#login_myschematest_mydb +~~END~~ + + +-- CORRECT: should resolve to dbo.tb_myschematest_mydb +select * from dbo.tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + + +-- CORRECT: should resolve to myschema.tb_myschematest_mydb +select * from tb_myschematest_mydb +go +~~START~~ +varchar +myschema.tb_myschematest_mydb +~~END~~ + + +-- CORRECT: should resolve to myschema.tb_myschematest_mydb +select * from .tb_myschematest_mydb +go +~~START~~ +varchar +myschema.tb_myschematest_mydb +~~END~~ + + +-- WRONG: should resolve to myschema.tb_myschematest_mydb but currently (incorrectly) resolves to dbo.tb_myschematest_mydb +-- this needs to be addressed in a different fix, for BABEL-5050 +select * from myschematest_mydb..tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + +select * from .myschematest_mydb..tb_myschematest_mydb +go +~~START~~ +varchar +dbo.tb_myschematest_mydb +~~END~~ + diff --git a/test/JDBC/expected/charindex_and_replace_CIAI_collations.out b/test/JDBC/expected/charindex_and_replace_CIAI_collations.out new file mode 100644 index 00000000000..c41f32a9601 --- /dev/null +++ b/test/JDBC/expected/charindex_and_replace_CIAI_collations.out @@ -0,0 +1,732 @@ + +-- tsql +/* CHARINDEX WITH CI_AI COLLATIONS */ +CREATE TABLE #BABEL_4850_TEMP(id NVARCHAR(100)) +GO +CREATE TABLE BABEL_4850_T(id NVARCHAR(100)) +GO + +INSERT INTO #BABEL_4850_TEMP VALUES ('AAAAAE'), ('AeAAAaE'), ('AeAAAaE'), ('AAAAAABBBBBBBEEEEEEAAAAA') +INSERT INTO BABEL_4850_T VALUES ('AAAAAE'), ('AeAAAaE'), ('AeAAAaE'), ('AAAAAABBBBBBBEEEEEEAAAAA') +GO +~~ROW COUNT: 4~~ + +~~ROW COUNT: 4~~ + + + +/* CI_AS */ +/* Cases where single character is equal to two characters */ +SELECT CHARINDEX('Æ','AAAAAE' COLLATE Latin1_General_CI_AI) +SELECT CHARINDEX('Æ','AeAAAaE' COLLATE Latin1_General_CI_AI, 2) +SELECT CHARINDEX('Æ','AeAAAaE' COLLATE Latin1_General_CI_AI, 1) +SELECT CHARINDEX('Æ', 'AAAAAABBBBBBBEEEEEEAAAAA' COLLATE Latin1_General_CI_AI); +SELECT CHARINDEX('ÆA','AeAEAAAAaE' COLLATE Latin1_General_CI_AI, 1) +GO +~~START~~ +int +5 +~~END~~ + +~~START~~ +int +6 +~~END~~ + +~~START~~ +int +1 +~~END~~ + +~~START~~ +int +0 +~~END~~ + +~~START~~ +int +1 +~~END~~ + + +SELECT CHARINDEX('Æ', id COLLATE Latin1_General_CI_AI) FROM #BABEL_4850_TEMP +GO +~~START~~ +int +5 +1 +1 +0 +~~END~~ + +SELECT CHARINDEX('Æ', id COLLATE Latin1_General_CI_AI) FROM BABEL_4850_T +GO +~~START~~ +int +5 +1 +1 +0 +~~END~~ + + +/* BASIC TEST CASES */ +/* These should find a result */ +SELECT CHARINDEX('cat', 'The cat is on the mat' COLLATE Latin1_General_CI_AI, 1); +SELECT CHARINDEX('cafe', 'The Café is cozy' COLLATE Latin1_General_CI_AI, 1); +/* These should not find a result */ +SELECT CHARINDEX('dog', 'The cat is on the mat' COLLATE Latin1_General_CI_AI, 1); +SELECT CHARINDEX('caé', 'The café is cozy' COLLATE Latin1_General_CI_AI, 1); +GO +~~START~~ +int +5 +~~END~~ + +~~START~~ +int +5 +~~END~~ + +~~START~~ +int +0 +~~END~~ + +~~START~~ +int +0 +~~END~~ + + +/* empty arguments */ +SELECT CHARINDEX('', 'The café is cozy' COLLATE Latin1_General_CI_AI, 1); +SELECT CHARINDEX('café', '' COLLATE Latin1_General_CI_AI, 1); +SELECT CHARINDEX('', '' COLLATE Latin1_General_CI_AI, 1) +GO +~~START~~ +int +0 +~~END~~ + +~~START~~ +int +0 +~~END~~ + +~~START~~ +int +0 +~~END~~ + + +/* case sensitivity */ +SELECT CHARINDEX('tHe Cať', 'Where is The càt ???' COLLATE Latin1_General_CI_AI); +SELECT CHARINDEX('caT', 'The Cat̤ is on the mat' COLLATE Latin1_General_CI_AI); +GO +~~START~~ +int +10 +~~END~~ + +~~START~~ +int +5 +~~END~~ + + +SELECT CHARINDEX('cat', 'The cat is on the mat cAť' COLLATE Latin1_General_CI_AI, 6) +SELECT CHARINDEX('cat', 'The cat is on the mat' COLLATE Latin1_General_CI_AI, 30) +GO +~~START~~ +int +23 +~~END~~ + +~~START~~ +int +0 +~~END~~ + + + +/* REPLACE WITH CI_AI COLLATIONS */ +/* BASIC TEST CASES */ +/* These should find a result */ +SELECT REPLACE('This café is cozy.', 'café', 'coffee' COLLATE Latin1_General_CI_AI) +SELECT REPLACE('The café is open for business.', 'café is', 'coffee shops are' COLLATE Latin1_General_CI_AI) +SELECT REPLACE('This café is cozy.', 'tea', 'coffee' COLLATE Latin1_General_CI_AI) +SELECT REPLACE('The café serves café au lait.', 'café', 'coffee' COLLATE Latin1_General_CI_AI) +GO +~~START~~ +varchar +This coffee is cozy. +~~END~~ + +~~START~~ +varchar +The coffee shops are open for business. +~~END~~ + +~~START~~ +varchar +This café is cozy. +~~END~~ + +~~START~~ +varchar +The coffee serves coffee au lait. +~~END~~ + + +SELECT REPLACE('café is cozy.', 'café', 'coffee' COLLATE Latin1_General_CI_AI) +SELECT REPLACE('The café is good.', 'is', 'was' COLLATE Latin1_General_CI_AI) +GO +~~START~~ +varchar +coffee is cozy. +~~END~~ + +~~START~~ +varchar +The café was good. +~~END~~ + + +SELECT REPLACE(REPLACE('The café is open.', 'café', 'coffee' COLLATE Latin1_General_CI_AI), 'open', 'closed' COLLATE Latin1_General_CI_AI) +GO +~~START~~ +varchar +The coffee is closed. +~~END~~ + + +SELECT REPLACE('The café is great.', 'gřeat', N'>>>>>>' COLLATE Latin1_General_CI_AI) +SELECT REPLACE('This café is cozy.', 'café', N'cAfë' COLLATE Latin1_General_CI_AI) +GO +~~START~~ +nvarchar +The café is >>>>>>. +~~END~~ + +~~START~~ +nvarchar +This cAfë is cozy. +~~END~~ + + +SELECT REPLACE('This café is cozy.', '', 'coffee' COLLATE Latin1_General_CI_AI) +SELECT REPLACE('', '', 'coffee' COLLATE Latin1_General_CI_AI) +SELECT REPLACE('This café is cozy.', 'café', '' COLLATE Latin1_General_CI_AI) +GO +~~START~~ +varchar +This café is cozy. +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar +This is cozy. +~~END~~ + + +SELECT REPLACE('This café is cozy.', 'CAFÉ', 'coffee' COLLATE Latin1_General_CI_AI) +GO +~~START~~ +varchar +This coffee is cozy. +~~END~~ + + +SELECT REPLACE('This café is café.', 'café', 'coffee' COLLATE Latin1_General_CI_AI) +GO +~~START~~ +varchar +This coffee is coffee. +~~END~~ + + +SELECT REPLACE('This café is !.', '!', 'coffee' COLLATE Latin1_General_CI_AI) +GO +~~START~~ +varchar +This café is coffee. +~~END~~ + + +SELECT REPLACE('This café is cozy.', ' ', ' ' COLLATE Latin1_General_CI_AI) +SELECT REPLACE(N'The café is!.', '!', '@@' COLLATE Latin1_General_CI_AI) +GO +~~START~~ +varchar +This café is cozy. +~~END~~ + +~~START~~ +nvarchar +The café is@@. +~~END~~ + + +/* overlapping case */ +SELECT REPLACE ('ABCABCABCABCABC','abcÀBć' collate Latin1_General_CI_AI, 'abcabc') +GO +~~START~~ +varchar +abcabcabcabcABC +~~END~~ + + +/* Cases where single character is equal to two characters */ +SELECT REPLACE ('aaaaaaÆaaaaaaÆaaaa','AE' collate Latin1_General_CI_AI, '!---!') +SELECT REPLACE ('ÆAEaaaaaaÆ','AE' collate Latin1_General_CI_AI, '!---!') +SELECT REPLACE ('eeeeeeeeeAAAAAA','AE' collate Latin1_General_CI_AI, '!---!') +GO +~~START~~ +varchar +aaaaaa!---!aaaaaa!---!aaaa +~~END~~ + +~~START~~ +varchar +!---!!---!aaaaaa!---! +~~END~~ + +~~START~~ +varchar +eeeeeeeeeAAAAAA +~~END~~ + + +SELECT REPLACE(id, 'Æ' COLLATE Latin1_General_CI_AI, '!---!') FROM #BABEL_4850_TEMP +GO +~~START~~ +nvarchar +AAAA!---! +!---!AAA!---! +!---!AAA!---! +AAAAAABBBBBBBEEEEEEAAAAA +~~END~~ + +SELECT REPLACE(id, 'Æ' COLLATE Latin1_General_CI_AI, '!---!') FROM BABEL_4850_T +GO +~~START~~ +nvarchar +AAAA!---! +!---!AAA!---! +!---!AAA!---! +AAAAAABBBBBBBEEEEEEAAAAA +~~END~~ + + + + + + + +/* CS_AS */ +/* CHARINDEX WITH CS_AI COLLATIONS */ +SELECT CHARINDEX('Æ', id COLLATE Latin1_General_CS_AI) FROM #BABEL_4850_TEMP +GO +~~START~~ +int +5 +0 +0 +0 +~~END~~ + +SELECT CHARINDEX('Æ', id COLLATE Latin1_General_CS_AI) FROM BABEL_4850_T +GO +~~START~~ +int +5 +0 +0 +0 +~~END~~ + + +/* Cases where single character is equal to two characters */ +SELECT CHARINDEX('Æ','AAAAAE' COLLATE Latin1_General_CS_AI) +SELECT CHARINDEX('Æ','AeAAAaE' COLLATE Latin1_General_CS_AI, 2) +SELECT CHARINDEX('Æ','AeAAAaE' COLLATE Latin1_General_CS_AI, 1) +SELECT CHARINDEX('Æ', 'AAAAAABBBBBBBEEEEEEAAAAA' COLLATE Latin1_General_CS_AI); +SELECT CHARINDEX('ÆA','AeAEAAAAaE' COLLATE Latin1_General_CS_AI, 1) +GO +~~START~~ +int +5 +~~END~~ + +~~START~~ +int +0 +~~END~~ + +~~START~~ +int +0 +~~END~~ + +~~START~~ +int +0 +~~END~~ + +~~START~~ +int +3 +~~END~~ + + +/* BASIC TEST CASES */ +/* These should find a result */ +SELECT CHARINDEX('cat', 'The cat is on the mat' COLLATE Latin1_General_CS_AI, 1); +SELECT CHARINDEX('cafe', 'The Café is cozy' COLLATE Latin1_General_CS_AI, 1); +/* These should not find a result */ +SELECT CHARINDEX('dog', 'The cat is on the mat' COLLATE Latin1_General_CS_AI, 1); +SELECT CHARINDEX('caé', 'The café is cozy' COLLATE Latin1_General_CS_AI, 1); +GO +~~START~~ +int +5 +~~END~~ + +~~START~~ +int +0 +~~END~~ + +~~START~~ +int +0 +~~END~~ + +~~START~~ +int +0 +~~END~~ + + +/* empty arguments */ +SELECT CHARINDEX('', 'The café is cozy' COLLATE Latin1_General_CS_AI, 1); +SELECT CHARINDEX('café', '' COLLATE Latin1_General_CS_AI, 1); +SELECT CHARINDEX('', '' COLLATE Latin1_General_CS_AI, 1) +GO +~~START~~ +int +0 +~~END~~ + +~~START~~ +int +0 +~~END~~ + +~~START~~ +int +0 +~~END~~ + + +/* case sensitivity */ +SELECT CHARINDEX('tHe Cať', 'Where is The càt ???' COLLATE Latin1_General_CS_AI); +SELECT CHARINDEX('caT', 'The Cat̤ is on the mat' COLLATE Latin1_General_CS_AI); +GO +~~START~~ +int +0 +~~END~~ + +~~START~~ +int +0 +~~END~~ + + +SELECT CHARINDEX('cat', 'The cat is on the mat cAť' COLLATE Latin1_General_CS_AI, 6) +SELECT CHARINDEX('cat', 'The cat is on the mat' COLLATE Latin1_General_CS_AI, 30) +GO +~~START~~ +int +0 +~~END~~ + +~~START~~ +int +0 +~~END~~ + + + +/* REPLACE WITH CS_AI COLLATIONS */ +/* BASIC TEST CASES */ +/* These should find a result */ +SELECT REPLACE('This café is cozy.', 'café', 'coffee' COLLATE Latin1_General_CS_AI) +SELECT REPLACE('The café is open for business.', 'café is', 'coffee shops are' COLLATE Latin1_General_CS_AI) +SELECT REPLACE('This café is cozy.', 'tea', 'coffee' COLLATE Latin1_General_CS_AI) +SELECT REPLACE('The café serves café au lait.', 'café', 'coffee' COLLATE Latin1_General_CS_AI) +GO +~~START~~ +varchar +This coffee is cozy. +~~END~~ + +~~START~~ +varchar +The coffee shops are open for business. +~~END~~ + +~~START~~ +varchar +This café is cozy. +~~END~~ + +~~START~~ +varchar +The coffee serves coffee au lait. +~~END~~ + + +SELECT REPLACE('café is cozy.', 'café', 'coffee' COLLATE Latin1_General_CS_AI) +SELECT REPLACE('The café is good.', 'is', 'was' COLLATE Latin1_General_CS_AI) +GO +~~START~~ +varchar +coffee is cozy. +~~END~~ + +~~START~~ +varchar +The café was good. +~~END~~ + + +SELECT REPLACE(REPLACE('The café is open.', 'café', 'coffee' COLLATE Latin1_General_CS_AI), 'open', 'closed' COLLATE Latin1_General_CS_AI) +GO +~~START~~ +varchar +The coffee is closed. +~~END~~ + + +SELECT REPLACE('The café is great.', 'gřeat', N'>>>>>>' COLLATE Latin1_General_CS_AI) +SELECT REPLACE('This café is cozy.', 'café', N'cAfë' COLLATE Latin1_General_CS_AI) +GO +~~START~~ +nvarchar +The café is >>>>>>. +~~END~~ + +~~START~~ +nvarchar +This cAfë is cozy. +~~END~~ + + +SELECT REPLACE('This café is cozy.', '', 'coffee' COLLATE Latin1_General_CS_AI) +SELECT REPLACE('', '', 'coffee' COLLATE Latin1_General_CS_AI) +SELECT REPLACE('This café is cozy.', 'café', '' COLLATE Latin1_General_CS_AI) +GO +~~START~~ +varchar +This café is cozy. +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar +This is cozy. +~~END~~ + + +SELECT REPLACE('This café is cozy.', 'CAFÉ', 'coffee' COLLATE Latin1_General_CS_AI) +GO +~~START~~ +varchar +This café is cozy. +~~END~~ + + +SELECT REPLACE('This café is café.', 'café', 'coffee' COLLATE Latin1_General_CS_AI) +GO +~~START~~ +varchar +This coffee is coffee. +~~END~~ + + +SELECT REPLACE('This café is !.', '!', 'coffee' COLLATE Latin1_General_CS_AI) +GO +~~START~~ +varchar +This café is coffee. +~~END~~ + + +SELECT REPLACE('This café is cozy.', ' ', ' ' COLLATE Latin1_General_CS_AI) +SELECT REPLACE(N'The café is!.', '!', '@@' COLLATE Latin1_General_CS_AI) +GO +~~START~~ +varchar +This café is cozy. +~~END~~ + +~~START~~ +nvarchar +The café is@@. +~~END~~ + + +/* overlapping case */ +SELECT REPLACE ('ABCABCABCABCABC','abcÀBć' collate Latin1_General_CS_AI, 'abcabc') +GO +~~START~~ +varchar +ABCABCABCABCABC +~~END~~ + + +/* Cases where single character is equal to two characters */ +SELECT REPLACE ('aaaaaaÆaaaaaaÆaaaa','AE' collate Latin1_General_CS_AI, '!---!') +SELECT REPLACE ('ÆAEaaaaaaÆ','AE' collate Latin1_General_CS_AI, '!---!') +SELECT REPLACE ('eeeeeeeeeAAAAAA','AE' collate Latin1_General_CS_AI, '!---!') +GO +~~START~~ +varchar +aaaaaa!---!aaaaaa!---!aaaa +~~END~~ + +~~START~~ +varchar +!---!!---!aaaaaa!---! +~~END~~ + +~~START~~ +varchar +eeeeeeeeeAAAAAA +~~END~~ + + +SELECT REPLACE(id, 'Æ' COLLATE Latin1_General_CS_AI, '!---!') FROM #BABEL_4850_TEMP +GO +~~START~~ +nvarchar +AAAA!---! +AeAAAaE +AeAAAaE +AAAAAABBBBBBBEEEEEEAAAAA +~~END~~ + +SELECT REPLACE(id, 'Æ' COLLATE Latin1_General_CS_AI, '!---!') FROM BABEL_4850_T +GO +~~START~~ +nvarchar +AAAA!---! +AeAAAaE +AeAAAaE +AAAAAABBBBBBBEEEEEEAAAAA +~~END~~ + + +DROP TABLE BABEL_4850_T +GO + +/* Substring to find starts with surrogate pair BABEL-5169 */ +SELECT CHARINDEX(N'🙂dEf', N'abc🙂def🙂defgh🙂dEfi🙂🙂' COLLATE Latin1_General_CS_AI) +SELECT CHARINDEX(N'🙂D', N'abc🙂d🙂d🙂D' COLLATE Latin1_General_CS_AI) +SELECT CHARINDEX(N'🙂dEf', N'abc🙂defgh🙂dEfi🙂🙂' COLLATE Latin1_General_CI_AI) +SELECT CHARINDEX(N'🙂', N'abc🙂defgh🙂dEfi🙂🙂' COLLATE Latin1_General_CS_AI) +SELECT CHARINDEX(N'🙂', N'abc🙂defgh🙂dEfi🙂🙂' COLLATE Latin1_General_CI_AI) +GO +~~START~~ +int +14 +~~END~~ + +~~START~~ +int +8 +~~END~~ + +~~START~~ +int +4 +~~END~~ + +~~START~~ +int +4 +~~END~~ + +~~START~~ +int +4 +~~END~~ + + +/* Substring to find starts with surrogate pair BABEL-5169 */ +SELECT REPLACE(N'abc🙂defghi🙂🙂', N'🙂def', N'jhi🙂' COLLATE Latin1_General_CI_AI) +SELECT REPLACE(N'abc🙂🙂🙂🙂🙂defghi🙂🙂', N'🙂', N'<---->' COLLATE Latin1_General_CI_AI) +SELECT REPLACE(N'abc🙂🙂🙂🙂', N'🙂', N'<---->' COLLATE Latin1_General_CI_AI) +SELECT REPLACE(N'🙂abc🙂', N'🙂', N'<---->' COLLATE Latin1_General_CI_AI) +GO +~~START~~ +nvarchar +abcjhi🙂ghi🙂🙂 +~~END~~ + +~~START~~ +nvarchar +abc<----><----><----><----><---->defghi<----><----> +~~END~~ + +~~START~~ +nvarchar +abc<----><----><----><----> +~~END~~ + +~~START~~ +nvarchar +<---->abc<----> +~~END~~ + + +-- psql +CREATE COLLATION case_insensitive (provider = icu, locale = 'und-u-ks-level2', deterministic = false); +CREATE COLLATION ignore_accents (provider = icu, locale = 'nd-u-kc-true-ks-level1', deterministic = false); +GO + +CREATE TABLE mismatch_col (col1 text COLLATE case_insensitive, col2 text COLLATE ignore_accents, col3 text); +GO + +INSERT INTO mismatch_col VALUES ('abc', 'xyz', 'tde'); +GO +~~ROW COUNT: 1~~ + + +SELECT REPLACE(col1, col2, col3) FROM mismatch_col +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: could not determine which collation to use for string comparison + Hint: Use the COLLATE clause to set the collation explicitly. + Server SQLState: 42P22)~~ + + +DROP TABLE mismatch_col +GO + +DROP COLLATION case_insensitive; +DROP COLLATION ignore_accents; +GO diff --git a/test/JDBC/expected/four-part-names-vu-verify.out b/test/JDBC/expected/four-part-names-vu-verify.out index 679cb963a11..d6680b14e45 100644 --- a/test/JDBC/expected/four-part-names-vu-verify.out +++ b/test/JDBC/expected/four-part-names-vu-verify.out @@ -38,7 +38,7 @@ int#!#varchar SELECT * FROM bbf_fpn_server.master.sys.data_spaces GO ~~START~~ -varchar#!#int#!#char#!#nvarchar#!#bit#!#bit +nvarchar#!#int#!#char#!#nvarchar#!#bit#!#bit PRIMARY#!#1#!#FG#!#ROWS_FILEGROUP#!#1#!#0 ~~END~~ @@ -59,7 +59,7 @@ int#!#varchar SELECT * FROM bbf_fpn_server..sys.data_spaces GO ~~START~~ -varchar#!#int#!#char#!#nvarchar#!#bit#!#bit +nvarchar#!#int#!#char#!#nvarchar#!#bit#!#bit PRIMARY#!#1#!#FG#!#ROWS_FILEGROUP#!#1#!#0 ~~END~~ @@ -68,7 +68,7 @@ PRIMARY#!#1#!#FG#!#ROWS_FILEGROUP#!#1#!#0 SELECT a*2, REVERSE(b) FROM bbf_fpn_server...fpn_table GO ~~START~~ -int#!#text +int#!#varchar 2#!#eno 4#!#owt 6#!#eerht diff --git a/test/JDBC/expected/latest__verification_cleanup__13_6__sys-host_name-vu-verify.out b/test/JDBC/expected/latest__verification_cleanup__13_6__sys-host_name-vu-verify.out index 2ea0477de3f..6eb09724dba 100644 --- a/test/JDBC/expected/latest__verification_cleanup__13_6__sys-host_name-vu-verify.out +++ b/test/JDBC/expected/latest__verification_cleanup__13_6__sys-host_name-vu-verify.out @@ -77,7 +77,7 @@ us_english#!#a_nice_workstation_name#!#131592#!#Microsoft JDBC Driver #!#Microso EXECUTE sys_host_name_vu_prepare__dm_exec_sessions_proc GO ~~START~~ -nvarchar#!#nvarchar#!#int#!#text#!#nvarchar#!#nvarchar#!#smallint +nvarchar#!#nvarchar#!#int#!#nvarchar#!#nvarchar#!#nvarchar#!#smallint us_english#!#a_nice_workstation_name#!#131592#!#Microsoft JDBC Driver #!#Microsoft JDBC Driver for SQL Server#!#ymd#!#7 ~~END~~ diff --git a/test/JDBC/expected/latest__verification_cleanup__13_7__sys-host_name-vu-verify.out b/test/JDBC/expected/latest__verification_cleanup__13_7__sys-host_name-vu-verify.out index 2ea0477de3f..6eb09724dba 100644 --- a/test/JDBC/expected/latest__verification_cleanup__13_7__sys-host_name-vu-verify.out +++ b/test/JDBC/expected/latest__verification_cleanup__13_7__sys-host_name-vu-verify.out @@ -77,7 +77,7 @@ us_english#!#a_nice_workstation_name#!#131592#!#Microsoft JDBC Driver #!#Microso EXECUTE sys_host_name_vu_prepare__dm_exec_sessions_proc GO ~~START~~ -nvarchar#!#nvarchar#!#int#!#text#!#nvarchar#!#nvarchar#!#smallint +nvarchar#!#nvarchar#!#int#!#nvarchar#!#nvarchar#!#nvarchar#!#smallint us_english#!#a_nice_workstation_name#!#131592#!#Microsoft JDBC Driver #!#Microsoft JDBC Driver for SQL Server#!#ymd#!#7 ~~END~~ diff --git a/test/JDBC/expected/latest__verification_cleanup__13_8__sys-host_name-vu-verify.out b/test/JDBC/expected/latest__verification_cleanup__13_8__sys-host_name-vu-verify.out index 2ea0477de3f..6eb09724dba 100644 --- a/test/JDBC/expected/latest__verification_cleanup__13_8__sys-host_name-vu-verify.out +++ b/test/JDBC/expected/latest__verification_cleanup__13_8__sys-host_name-vu-verify.out @@ -77,7 +77,7 @@ us_english#!#a_nice_workstation_name#!#131592#!#Microsoft JDBC Driver #!#Microso EXECUTE sys_host_name_vu_prepare__dm_exec_sessions_proc GO ~~START~~ -nvarchar#!#nvarchar#!#int#!#text#!#nvarchar#!#nvarchar#!#smallint +nvarchar#!#nvarchar#!#int#!#nvarchar#!#nvarchar#!#nvarchar#!#smallint us_english#!#a_nice_workstation_name#!#131592#!#Microsoft JDBC Driver #!#Microsoft JDBC Driver for SQL Server#!#ymd#!#7 ~~END~~ diff --git a/test/JDBC/expected/latest__verification_cleanup__13_9__sys-host_name-vu-verify.out b/test/JDBC/expected/latest__verification_cleanup__13_9__sys-host_name-vu-verify.out index 2ea0477de3f..6eb09724dba 100644 --- a/test/JDBC/expected/latest__verification_cleanup__13_9__sys-host_name-vu-verify.out +++ b/test/JDBC/expected/latest__verification_cleanup__13_9__sys-host_name-vu-verify.out @@ -77,7 +77,7 @@ us_english#!#a_nice_workstation_name#!#131592#!#Microsoft JDBC Driver #!#Microso EXECUTE sys_host_name_vu_prepare__dm_exec_sessions_proc GO ~~START~~ -nvarchar#!#nvarchar#!#int#!#text#!#nvarchar#!#nvarchar#!#smallint +nvarchar#!#nvarchar#!#int#!#nvarchar#!#nvarchar#!#nvarchar#!#smallint us_english#!#a_nice_workstation_name#!#131592#!#Microsoft JDBC Driver #!#Microsoft JDBC Driver for SQL Server#!#ymd#!#7 ~~END~~ diff --git a/test/JDBC/expected/latest__verification_cleanup__14_3__sys-host_name-vu-verify.out b/test/JDBC/expected/latest__verification_cleanup__14_3__sys-host_name-vu-verify.out index 2ea0477de3f..6eb09724dba 100644 --- a/test/JDBC/expected/latest__verification_cleanup__14_3__sys-host_name-vu-verify.out +++ b/test/JDBC/expected/latest__verification_cleanup__14_3__sys-host_name-vu-verify.out @@ -77,7 +77,7 @@ us_english#!#a_nice_workstation_name#!#131592#!#Microsoft JDBC Driver #!#Microso EXECUTE sys_host_name_vu_prepare__dm_exec_sessions_proc GO ~~START~~ -nvarchar#!#nvarchar#!#int#!#text#!#nvarchar#!#nvarchar#!#smallint +nvarchar#!#nvarchar#!#int#!#nvarchar#!#nvarchar#!#nvarchar#!#smallint us_english#!#a_nice_workstation_name#!#131592#!#Microsoft JDBC Driver #!#Microsoft JDBC Driver for SQL Server#!#ymd#!#7 ~~END~~ diff --git a/test/JDBC/expected/latest__verification_cleanup__14_5__ISC-Check-Constraints-vu-verify.out b/test/JDBC/expected/latest__verification_cleanup__14_5__ISC-Check-Constraints-vu-verify.out index a7c3f6cbbd9..d90bcda08a4 100644 --- a/test/JDBC/expected/latest__verification_cleanup__14_5__ISC-Check-Constraints-vu-verify.out +++ b/test/JDBC/expected/latest__verification_cleanup__14_5__ISC-Check-Constraints-vu-verify.out @@ -31,8 +31,8 @@ isc_check_constraints_db1#!#dbo#!#test_datetime_c_datetimeoffset_check#!#(((c_da isc_check_constraints_db1#!#dbo#!#test_datetime_c_smalldatetime_check#!#((c_smalldatetime < '2007-05-08 12:35:00')) isc_check_constraints_db1#!#dbo#!#test_datetime_c_time_check#!#(((c_time < '09:00:00') AND (c_time < CAST('09:00:00' AS time(6))))) isc_check_constraints_db1#!#dbo#!#test_functioncall_col1_check#!#((isjson(col1) > 0)) -isc_check_constraints_db1#!#dbo#!#test_functioncall_col1_check1#!#(("right"(col1, 1) <> ',')) -isc_check_constraints_db1#!#dbo#!#test_functioncall_col1_check2#!#((ltrim(col1) <> '')) +isc_check_constraints_db1#!#dbo#!#test_functioncall_col1_check1#!#((pg_catalog."right"(col1, 1) <> ',')) +isc_check_constraints_db1#!#dbo#!#test_functioncall_col1_check2#!#((pg_catalog.ltrim(col1) <> '')) isc_check_constraints_db1#!#dbo#!#test_functioncall_col1_check3#!#((CAST((getutcdate() AT TIME ZONE col1) AS nvarchar(128)) <> '')) isc_check_constraints_db1#!#dbo#!#test_null_a_check#!#((a IS NOT NULL)) isc_check_constraints_db1#!#dbo#!#test_null1_a_check#!#((a <> CAST(NULL AS int))) @@ -55,7 +55,7 @@ isc_check_constraints_db1#!#dbo#!#test_tsql_const_c_varbinary_check#!#((c_varbin isc_check_constraints_db1#!#dbo#!#test_udd_c_udd_check#!#((c_udd < CAST((133.230182309832423) AS float))) isc_check_constraints_db1#!#dbo#!#test_udd_c_udd1_check#!#((c_udd1 < '2020-10-20 09:00:00')) isc_check_constraints_db1#!#dbo#!#test_udd_c_udd2_check#!#((c_udd2 < '09:00:00')) -isc_check_constraints_db1#!#dbo#!#test_upper_a_check#!#((upper(a) IN ('A', 'B'))) +isc_check_constraints_db1#!#dbo#!#test_upper_a_check#!#((pg_catalog.upper(a) IN ('A', 'B'))) ~~END~~ diff --git a/test/JDBC/expected/left-before-15_8-or-16_4-vu-cleanup.out b/test/JDBC/expected/left-before-15_8-or-16_4-vu-cleanup.out new file mode 100644 index 00000000000..c172e1720e0 --- /dev/null +++ b/test/JDBC/expected/left-before-15_8-or-16_4-vu-cleanup.out @@ -0,0 +1,80 @@ +DROP FUNCTION babel_4489_left_itvf_func +GO + +DROP FUNCTION babel_4489_left_dep_func +GO + +DROP PROCEDURE babel_4489_left_dep_proc +GO + +DROP VIEW babel_4489_left_dep_view +GO + +DROP TABLE babel_4489_left_UDT +GO + +DROP VIEW babel_4489_left_dep_view_1 +GO + +DROP VIEW babel_4489_left_dep_view_2 +GO + +DROP VIEW babel_4489_left_dep_view_3 +GO + +DROP VIEW babel_4489_left_dep_view_4 +GO + +DROP VIEW babel_4489_left_dep_view_5 +GO + +DROP VIEW babel_4489_left_dep_view_6 +GO + +DROP VIEW babel_4489_left_dep_view_7 +GO + +DROP TYPE dbo.babel_4489_left_varUDT +GO + +DROP TYPE dbo.babel_4489_left_imageUDT +GO + +DROP TABLE babel_4489_left_text +GO + +DROP TABLE babel_4489_left_image +GO + +DROP TABLE babel_4489_left_arabic_ci_ai +GO + +DROP TABLE babel_4489_left_arabic_cs_as +GO + +DROP TABLE babel_4489_left_arabic_ci_as +GO + +DROP TABLE babel_4489_left_chinese_prc_ci_ai +GO + +DROP TABLE babel_4489_left_chinese_prc_cs_as +GO + +DROP TABLE babel_4489_left_chinese_prc_ci_as +GO + +DROP TABLE babel_4489_left_t5 +GO + +DROP TABLE babel_4489_left_t4 +GO + +DROP TABLE babel_4489_left_t3 +GO + +DROP TABLE babel_4489_left_t2 +GO + +DROP TABLE babel_4489_left_t1 +GO diff --git a/test/JDBC/expected/left-before-15_8-or-16_4-vu-prepare.out b/test/JDBC/expected/left-before-15_8-or-16_4-vu-prepare.out new file mode 100644 index 00000000000..8e203bb67d1 --- /dev/null +++ b/test/JDBC/expected/left-before-15_8-or-16_4-vu-prepare.out @@ -0,0 +1,156 @@ +CREATE TABLE babel_4489_left_t1(a NCHAR(50)) +GO +INSERT INTO babel_4489_left_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_4489_left_t1 VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_left_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4489_left_t2 VALUES(N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_left_t3(a CHAR(50)) +GO +INSERT INTO babel_4489_left_t3 VALUES(' abcdefghi ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_left_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4489_left_t4 VALUES(' abcdefghi ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_left_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4489_left_t5 VALUES(0x2020616263642020) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_left_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4489_left_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_left_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4489_left_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_left_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4489_left_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_left_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4489_left_arabic_ci_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_left_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4489_left_arabic_cs_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_left_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4489_left_arabic_ci_ai VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_left_image(a IMAGE) +GO +INSERT INTO babel_4489_left_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_left_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4489_left_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TYPE dbo.babel_4489_left_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4489_left_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4489_left_UDT(a dbo.babel_4489_left_imageUDT, b dbo.babel_4489_left_varUDT) +GO +INSERT INTO babel_4489_left_UDT VALUES(CAST('abcdef' as dbo.babel_4489_left_imageUDT), CAST('abcdef' as dbo.babel_4489_left_varUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_4489_left_dep_view AS + SELECT LEFT(a, 5) as result from babel_4489_left_t2 +GO + +CREATE PROCEDURE babel_4489_left_dep_proc AS + SELECT LEFT(a, 5) as result from babel_4489_left_t2 +GO + +CREATE FUNCTION babel_4489_left_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 LEFT(a, 5) from babel_4489_left_t2) +END +GO + +CREATE VIEW babel_4489_left_dep_view_1 AS + SELECT LEFT(a, 5) as result FROM babel_4489_left_t1 +GO + +CREATE VIEW babel_4489_left_dep_view_2 AS + SELECT LEFT(a, 5) as result FROM babel_4489_left_t2 +GO + +CREATE VIEW babel_4489_left_dep_view_3 AS + SELECT LEFT(a, 5) as result FROM babel_4489_left_t3 +GO + +CREATE VIEW babel_4489_left_dep_view_4 AS + SELECT LEFT(a, 5) as result FROM babel_4489_left_t4 +GO + +CREATE VIEW babel_4489_left_dep_view_5 AS + SELECT LEFT(a, 5) as result FROM babel_4489_left_t5 +GO + +CREATE VIEW babel_4489_left_dep_view_6 AS + SELECT LEFT(a, 5) as result FROM babel_4489_left_text +GO + +CREATE VIEW babel_4489_left_dep_view_7 AS + SELECT LEFT(b, 5) as result FROM babel_4489_left_text +GO + +CREATE FUNCTION babel_4489_left_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT LEFT(a, 5) as result from babel_4489_left_t2) +GO diff --git a/test/JDBC/expected/left-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/left-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..d8b4baed87a --- /dev/null +++ b/test/JDBC/expected/left-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,745 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(25) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT LEFT(NULL, -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the left function.)~~ + + +SELECT LEFT(NULL, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT LEFT(NULL, 2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT LEFT('abc', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT LEFT(NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- edge case values for second parameter +SELECT LEFT('AbdefGhi', -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the left function.)~~ + + +SELECT '|' + LEFT('AbdefGhi', 0) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT LEFT('AbdefGhi', 2) +GO +~~START~~ +varchar +Ab +~~END~~ + + +SELECT LEFT('AbdefGhi', 2147483646) +GO +~~START~~ +varchar +AbdefGhi +~~END~~ + + +SELECT LEFT('AbdefGhi', 2147483650) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- misc tests +DECLARE @procedure_name NVARCHAR(134) = ';1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO +~~START~~ +nvarchar + +~~END~~ + + +DECLARE @procedure_name NVARCHAR(134) = 'procedureName;1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO +~~START~~ +nvarchar +procedureName +~~END~~ + + +-- procedure name with length equal to 134 +DECLARE @procedure_name NVARCHAR(134) = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO +~~START~~ +nvarchar +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 5) + '|' +GO +~~START~~ +varchar +|abc?d| +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) + '|' +GO +~~START~~ +varchar +|??·?| +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??·?| +~~END~~ + + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 50) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 5) +GO +~~START~~ +varchar +abc?d +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT LEFT(@inputString, 4) +GO +~~START~~ +varchar +??·? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT LEFT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 50) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_4489_left_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_4489_left_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_4489_left_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_ci_as +GO +~~START~~ +varchar +الله +~~END~~ + + +SELECT LEFT(a, 4) COLLATE ARABIC_CI_AS FROM babel_4489_left_arabic_ci_as +GO +~~START~~ +varchar +الله +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_cs_as +GO +~~START~~ +varchar +الله +~~END~~ + + +SELECT LEFT(a, 4) COLLATE ARABIC_CS_AS FROM babel_4489_left_arabic_cs_as +GO +~~START~~ +varchar +الله +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_ci_ai +GO +~~START~~ +varchar +الله +~~END~~ + + +SELECT LEFT(a, 4) COLLATE ARABIC_CI_AI FROM babel_4489_left_arabic_ci_ai +GO +~~START~~ +varchar +الله +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 5) + '|' +GO +~~START~~ +nvarchar +|abc?d| +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) + '|' +GO +~~START~~ +nvarchar +|??·?| +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 50) + '|' +GO +~~START~~ +nvarchar +|abc?defghi?? | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + LEFT(a, 5) + '|' FROM babel_4489_left_t1 +GO +~~START~~ +nvarchar +|abc🙂d| +|比尔·拉莫| +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 5) +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT LEFT(@inputString, 4) +GO +~~START~~ +nvarchar +比尔·拉 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 50) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT LEFT(@inputString, 4) +GO +~~START~~ +varchar +abcd +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT LEFT(@inputString, 4) +GO +~~START~~ +varchar +abcd +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_left_dep_view +GO +~~START~~ +text +abc?d +~~END~~ + + +EXEC babel_4489_left_dep_proc +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_func() +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +SELECT * FROM babel_4489_left_itvf_func() +GO +~~START~~ +text +abc?d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_1 +GO +~~START~~ +text +abc?d +??·?? +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_2 +GO +~~START~~ +text +abc?d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_3 +GO +~~START~~ +text + abc +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_4 +GO +~~START~~ +text + abc +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_5 +GO +~~START~~ +text +0x202 +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_6 +GO +~~START~~ +text +abc?d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_7 +GO +~~START~~ +text +abc?d +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_left_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT LEFT(a, 3) FROM babel_4489_left_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of left function.)~~ + + +SELECT LEFT(b, 3) FROM babel_4489_left_UDT +GO +~~START~~ +varchar +abc +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +201 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +201 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +195 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +12: +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +196 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +196 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +6F9 +~~END~~ + + +SELECT LEFT(a, 5) from babel_4489_left_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of left function.)~~ + + +-- input datatype text +SELECT LEFT(a, 5) FROM babel_4489_left_text +GO +~~START~~ +varchar +abc?d +~~END~~ + + +-- input datatype ntext +SELECT LEFT(b, 5) FROM babel_4489_left_text +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LEFT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar +6F9 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LEFT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT LEFT(NULL, 2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT LEFT('abc', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT LEFT(NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- edge case values for second parameter +SELECT LEFT('AbdefGhi', -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the left function.)~~ + + +SELECT '|' + LEFT('AbdefGhi', 0) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT LEFT('AbdefGhi', 2) +GO +~~START~~ +varchar +Ab +~~END~~ + + +SELECT LEFT('AbdefGhi', 2147483646) +GO +~~START~~ +varchar +AbdefGhi +~~END~~ + + +SELECT LEFT('AbdefGhi', 2147483650) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- misc tests +DECLARE @procedure_name NVARCHAR(134) = ';1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO +~~START~~ +nvarchar + +~~END~~ + + +DECLARE @procedure_name NVARCHAR(134) = 'procedureName;1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO +~~START~~ +nvarchar +procedureName +~~END~~ + + +-- procedure name with length equal to 134 +DECLARE @procedure_name NVARCHAR(134) = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO +~~START~~ +nvarchar +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 5) + '|' +GO +~~START~~ +varchar +|abc?d| +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) + '|' +GO +~~START~~ +varchar +|??·?| +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??·?| +~~END~~ + + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 50) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 5) +GO +~~START~~ +varchar +abc?d +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT LEFT(@inputString, 4) +GO +~~START~~ +varchar +??·? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT LEFT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 50) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_4489_left_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_4489_left_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_4489_left_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_ci_as +GO +~~START~~ +varchar +الله +~~END~~ + + +SELECT LEFT(a, 4) COLLATE ARABIC_CI_AS FROM babel_4489_left_arabic_ci_as +GO +~~START~~ +varchar +الله +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_cs_as +GO +~~START~~ +varchar +الله +~~END~~ + + +SELECT LEFT(a, 4) COLLATE ARABIC_CS_AS FROM babel_4489_left_arabic_cs_as +GO +~~START~~ +varchar +الله +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_ci_ai +GO +~~START~~ +varchar +الله +~~END~~ + + +SELECT LEFT(a, 4) COLLATE ARABIC_CI_AI FROM babel_4489_left_arabic_ci_ai +GO +~~START~~ +varchar +الله +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 5) + '|' +GO +~~START~~ +nvarchar +|abc?d| +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) + '|' +GO +~~START~~ +nvarchar +|??·?| +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 50) + '|' +GO +~~START~~ +nvarchar +|abc?defghi?? | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + LEFT(a, 5) + '|' FROM babel_4489_left_t1 +GO +~~START~~ +nvarchar +|abc🙂d| +|比尔·拉莫| +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 5) +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT LEFT(@inputString, 4) +GO +~~START~~ +nvarchar +比尔·拉 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 50) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT LEFT(@inputString, 4) +GO +~~START~~ +varchar +abcd +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT LEFT(@inputString, 4) +GO +~~START~~ +varchar +abcd +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_left_dep_view +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +EXEC babel_4489_left_dep_proc +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_func() +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +SELECT * FROM babel_4489_left_itvf_func() +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_1 +GO +~~START~~ +nvarchar +abc🙂d +比尔·拉莫 +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_2 +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_3 +GO +~~START~~ +varchar + abc +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_4 +GO +~~START~~ +varchar + abc +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_5 +GO +~~START~~ +varchar + abc +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_6 +GO +~~START~~ +varchar +abc?d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_7 +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_left_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT LEFT(a, 3) FROM babel_4489_left_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of left function.)~~ + + +SELECT LEFT(b, 3) FROM babel_4489_left_UDT +GO +~~START~~ +varchar +abc +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +201 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +201 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +195 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +12: +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +196 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +196 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +6F9 +~~END~~ + + +SELECT LEFT(a, 5) from babel_4489_left_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of left function.)~~ + + +-- input datatype text +SELECT LEFT(a, 5) FROM babel_4489_left_text +GO +~~START~~ +varchar +abc?d +~~END~~ + + +-- input datatype ntext +SELECT LEFT(b, 5) FROM babel_4489_left_text +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LEFT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar +6F9 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LEFT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|??·??? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??·??? | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|??·??? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_ci_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_ltrim_chinese_prc_ci_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_cs_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_ltrim_chinese_prc_cs_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_ltrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_ltrim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_ltrim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_ltrim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|??·??? | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_t1 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +|比尔·拉莫斯 | +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯 | +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x202061626364656667682020 +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abcdefgh| +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x202061626364656667682020 +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abcdefgh| +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_ltrim_dep_view +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +EXEC babel_4489_ltrim_dep_proc +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_func() +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_itvf_func() +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_1 +GO +~~START~~ +varchar +|abc?defghi?? | +|??·??? | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_2 +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_3 +GO +~~START~~ +varchar +|abcdefghi | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_4 +GO +~~START~~ +varchar +|abcdefghi | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_5 +GO +~~START~~ +varchar +|0x2020616263642020| +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_6 +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_7 +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_ltrim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT LTRIM(a) FROM babel_4489_ltrim_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of ltrim function.)~~ + + +SELECT LTRIM(b) FROM babel_4489_ltrim_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12:10:05.1237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +123456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +SELECT LTRIM(a) from babel_4489_ltrim_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of ltrim function.)~~ + + +-- input datatype text +SELECT LTRIM(a) FROM babel_4489_ltrim_text +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT LTRIM(b) FROM babel_4489_ltrim_text +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +POINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/ltrim-vu-cleanup.out b/test/JDBC/expected/ltrim-vu-cleanup.out new file mode 100644 index 00000000000..7cbd333dee1 --- /dev/null +++ b/test/JDBC/expected/ltrim-vu-cleanup.out @@ -0,0 +1,80 @@ +DROP FUNCTION babel_4489_ltrim_itvf_func +GO + +DROP FUNCTION babel_4489_ltrim_dep_func +GO + +DROP PROCEDURE babel_4489_ltrim_dep_proc +GO + +DROP VIEW babel_4489_ltrim_dep_view +GO + +DROP VIEW babel_4489_ltrim_dep_view_1 +GO + +DROP VIEW babel_4489_ltrim_dep_view_2 +GO + +DROP VIEW babel_4489_ltrim_dep_view_3 +GO + +DROP VIEW babel_4489_ltrim_dep_view_4 +GO + +DROP VIEW babel_4489_ltrim_dep_view_5 +GO + +DROP VIEW babel_4489_ltrim_dep_view_6 +GO + +DROP VIEW babel_4489_ltrim_dep_view_7 +GO + +DROP TABLE babel_4489_ltrim_UDT +GO + +DROP TYPE dbo.babel_4489_ltrim_varUDT +GO + +DROP TYPE dbo.babel_4489_ltrim_imageUDT +GO + +DROP TABLE babel_4489_ltrim_text +GO + +DROP TABLE babel_4489_ltrim_image +GO + +DROP TABLE babel_4489_ltrim_arabic_ci_ai +GO + +DROP TABLE babel_4489_ltrim_arabic_cs_as +GO + +DROP TABLE babel_4489_ltrim_arabic_ci_as +GO + +DROP TABLE babel_4489_ltrim_chinese_prc_ci_ai +GO + +DROP TABLE babel_4489_ltrim_chinese_prc_cs_as +GO + +DROP TABLE babel_4489_ltrim_chinese_prc_ci_as +GO + +DROP TABLE babel_4489_ltrim_t5 +GO + +DROP TABLE babel_4489_ltrim_t4 +GO + +DROP TABLE babel_4489_ltrim_t3 +GO + +DROP TABLE babel_4489_ltrim_t2 +GO + +DROP TABLE babel_4489_ltrim_t1 +GO diff --git a/test/JDBC/expected/ltrim-vu-prepare.out b/test/JDBC/expected/ltrim-vu-prepare.out new file mode 100644 index 00000000000..5c88f4e03ed --- /dev/null +++ b/test/JDBC/expected/ltrim-vu-prepare.out @@ -0,0 +1,156 @@ +CREATE TABLE babel_4489_ltrim_t1(a NCHAR(50)) +GO +INSERT INTO babel_4489_ltrim_t1 VALUES(N' abc🙂defghi🙂🙂 ') +INSERT INTO babel_4489_ltrim_t1 VALUES(N' 比尔·拉莫斯 ') +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_ltrim_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4489_ltrim_t2 VALUES(N' abc🙂defghi🙂🙂 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_ltrim_t3(a CHAR(50)) +GO +INSERT INTO babel_4489_ltrim_t3 VALUES(' abcdefghi ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_ltrim_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4489_ltrim_t4 VALUES(' abcdefghi ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_ltrim_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4489_ltrim_t5 VALUES(0x2020616263642020) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_ltrim_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4489_ltrim_chinese_prc_ci_as VALUES(N' 比尔·拉莫斯 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_ltrim_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4489_ltrim_chinese_prc_cs_as VALUES(N' 比尔·拉莫斯 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_ltrim_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4489_ltrim_chinese_prc_ci_ai VALUES(N' 比尔·拉莫斯 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_ltrim_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4489_ltrim_arabic_ci_as VALUES(N' الله مع المتقين ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_ltrim_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4489_ltrim_arabic_cs_as VALUES(N' الله مع المتقين ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_ltrim_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4489_ltrim_arabic_ci_ai VALUES(N' الله مع المتقين ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_ltrim_image(a IMAGE) +GO +INSERT INTO babel_4489_ltrim_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_ltrim_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4489_ltrim_text VALUES (N' abc🙂defghi🙂🙂 ', N' abc🙂defghi🙂🙂 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TYPE dbo.babel_4489_ltrim_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4489_ltrim_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4489_ltrim_UDT(a dbo.babel_4489_ltrim_imageUDT, b dbo.babel_4489_ltrim_varUDT) +GO +INSERT INTO babel_4489_ltrim_UDT VALUES(CAST('abcdef' as dbo.babel_4489_ltrim_imageUDT), CAST('abcdef' as dbo.babel_4489_ltrim_varUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_4489_ltrim_dep_view AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t2 +GO + +CREATE PROCEDURE babel_4489_ltrim_dep_proc AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t2 +GO + +CREATE FUNCTION babel_4489_ltrim_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 ('|' + LTRIM(a) + '|') FROM babel_4489_ltrim_t2) +END +GO + +CREATE VIEW babel_4489_ltrim_dep_view_1 AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t1 +GO + +CREATE VIEW babel_4489_ltrim_dep_view_2 AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t2 +GO + +CREATE VIEW babel_4489_ltrim_dep_view_3 AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t3 +GO + +CREATE VIEW babel_4489_ltrim_dep_view_4 AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t4 +GO + +CREATE VIEW babel_4489_ltrim_dep_view_5 AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t5 +GO + +CREATE VIEW babel_4489_ltrim_dep_view_6 AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_text +GO + +CREATE VIEW babel_4489_ltrim_dep_view_7 AS + SELECT ('|' + LTRIM(b) + '|') as result FROM babel_4489_ltrim_text +GO + +CREATE FUNCTION babel_4489_ltrim_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t2) +GO diff --git a/test/JDBC/expected/ltrim-vu-verify.out b/test/JDBC/expected/ltrim-vu-verify.out new file mode 100644 index 00000000000..de546af507f --- /dev/null +++ b/test/JDBC/expected/ltrim-vu-verify.out @@ -0,0 +1,610 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(50) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT LTRIM(NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|??·??? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??·??? | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|??·??? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_ci_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_ltrim_chinese_prc_ci_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_cs_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_ltrim_chinese_prc_cs_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_ltrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_ltrim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_ltrim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_ltrim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|??·??? | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_t1 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +|比尔·拉莫斯 | +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯 | +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x202061626364656667682020 +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abcdefgh| +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x202061626364656667682020 +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abcdefgh| +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_ltrim_dep_view +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +EXEC babel_4489_ltrim_dep_proc +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_func() +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_itvf_func() +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_1 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +|比尔·拉莫斯 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_2 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_3 +GO +~~START~~ +varchar +|abcdefghi | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_4 +GO +~~START~~ +varchar +|abcdefghi | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_5 +GO +~~START~~ +varchar +|abcd | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_6 +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_7 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_ltrim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT LTRIM(a) FROM babel_4489_ltrim_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of ltrim function.)~~ + + +SELECT LTRIM(b) FROM babel_4489_ltrim_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12:10:05.1237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +123456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +SELECT LTRIM(a) from babel_4489_ltrim_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of ltrim function.)~~ + + +-- input datatype text +SELECT LTRIM(a) FROM babel_4489_ltrim_text +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT LTRIM(b) FROM babel_4489_ltrim_text +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +POINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/BABEL-UNSUPPORTED.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/BABEL-UNSUPPORTED.out index b91bd56f02a..fff275f7879 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/BABEL-UNSUPPORTED.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/BABEL-UNSUPPORTED.out @@ -437,13 +437,6 @@ ignore -- escape hatch: storage_on_partition. -- 'strict' is default -CREATE TABLE t_unsupported_sop1(a int) ON partition(a); -GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: 'partition scheme' is not currently supported in Babelfish. please use babelfishpg_tsql.escape_hatch_storage_on_partition to ignore)~~ - - CREATE TABLE t_unsupported_sop2(a int) FILESTREAM_ON partition(a); GO ~~ERROR (Code: 33557097)~~ @@ -459,11 +452,6 @@ ignore ~~END~~ -CREATE TABLE t_unsupported_sop1(a int) ON partition(a); -GO -DROP TABLE t_unsupported_sop1; -GO - CREATE TABLE t_unsupported_sop2(a int) FILESTREAM_ON partition(a); GO DROP TABLE t_unsupported_sop2 @@ -2378,13 +2366,6 @@ GO -- test automatically generated message for unsupported DDL -CREATE PARTITION FUNCTION f_unsupported_1(datetime) AS RANGE RIGHT FOR VALUES (N'2017-07-11T00:00:00.000', N'2017-07-12T00:00:00.000', N'2017-07-13T00:00:00.000'); -GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: 'CREATE PARTITION FUNCTION' is not currently supported in Babelfish)~~ - - ALTER AUTHORIZATION ON a1 TO SCHEMA OWNER; GO ~~ERROR (Code: 33557097)~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/PARTITION-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/PARTITION-vu-verify.out new file mode 100644 index 00000000000..bae10201abb --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/PARTITION-vu-verify.out @@ -0,0 +1,3746 @@ +--------------------------------------------------- +--- Check for inconsistent metadata after upgrade +---------------------------------------------------- +SELECT COUNT(*) FROM sys.babelfish_inconsistent_metadata(); +GO +~~START~~ +int +0 +~~END~~ + + +-------------------------------------------------- +--- CREATE PARTITION FUNCTION/SCHEME/TABLE using procedure +-------------------------------------------------- +EXEC PartitionProcedureCreatePartitionFunction +GO + +EXEC PartitionProcedureCreatePartitionScheme +GO + +EXEC PartitionProcedureCreatePartitionTable +GO + +EXEC PartitionProcedureCreatePartitionFunctionSchemeAndTable +GO + +-------------------------------------------------- +--- CREATE PARTITION FUNCTION/SCHEME/TABLE inside Function +-------------------------------------------------- +CREATE FUNCTION TestFunctionCreatePartitionFunction() +RETURNS INT +AS +BEGIN + CREATE PARTITION FUNCTION TestPartitionFunction (int) + AS RANGE RIGHT FOR VALUES (500, 1000, 10000); + RETURN 1; +END; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid use of a side-effecting operator 'CREATE PARTITION FUNCTION' within a function.)~~ + + +CREATE FUNCTION TestFunctionDropPartitionFunction() +RETURNS INT +AS +BEGIN + DROP PARTITION FUNCTION IntPartitionFunction; + RETURN 1; +END; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid use of a side-effecting operator 'DROP PARTITION FUNCTION' within a function.)~~ + + +CREATE FUNCTION TestFunctionCreatePartitionScheme() +RETURNS INT +AS +BEGIN + CREATE PARTITION SCHEME TestPartitionScheme AS + PARTITION IntPartitionFunction + ALL TO ([PRIMARY]); + RETURN 1; +END; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid use of a side-effecting operator 'CREATE PARTITION SCHEME' within a function.)~~ + + +CREATE FUNCTION TestFunctionDropPartitionScheme() +RETURNS INT +AS +BEGIN + DROP PARTITION SCHEME IntPartitionScheme; + RETURN 1; +END; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid use of a side-effecting operator 'DROP PARTITION SCHEME' within a function.)~~ + + +CREATE FUNCTION TestFunctionCreatePartitionTable() +RETURNS INT +AS +BEGIN + CREATE TABLE TestPartitionTable ( + Id INT, + Value sys.varchar(20) + ) ON IntPartitionScheme(Id); +END; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: DDL cannot be used within a function)~~ + + +CREATE FUNCTION TestFunctionDropPartitionTable() +RETURNS INT +AS +BEGIN + DROP TABLE partition_vu_prepare_int_table; + RETURN 1; +END; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: DDL cannot be used within a function)~~ + + + +--------------------------------------------------------- +--- CREATE PARTITION FUNCTION/SCHEME using 2-part name +--------------------------------------------------------- +CREATE PARTITION FUNCTION [TestDb].[TwoPartParitionFunction](DATE) +AS RANGE RIGHT FOR VALUES ('20230101', '20230201', '20230301', '20230401'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '.' at line 4 and character position 34)~~ + + +CREATE PARTITION SCHEME [TestDb].[TwoPartParitionScheme] +AS PARTITION [TestDb].[TwoPartPF] +TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '.' at line 1 and character position 32)~~ + + +-------------------------------------------------- +--- Unsupported Datatypes for Partition Function +-------------------------------------------------- +CREATE PARTITION FUNCTION VarcharMaxPartitionFunction (VARCHAR(MAX)) +AS RANGE RIGHT FOR VALUES ('A', 'B', 'C', 'D'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'varchar(max)' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION NVarcharMaxPartitionFunction (NVARCHAR(MAX)) +AS RANGE RIGHT FOR VALUES (N'A', N'B', N'C', N'D'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'nvarchar(max)' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION VarbinaryMaxPartitionFunction (VARBINARY(MAX)) +AS RANGE RIGHT FOR VALUES (0x000, 0x800, 0x400, 0xC000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'varbinary(max)' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION BinaryMaxPartitionFunction (BINARY(MAX)) +AS RANGE RIGHT FOR VALUES (0x000, 0x800, 0x400, 0xC000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Incorrect syntax near the keyword 'binary'.)~~ + + +CREATE PARTITION FUNCTION TextPartitionFunction (text) +AS RANGE RIGHT FOR VALUES ('a', 'b', 'c'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'text' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION NTextPartitionFunction (ntext) +AS RANGE RIGHT FOR VALUES (N'a', N'b', N'c'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'ntext' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION ImagePartitionFunction (image) +AS RANGE RIGHT FOR VALUES (0x123456, 0x789ABC, 0xDEF012); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'image' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION XmlPartitionFunction (xml) +AS RANGE RIGHT FOR VALUES ('1', '2', '3'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'xml' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION GeometryPartitionFunction (GEOMETRY) +AS RANGE RIGHT FOR VALUES (GEOMETRY::STGeomFromText('POINT(1 1)', 0)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'geometry' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION GeometryPartitionFunction (GEOGRAPHY) +AS RANGE RIGHT FOR VALUES (GEOMETRY::STGeomFromText('POINT(1 1)', 0)); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'geography' is not valid for this operation.)~~ + + +-- to test rowversion and timestamp +SELECT SET_CONFIG('babelfishpg_tsql.escape_hatch_rowversion', 'ignore', 'false') +go +~~START~~ +text +ignore +~~END~~ + + +CREATE PARTITION FUNCTION RowVersionPartitionFunction (ROWVERSION) +AS RANGE RIGHT FOR VALUES (0x0000000000000000, 0x0000000000000001, 0x0000000000000002); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'rowversion' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION TimestampPartitionFunction (TIMESTAMP) +AS RANGE RIGHT FOR VALUES (0x0000000000000000, 0x0000000000000001, 0x0000000000000002); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'timestamp' is not valid for this operation.)~~ + + +-- reset back the escape hatch +SELECT SET_CONFIG('babelfishpg_tsql.escape_hatch_rowversion', 'strict', 'true') +go +~~START~~ +text +strict +~~END~~ + + +-- user defined type +CREATE TYPE PartitionUserDefinedType FROM VARCHAR(10); +GO + +CREATE PARTITION FUNCTION UdtPartitionFunction (PartitionUserDefinedType) +AS RANGE RIGHT FOR VALUES ('a', 'b', 'c'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'partitionuserdefinedtype' is not valid for this operation.)~~ + + +DROP type PartitionUserDefinedType +GO + +------------------------------------------------------------------------------ +--- Duplicate range values for all supported datatypes in Partition Function +------------------------------------------------------------------------------ +CREATE PARTITION FUNCTION IntPartitionFunctionContainsDuplicateValue (int) +AS RANGE RIGHT FOR VALUES (0, 100, 1000, 100); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION BigIntPartitionFunctionContainsDuplicateValue (bigint) +AS RANGE RIGHT FOR VALUES (0, 500, 100, 500, 1000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION SmallIntPartitionFunctionContainsDuplicateValue (smallint) +AS RANGE RIGHT FOR VALUES (32767, 10, -32768, 0, 10); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION TinyIntPartitionFunctionContainsDuplicateValue (tinyint) +AS RANGE RIGHT FOR VALUES (0, 255, 128, 255); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION DecimalPartitionFunctionContainsDuplicateValue (decimal(10, 5)) +AS RANGE RIGHT FOR VALUES (0.0, 300.0, 200.0, 100.0, 300.0); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION NumericPartitionFunctionContainsDuplicateValue (numeric(5, 2)) +AS RANGE RIGHT FOR VALUES (0.0, 30.0, 10.0, 20.0, 30.0); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION DatePartitionFunctionContainsDuplicateValue (date) +AS RANGE RIGHT FOR VALUES ('2022-07-01', '2022-01-01','2023-01-01','2022-01-01'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION DateTimePartitionFunctionContainsDuplicateValue (datetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01 00:00:00', '2019-01-01 00:00:00', '2022-01-01'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION DateTime2PartitionFunctionContainsDuplicateValue (datetime2(3)) +AS RANGE RIGHT FOR VALUES ('2022-01-01 00:00:00.000', '2022-07-01 00:00:00.000', '2019-01-01 00:00:00.000', '2022-07-01 00:00:00.000'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION SmallDateTimePartitionFunctionContainsDuplicateValue (smalldatetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01', '2019-01-01', '2022-07-01'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION CharPartitionFunctionContainsDuplicateValue (char(5)) +AS RANGE RIGHT FOR VALUES ('A', 'F', 'K', 'P', 'U', 'Z', 'D', 'K'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION VarCharPartitionFunctionContainsDuplicateValue (varchar(10)) +AS RANGE RIGHT FOR VALUES ('Apple', 'Banana', 'Mango', 'Cherry', 'Date', 'Banana'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION NVarCharPartitionFunctionContainsDuplicateValue (nvarchar(10)) +AS RANGE RIGHT FOR VALUES (N'Apple', N'Banana', N'Mango', N'Cherry', N'Date', N'Banana'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION NCharPartitionFunctionContainsDuplicateValue (nchar(5)) +AS RANGE RIGHT FOR VALUES (N'A', N'F', N'K', N'P', N'U', N'Z', N'B', N'K'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION BinaryPartitionFunctionContainsDuplicateValue (binary(4)) +AS RANGE RIGHT FOR VALUES (0x000, 0x800, 0x400, 0xC000, 0x800); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION VarBinaryPartitionFunctionContainsDuplicateValue (varbinary(8)) +AS RANGE RIGHT FOR VALUES (0x0000000000000000, 0x8000000000000000, 0x4000000000000000, 0xC000000000000000, 0x8000000000000000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION UniqueIdentifierPartitionFunctionContainsDuplicateValue (uniqueidentifier) +AS RANGE RIGHT FOR VALUES ('00000000-0000-0000-0000-000000000000', '6F9619FF-8B86-D011-B42D-00C04FC964FF', 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF', '6F9619FF-8B86-D011-B42D-00C04FC964FF'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +-------------------------------------------------- +--- Unsupported Options with Partition Function +-------------------------------------------------- +-- LEFT option is not supported in Babelfish +CREATE PARTITION FUNCTION PartitionFunctionWithLeft (int) +AS RANGE LEFT FOR VALUES (10, 1000, 10000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'PARTIION FUNCTION with LEFT option' is not currently supported in Babelfish)~~ + + +-- sql_variant is not yet supported in Babelfish +CREATE PARTITION FUNCTION SqlVariantPartitionFunction (sql_variant) +AS RANGE RIGHT +FOR VALUES ( + CAST('abc' AS char(5)), + CAST(N'xyz' AS nchar(5)), + CAST('Apple' AS VARCHAR(10)), + CAST(N'Banana' AS NVARCHAR(10)), + CAST('Some text' AS SQL_VARIANT) +); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'sql_variant' is not yet supported for partition function in Babelfish.)~~ + + +-- by default it is LEFT and it should throw error +CREATE PARTITION FUNCTION PartitionFunctionWithLeft (int) +AS RANGE FOR VALUES (10, 1000, 10000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'PARTIION FUNCTION with LEFT option' is not currently supported in Babelfish)~~ + + +-- NULL value is not supported in range values +CREATE PARTITION FUNCTION PartitionFunctionWithNULL (int) +AS RANGE RIGHT FOR VALUES (10, 1000, NULL); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: NULL values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION PartitionFunctionWithNULL (int) +AS RANGE RIGHT FOR VALUES (10, 1000, NULL, NULL); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: NULL values are not allowed in partition function boundary values list.)~~ + + +-------------------------------------------------- +--- Duplicate Create of Partition Function/Scheme +-------------------------------------------------- +CREATE PARTITION FUNCTION IntPartitionFunction (int) +AS RANGE RIGHT FOR VALUES (500, 1000, 10000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: There is already an object named 'IntPartitionFunction' in the database.)~~ + + +-- duplicate partition function with invalid args +CREATE PARTITION FUNCTION IntPartitionFunction (int) +AS RANGE RIGHT FOR VALUES ('xyz', CONVERT(DATETIME, '2023-05-01'), 0x789ABC); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: There is already an object named 'IntPartitionFunction' in the database.)~~ + + +CREATE PARTITION SCHEME IntPartitionScheme AS +PARTITION IntPartitionFunction +ALL TO ([PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: There is already an object named 'IntPartitionScheme' in the database.)~~ + + +-- duplicate partition scheme with invalid Partition function +CREATE PARTITION SCHEME IntPartitionScheme AS +PARTITION PartitionFunctionDoesNotExists +ALL TO ([PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid object name 'PartitionFunctionDoesNotExists'.)~~ + + +----------------------------------------------------------------------------------- +--- Drop of of Partition Function/Scheme when it does not exists +----------------------------------------------------------------------------------- +DROP PARTITION FUNCTION PartitionFunctionDoesNotExists +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the partition function 'PartitionFunctionDoesNotExists', because it does not exist or you do not have permission.)~~ + + +DROP PARTITION SCHEME PartitionSchemeDoesNotExists +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the partition scheme 'PartitionSchemeDoesNotExists', because it does not exist or you do not have permission.)~~ + + +----------------------------------------------------------------------------------- +--- Create of Partition Scheme when provided partition function doesn't exists +----------------------------------------------------------------------------------- +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION PartitionFunctionDoesNotExists +ALL TO ([PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid object name 'PartitionFunctionDoesNotExists'.)~~ + + +----------------------------------------------------------------------------------- +--- Drop of of Partition Function when there is dependent Partition Scheme +----------------------------------------------------------------------------------- +DROP PARTITION FUNCTION IntPartitionFunction +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition function 'IntPartitionFunction' is being used by one or more partition schemes.)~~ + + +----------------------------------------------------------------------------------- +--- Drop of of Partition Scheme when there is dependent Table on it +----------------------------------------------------------------------------------- +DROP PARTITION SCHEME IntPartitionScheme +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The partition scheme "IntPartitionScheme" is currently being used to partition one or more tables.)~~ + + + + +----------------------------------------------- +--- Filegroup behaviour with Partition Scheme +----------------------------------------------- +-- by default user filegroup will be treated as PRIMARY filegroup +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION IntPartitionFunction +ALL TO (user_filegroup); +GO + +DROP PARTITION SCHEME TestPartitionScheme +GO + +-- User can configure the "escape_hatch_storage_options" to STRICT to disallow user filegroups +SELECT SET_CONFIG('babelfishpg_tsql.escape_hatch_storage_options', 'strict', 'false') +GO +~~START~~ +text +strict +~~END~~ + + +-- should throw error +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION IntPartitionFunction +ALL TO (user_filegroup); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'user filegroup' is not currently supported in Babelfish. please use babelfishpg_tsql.escape_hatch_storage_options to ignore)~~ + + +-- reset it back +SELECT SET_CONFIG('babelfishpg_tsql.escape_hatch_storage_options', 'ignore', 'false') +GO +~~START~~ +text +ignore +~~END~~ + + +-- when more than one filegroup are specified with ALL option +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION IntPartitionFunction +ALL TO ([PRIMARY], [PRIMARY], [PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Only a single filegroup can be specified while creating partition scheme using option ALL to specify all the filegroups.)~~ + + +-- when partition function generates more partition than specified filegroups +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION IntPartitionFunction +TO ([PRIMARY], [PRIMARY], [PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The associated partition function 'IntPartitionFunction' generates more partitions than there are file groups mentioned in the scheme 'TestPartitionScheme'.)~~ + + + +--------------------------------- +--- Metadata Related Tests +--------------------------------- +SELECT * FROM GetPartitionFunctionMetadataView +GO +~~START~~ +nvarchar#!#char#!#nvarchar#!#int#!#bit#!#bit +BigIntPartitionFunction#!#R #!#RANGE#!#5#!#1#!#0 +BinaryPartitionFunction#!#R #!#RANGE#!#5#!#1#!#0 +CharPartitionFunction#!#R #!#RANGE#!#8#!#1#!#0 +DatePartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +DateTime2PartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +DateTimePartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +DecimalPartitionFunction#!#R #!#RANGE#!#5#!#1#!#0 +IntPartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +MoneyPartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +NCharPartitionFunction#!#R #!#RANGE#!#8#!#1#!#0 +NumericPartitionFunction#!#R #!#RANGE#!#5#!#1#!#0 +NVarCharPartitionFunction#!#R #!#RANGE#!#6#!#1#!#0 +PARTITION_FUNCTION 유니코드스키마👻 #!#R #!#RANGE#!#4#!#1#!#0 +PARTITION_FUNCTION 😎$@ #123 🌍rder #!#R #!#RANGE#!#4#!#1#!#0 +PARTITION_FUNCTIONログインαιώνια#!#R #!#RANGE#!#4#!#1#!#0 +PartitionFunctionHavingDifferentCollationInput#!#R #!#RANGE#!#5#!#1#!#0 +PartitionFunctionInsideProc1#!#R #!#RANGE#!#4#!#1#!#0 +PartitionFunctionInsideProc2#!#R #!#RANGE#!#4#!#1#!#0 +PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#R #!#RANGE#!#5#!#1#!#0 +PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#R #!#RANGE#!#5#!#1#!#0 +SmallDateTimePartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +SmallIntPartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +SmallMoneyPartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +TinyIntPartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +UniqueIdentifierPartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +VarBinaryPartitionFunction#!#R #!#RANGE#!#5#!#1#!#0 +VarCharPartitionFunction#!#R #!#RANGE#!#6#!#1#!#0 +~~END~~ + + +SELECT * FROM GetRangeMetadataView +GO +~~START~~ +nvarchar#!#int#!#int#!#sql_variant +BigIntPartitionFunction#!#1#!#1#!#0 +BigIntPartitionFunction#!#1#!#2#!#100 +BigIntPartitionFunction#!#1#!#3#!#1000 +BigIntPartitionFunction#!#1#!#4#!#10000 +CharPartitionFunction#!#1#!#1#!#A +CharPartitionFunction#!#1#!#2#!#D +CharPartitionFunction#!#1#!#3#!#F +CharPartitionFunction#!#1#!#4#!#K +CharPartitionFunction#!#1#!#5#!#P +CharPartitionFunction#!#1#!#6#!#U +CharPartitionFunction#!#1#!#7#!#Z +DatePartitionFunction#!#1#!#1#!#2022-01-01 +DatePartitionFunction#!#1#!#2#!#2022-07-01 +DatePartitionFunction#!#1#!#3#!#2023-01-01 +DateTime2PartitionFunction#!#1#!#1#!#2019-01-01 00:00:00.0 +DateTime2PartitionFunction#!#1#!#2#!#2022-01-01 00:00:00.0 +DateTime2PartitionFunction#!#1#!#3#!#2022-07-01 00:00:00.0 +DateTimePartitionFunction#!#1#!#1#!#2019-01-01 00:00:00.0 +DateTimePartitionFunction#!#1#!#2#!#2022-01-01 00:00:00.0 +DateTimePartitionFunction#!#1#!#3#!#2022-07-01 00:00:00.0 +DecimalPartitionFunction#!#1#!#1#!#0.00000 +DecimalPartitionFunction#!#1#!#2#!#100.00000 +DecimalPartitionFunction#!#1#!#3#!#200.00000 +DecimalPartitionFunction#!#1#!#4#!#300.00000 +IntPartitionFunction#!#1#!#1#!#0 +IntPartitionFunction#!#1#!#2#!#500 +IntPartitionFunction#!#1#!#3#!#1000 +MoneyPartitionFunction#!#1#!#1#!#2.5679 +MoneyPartitionFunction#!#1#!#2#!#3.5679 +MoneyPartitionFunction#!#1#!#3#!#4.9100 +NCharPartitionFunction#!#1#!#1#!#A +NCharPartitionFunction#!#1#!#2#!#B +NCharPartitionFunction#!#1#!#3#!#F +NCharPartitionFunction#!#1#!#4#!#K +NCharPartitionFunction#!#1#!#5#!#P +NCharPartitionFunction#!#1#!#6#!#U +NCharPartitionFunction#!#1#!#7#!#Z +NumericPartitionFunction#!#1#!#1#!#0.00 +NumericPartitionFunction#!#1#!#2#!#10.00 +NumericPartitionFunction#!#1#!#3#!#20.00 +NumericPartitionFunction#!#1#!#4#!#30.00 +NVarCharPartitionFunction#!#1#!#1#!#Apple +NVarCharPartitionFunction#!#1#!#2#!#Banana +NVarCharPartitionFunction#!#1#!#3#!#Cherry +NVarCharPartitionFunction#!#1#!#4#!#Date +NVarCharPartitionFunction#!#1#!#5#!#Mango +PARTITION_FUNCTION 유니코드스키마👻 #!#1#!#1#!#0 +PARTITION_FUNCTION 유니코드스키마👻 #!#1#!#2#!#500 +PARTITION_FUNCTION 유니코드스키마👻 #!#1#!#3#!#1000 +PARTITION_FUNCTION 😎$@ #123 🌍rder #!#1#!#1#!#0 +PARTITION_FUNCTION 😎$@ #123 🌍rder #!#1#!#2#!#500 +PARTITION_FUNCTION 😎$@ #123 🌍rder #!#1#!#3#!#1000 +PARTITION_FUNCTIONログインαιώνια#!#1#!#1#!#0 +PARTITION_FUNCTIONログインαιώνια#!#1#!#2#!#500 +PARTITION_FUNCTIONログインαιώνια#!#1#!#3#!#1000 +PartitionFunctionHavingDifferentCollationInput#!#1#!#1#!#châu phố +PartitionFunctionHavingDifferentCollationInput#!#1#!#2#!#Jane Smith +PartitionFunctionHavingDifferentCollationInput#!#1#!#3#!#John Doe +PartitionFunctionHavingDifferentCollationInput#!#1#!#4#!#Müller GmbH +PartitionFunctionInsideProc1#!#1#!#1#!#500 +PartitionFunctionInsideProc1#!#1#!#2#!#1000 +PartitionFunctionInsideProc1#!#1#!#3#!#10000 +PartitionFunctionInsideProc2#!#1#!#1#!#500 +PartitionFunctionInsideProc2#!#1#!#2#!#1000 +PartitionFunctionInsideProc2#!#1#!#3#!#10000 +PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#1#!#1#!#0 +PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#1#!#2#!#100 +PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#1#!#3#!#1000 +PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#1#!#4#!#10000 +PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#1#!#1#!#0 +PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#1#!#2#!#100 +PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#1#!#3#!#1000 +PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#1#!#4#!#10000 +SmallDateTimePartitionFunction#!#1#!#1#!#2019-01-01 00:00:00.0 +SmallDateTimePartitionFunction#!#1#!#2#!#2022-01-01 00:00:00.0 +SmallDateTimePartitionFunction#!#1#!#3#!#2022-07-01 00:00:00.0 +SmallIntPartitionFunction#!#1#!#1#!#-32768 +SmallIntPartitionFunction#!#1#!#2#!#0 +SmallIntPartitionFunction#!#1#!#3#!#32767 +SmallMoneyPartitionFunction#!#1#!#1#!#2.5679 +SmallMoneyPartitionFunction#!#1#!#2#!#3.5679 +SmallMoneyPartitionFunction#!#1#!#3#!#4.9100 +TinyIntPartitionFunction#!#1#!#1#!#0 +TinyIntPartitionFunction#!#1#!#2#!#128 +TinyIntPartitionFunction#!#1#!#3#!#255 +UniqueIdentifierPartitionFunction#!#1#!#1#!#00000000-0000-0000-0000-000000000000 +UniqueIdentifierPartitionFunction#!#1#!#2#!#6F9619FF-8B86-D011-B42D-00C04FC964FF +UniqueIdentifierPartitionFunction#!#1#!#3#!#FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF +VarCharPartitionFunction#!#1#!#1#!#Apple +VarCharPartitionFunction#!#1#!#2#!#Banana +VarCharPartitionFunction#!#1#!#3#!#Cherry +VarCharPartitionFunction#!#1#!#4#!#Date +VarCharPartitionFunction#!#1#!#5#!#Mango +~~END~~ + + +SELECT * FROM GetRangeMetadataVarBinaryFunctionView +GO +~~START~~ +nvarchar#!#int#!#int#!#varbinary +BinaryPartitionFunction#!#1#!#1#!#00000000 +BinaryPartitionFunction#!#1#!#2#!#04000000 +BinaryPartitionFunction#!#1#!#3#!#08000000 +BinaryPartitionFunction#!#1#!#4#!#C0000000 +VarBinaryPartitionFunction#!#1#!#1#!#0000000000000000 +VarBinaryPartitionFunction#!#1#!#2#!#4000000000000000 +VarBinaryPartitionFunction#!#1#!#3#!#8000000000000000 +VarBinaryPartitionFunction#!#1#!#4#!#C000000000000000 +~~END~~ + + +SELECT * FROM GetParameterMetadataView +GO +~~START~~ +nvarchar#!#varchar#!#int#!#smallint#!#tinyint#!#tinyint#!#varchar +BigIntPartitionFunction#!#bigint#!#1#!#8#!#19#!#0#!# +BinaryPartitionFunction#!#binary#!#1#!#8000#!#0#!#0#!# +CharPartitionFunction#!#char#!#1#!#8000#!#0#!#0#!#chinese_prc_ci_as +DatePartitionFunction#!#date#!#1#!#3#!#10#!#0#!# +DateTime2PartitionFunction#!#datetime2#!#1#!#8#!#26#!#6#!# +DateTimePartitionFunction#!#datetime#!#1#!#8#!#23#!#3#!# +DecimalPartitionFunction#!#decimal#!#1#!#17#!#38#!#38#!# +IntPartitionFunction#!#int#!#1#!#4#!#10#!#0#!# +MoneyPartitionFunction#!#money#!#1#!#8#!#19#!#4#!# +NCharPartitionFunction#!#nchar#!#1#!#8000#!#0#!#0#!#chinese_prc_ci_as +NumericPartitionFunction#!#numeric#!#1#!#17#!#38#!#38#!# +NVarCharPartitionFunction#!#nvarchar#!#1#!#8000#!#0#!#0#!#chinese_prc_ci_as +PARTITION_FUNCTION 유니코드스키마👻 #!#int#!#1#!#4#!#10#!#0#!# +PARTITION_FUNCTION 😎$@ #123 🌍rder #!#int#!#1#!#4#!#10#!#0#!# +PARTITION_FUNCTIONログインαιώνια#!#int#!#1#!#4#!#10#!#0#!# +PartitionFunctionHavingDifferentCollationInput#!#nvarchar#!#1#!#8000#!#0#!#0#!#chinese_prc_ci_as +PartitionFunctionInsideProc1#!#int#!#1#!#4#!#10#!#0#!# +PartitionFunctionInsideProc2#!#int#!#1#!#4#!#10#!#0#!# +PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#bigint#!#1#!#8#!#19#!#0#!# +PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#bigint#!#1#!#8#!#19#!#0#!# +SmallDateTimePartitionFunction#!#smalldatetime#!#1#!#4#!#16#!#0#!# +SmallIntPartitionFunction#!#smallint#!#1#!#2#!#5#!#0#!# +SmallMoneyPartitionFunction#!#smallmoney#!#1#!#4#!#10#!#4#!# +TinyIntPartitionFunction#!#tinyint#!#1#!#1#!#3#!#0#!# +UniqueIdentifierPartitionFunction#!#uniqueidentifier#!#1#!#16#!#0#!#0#!# +VarBinaryPartitionFunction#!#varbinary#!#1#!#8000#!#0#!#0#!# +VarCharPartitionFunction#!#varchar#!#1#!#8000#!#0#!#0#!#chinese_prc_ci_as +~~END~~ + + +SELECT * FROM GetPartitionSchemesMetadataView +GO +~~START~~ +nvarchar#!#nvarchar#!#char#!#nvarchar#!#bit#!#bit +BigIntPartitionScheme#!#BigIntPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +BinaryPartitionScheme#!#BinaryPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +CharPartitionScheme#!#CharPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +DatePartitionScheme#!#DatePartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +DateTime2PartitionScheme#!#DateTime2PartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +DateTimePartitionScheme#!#DateTimePartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +DecimalPartitionScheme#!#DecimalPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +IntPartitionScheme#!#IntPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +MoneyPartitionScheme#!#MoneyPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +NCharPartitionScheme#!#NCharPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +NumericPartitionScheme#!#NumericPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +NVarCharPartitionScheme#!#NVarCharPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +PARTITION_SCHEME 유니코드스키마👻 #!#PARTITION_FUNCTION 유니코드스키마👻 #!#PS#!#PARTITION_SCHEME#!#0#!#0 +PARTITION_SCHEME 😎$@ #123 🌍rder #!#PARTITION_FUNCTION 😎$@ #123 🌍rder #!#PS#!#PARTITION_SCHEME#!#0#!#0 +PARTITION_SCHEMEログインαιώνια#!#PARTITION_FUNCTIONログインαιώνια#!#PS#!#PARTITION_SCHEME#!#0#!#0 +PartitionSchemeInsideProc1#!#PartitionFunctionInsideProc1#!#PS#!#PARTITION_SCHEME#!#0#!#0 +PartitionSchemeInsideProc2#!#PartitionFunctionInsideProc2#!#PS#!#PARTITION_SCHEME#!#0#!#0 +PartitionSchemeNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#PS#!#PARTITION_SCHEME#!#0#!#0 +PartitionSchemeNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#PS#!#PARTITION_SCHEME#!#0#!#0 +SmallDateTimePartitionScheme#!#SmallDateTimePartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +SmallIntPartitionScheme#!#SmallIntPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +SmallMoneyPartitionScheme#!#SmallMoneyPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +TinyIntPartitionScheme#!#TinyIntPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +UniqueIdentifierPartitionScheme#!#UniqueIdentifierPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +VarBinaryPartitionScheme#!#VarBinaryPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +VarCharPartitionScheme#!#VarCharPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +~~END~~ + + +SELECT * FROM PartitionFunctionContainsDuplicateName() +GO +~~START~~ +nvarchar +~~END~~ + + +SELECT * FROM PartitionFunctionContainsDuplicateIDs() +GO +~~START~~ +int +~~END~~ + + +SELECT * FROM PartitionSchemeContainsDuplicateName() +GO +~~START~~ +nvarchar +~~END~~ + + +SELECT * FROM PartitionSchemeContainsDuplicateIDs() +GO +~~START~~ +int +~~END~~ + + +SELECT * FROM GetPartitionSchemeOrFilegroupForTableOrIndex +GO +~~START~~ +varchar#!#varchar#!#nvarchar +partition_vu_prepare_bigint_table#!##!#BigIntPartitionScheme +partition_vu_prepare_bigint_table#!#partition_vu_prepare_bigint_ind877afb285426cec9d46b047e3cf96f63#!#BigIntPartitionScheme +partition_vu_prepare_binary_table#!##!#BinaryPartitionScheme +partition_vu_prepare_binary_table#!#partition_vu_prepare_binary_ind48a88b3c8178211af1ed1dcf4cfbe503#!#BinaryPartitionScheme +partition_vu_prepare_char_table#!##!#CharPartitionScheme +partition_vu_prepare_char_table#!#partition_vu_prepare_char_index32fed8129381de1b5745e90cd811516f#!#CharPartitionScheme +partition_vu_prepare_date_table#!##!#DatePartitionScheme +partition_vu_prepare_date_table#!#partition_vu_prepare_date_indexf571a291edad587ba646fc34c4566844#!#DatePartitionScheme +partition_vu_prepare_datetime_table#!##!#DateTimePartitionScheme +partition_vu_prepare_datetime_table#!#partition_vu_prepare_datetime_i364577d0a406eee6e806be980ac15d2e#!#DateTimePartitionScheme +partition_vu_prepare_datetime2_table#!##!#DateTime2PartitionScheme +partition_vu_prepare_datetime2_table#!#partition_vu_prepare_datetime2_4cad7647322c234b34b97cddb3cd1ad6#!#DateTime2PartitionScheme +partition_vu_prepare_decimal_table#!##!#DecimalPartitionScheme +partition_vu_prepare_decimal_table#!#partition_vu_prepare_decimal_infc7570aeccbb040dde39974c476a7ec9#!#DecimalPartitionScheme +partition_vu_prepare_int_table#!##!#IntPartitionScheme +partition_vu_prepare_int_table#!#partition_vu_prepare_int_indexpbbe9a6f0ef5edf6e63fa853dac4ed046#!#IntPartitionScheme +partition_vu_prepare_int_table#!#partition_vu_prepare_int_table_id_key#!#IntPartitionScheme +partition_vu_prepare_money_table#!##!#MoneyPartitionScheme +partition_vu_prepare_money_table#!#partition_vu_prepare_money_inde9b6a61ad06c0883c6d0f95b2fec9eeee#!#MoneyPartitionScheme +partition_vu_prepare_nchar_table#!##!#NCharPartitionScheme +partition_vu_prepare_nchar_table#!#partition_vu_prepare_nchar_indecdc4872501ea902494c8f710f4e9dbb1#!#NCharPartitionScheme +partition_vu_prepare_normal_table#!##!#PRIMARY +partition_vu_prepare_normal_table#!#partition_vu_prepare_normal_inded6315af14d88f45711ba24e46851b8f#!#PRIMARY +partition_vu_prepare_numeric_table#!##!#NumericPartitionScheme +partition_vu_prepare_numeric_table#!#partition_vu_prepare_numeric_inf04f315c86929345e23bee80713cf963#!#NumericPartitionScheme +partition_vu_prepare_nvarchar_table#!##!#NVarCharPartitionScheme +partition_vu_prepare_nvarchar_table#!#partition_vu_prepare_nvarchar_if89fa8cc46282fa6dc23e9f5b834f3ec#!#NVarCharPartitionScheme +partition_vu_prepare_smalldatetime_table#!##!#SmallDateTimePartitionScheme +partition_vu_prepare_smalldatetime_table#!#partition_vu_prepare_smalldatetfe8f8bfb8c766f9a1bcd804238ff35d8#!#SmallDateTimePartitionScheme +partition_vu_prepare_smallint_table#!##!#SmallIntPartitionScheme +partition_vu_prepare_smallint_table#!#partition_vu_prepare_smallint_i3eae48e3a131ed23416aa2891b58d579#!#SmallIntPartitionScheme +partition_vu_prepare_smallmoney_table#!##!#SmallMoneyPartitionScheme +partition_vu_prepare_smallmoney_table#!#partition_vu_prepare_smallmoney68389bf5dc5c581b33c4dbb8a3dc1dc8#!#SmallMoneyPartitionScheme +partition_vu_prepare_tinyint_table#!##!#TinyIntPartitionScheme +partition_vu_prepare_tinyint_table#!#partition_vu_prepare_tinyint_in02b271c73e639954190c6a45bd5dd1bb#!#TinyIntPartitionScheme +partition_vu_prepare_uniqueidentifier_table#!##!#UniqueIdentifierPartitionScheme +partition_vu_prepare_uniqueidentifier_table#!#partition_vu_prepare_uniqueidend39220cd3f46c5b2cea8c338a387aedf#!#UniqueIdentifierPartitionScheme +partition_vu_prepare_varbinary_table#!##!#VarBinaryPartitionScheme +partition_vu_prepare_varbinary_table#!#partition_vu_prepare_varbinary_26e1223f68c4186a96126a57446ac386#!#VarBinaryPartitionScheme +partition_vu_prepare_varchar_table#!##!#VarCharPartitionScheme +partition_vu_prepare_varchar_table#!#partition_vu_prepare_varchar_inc528f397ba573964de161e03035b8f08#!#VarCharPartitionScheme +~~END~~ + + +SELECT * FROM GetFileGroupMappingOfPartitionScheme +GO +~~START~~ +nvarchar#!#nvarchar#!#int +IntPartitionScheme#!#PRIMARY#!#1 +IntPartitionScheme#!#PRIMARY#!#2 +IntPartitionScheme#!#PRIMARY#!#3 +IntPartitionScheme#!#PRIMARY#!#4 +SmallIntPartitionScheme#!#PRIMARY#!#1 +SmallIntPartitionScheme#!#PRIMARY#!#2 +SmallIntPartitionScheme#!#PRIMARY#!#3 +SmallIntPartitionScheme#!#PRIMARY#!#4 +SmallIntPartitionScheme#!#PRIMARY#!#5 +~~END~~ + + +SELECT * FROM GetPartitionedTablePartitioningColumn +GO +~~START~~ +varchar#!#varchar#!#tinyint +partition_vu_prepare_bigint_table#!#id#!#1 +partition_vu_prepare_binary_table#!#id#!#1 +partition_vu_prepare_char_table#!#id#!#1 +partition_vu_prepare_date_table#!#id#!#1 +partition_vu_prepare_datetime_table#!#id#!#1 +partition_vu_prepare_datetime2_table#!#id#!#1 +partition_vu_prepare_decimal_table#!#id#!#1 +partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_money_table#!#id#!#1 +partition_vu_prepare_nchar_table#!#id#!#1 +partition_vu_prepare_numeric_table#!#id#!#1 +partition_vu_prepare_nvarchar_table#!#id#!#1 +partition_vu_prepare_smalldatetime_table#!#id#!#1 +partition_vu_prepare_smallint_table#!#id#!#1 +partition_vu_prepare_smallmoney_table#!#id#!#1 +partition_vu_prepare_tinyint_table#!#id#!#1 +partition_vu_prepare_uniqueidentifier_table#!#id#!#1 +partition_vu_prepare_varbinary_table#!#id#!#1 +partition_vu_prepare_varchar_table#!#id#!#1 +~~END~~ + + +SELECT * FROM GetPartitionedIndexPartitioningColumn +GO +~~START~~ +varchar#!#varchar#!#varchar#!#tinyint +partition_vu_prepare_bigint_ind877afb285426cec9d46b047e3cf96f63#!#partition_vu_prepare_bigint_table#!#id#!#1 +partition_vu_prepare_bigint_ind877afb285426cec9d46b047e3cf96f63#!#partition_vu_prepare_bigint_table#!#id#!#1 +partition_vu_prepare_binary_ind48a88b3c8178211af1ed1dcf4cfbe503#!#partition_vu_prepare_binary_table#!#id#!#1 +partition_vu_prepare_binary_ind48a88b3c8178211af1ed1dcf4cfbe503#!#partition_vu_prepare_binary_table#!#id#!#1 +partition_vu_prepare_char_index32fed8129381de1b5745e90cd811516f#!#partition_vu_prepare_char_table#!#id#!#1 +partition_vu_prepare_char_index32fed8129381de1b5745e90cd811516f#!#partition_vu_prepare_char_table#!#id#!#1 +partition_vu_prepare_date_indexf571a291edad587ba646fc34c4566844#!#partition_vu_prepare_date_table#!#id#!#1 +partition_vu_prepare_date_indexf571a291edad587ba646fc34c4566844#!#partition_vu_prepare_date_table#!#id#!#1 +partition_vu_prepare_datetime_i364577d0a406eee6e806be980ac15d2e#!#partition_vu_prepare_datetime_table#!#id#!#1 +partition_vu_prepare_datetime_i364577d0a406eee6e806be980ac15d2e#!#partition_vu_prepare_datetime_table#!#id#!#1 +partition_vu_prepare_datetime2_4cad7647322c234b34b97cddb3cd1ad6#!#partition_vu_prepare_datetime2_table#!#id#!#1 +partition_vu_prepare_datetime2_4cad7647322c234b34b97cddb3cd1ad6#!#partition_vu_prepare_datetime2_table#!#id#!#1 +partition_vu_prepare_decimal_infc7570aeccbb040dde39974c476a7ec9#!#partition_vu_prepare_decimal_table#!#id#!#1 +partition_vu_prepare_decimal_infc7570aeccbb040dde39974c476a7ec9#!#partition_vu_prepare_decimal_table#!#id#!#1 +partition_vu_prepare_int_indexpbbe9a6f0ef5edf6e63fa853dac4ed046#!#partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_int_indexpbbe9a6f0ef5edf6e63fa853dac4ed046#!#partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_int_indexpbbe9a6f0ef5edf6e63fa853dac4ed046#!#partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_int_table_id_key#!#partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_int_table_id_key#!#partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_int_table_id_key#!#partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_money_inde9b6a61ad06c0883c6d0f95b2fec9eeee#!#partition_vu_prepare_money_table#!#id#!#1 +partition_vu_prepare_money_inde9b6a61ad06c0883c6d0f95b2fec9eeee#!#partition_vu_prepare_money_table#!#id#!#1 +partition_vu_prepare_nchar_indecdc4872501ea902494c8f710f4e9dbb1#!#partition_vu_prepare_nchar_table#!#id#!#1 +partition_vu_prepare_nchar_indecdc4872501ea902494c8f710f4e9dbb1#!#partition_vu_prepare_nchar_table#!#id#!#1 +partition_vu_prepare_numeric_inf04f315c86929345e23bee80713cf963#!#partition_vu_prepare_numeric_table#!#id#!#1 +partition_vu_prepare_numeric_inf04f315c86929345e23bee80713cf963#!#partition_vu_prepare_numeric_table#!#id#!#1 +partition_vu_prepare_nvarchar_if89fa8cc46282fa6dc23e9f5b834f3ec#!#partition_vu_prepare_nvarchar_table#!#id#!#1 +partition_vu_prepare_nvarchar_if89fa8cc46282fa6dc23e9f5b834f3ec#!#partition_vu_prepare_nvarchar_table#!#id#!#1 +partition_vu_prepare_smalldatetfe8f8bfb8c766f9a1bcd804238ff35d8#!#partition_vu_prepare_smalldatetime_table#!#id#!#1 +partition_vu_prepare_smalldatetfe8f8bfb8c766f9a1bcd804238ff35d8#!#partition_vu_prepare_smalldatetime_table#!#id#!#1 +partition_vu_prepare_smallint_i3eae48e3a131ed23416aa2891b58d579#!#partition_vu_prepare_smallint_table#!#id#!#1 +partition_vu_prepare_smallint_i3eae48e3a131ed23416aa2891b58d579#!#partition_vu_prepare_smallint_table#!#id#!#1 +partition_vu_prepare_smallmoney68389bf5dc5c581b33c4dbb8a3dc1dc8#!#partition_vu_prepare_smallmoney_table#!#id#!#1 +partition_vu_prepare_smallmoney68389bf5dc5c581b33c4dbb8a3dc1dc8#!#partition_vu_prepare_smallmoney_table#!#id#!#1 +partition_vu_prepare_tinyint_in02b271c73e639954190c6a45bd5dd1bb#!#partition_vu_prepare_tinyint_table#!#id#!#1 +partition_vu_prepare_tinyint_in02b271c73e639954190c6a45bd5dd1bb#!#partition_vu_prepare_tinyint_table#!#id#!#1 +partition_vu_prepare_uniqueidend39220cd3f46c5b2cea8c338a387aedf#!#partition_vu_prepare_uniqueidentifier_table#!#id#!#1 +partition_vu_prepare_uniqueidend39220cd3f46c5b2cea8c338a387aedf#!#partition_vu_prepare_uniqueidentifier_table#!#id#!#1 +partition_vu_prepare_varbinary_26e1223f68c4186a96126a57446ac386#!#partition_vu_prepare_varbinary_table#!#id#!#1 +partition_vu_prepare_varbinary_26e1223f68c4186a96126a57446ac386#!#partition_vu_prepare_varbinary_table#!#id#!#1 +partition_vu_prepare_varchar_inc528f397ba573964de161e03035b8f08#!#partition_vu_prepare_varchar_table#!#id#!#1 +partition_vu_prepare_varchar_inc528f397ba573964de161e03035b8f08#!#partition_vu_prepare_varchar_table#!#id#!#1 +~~END~~ + + +SELECT * FROM GetSysPartitionsMetadata +GO +~~START~~ +varchar#!#int#!#int +363863941f079adaa9aa733200e57c9f_partition_0_id_key#!#1#!#2 +363863941f079adaa9aa733200e57c9f_partition_0#!#1#!#0 +363863941f079adaa9aa733200e57c9f_partition_0_value_idx#!#1#!#3 +363863941f079adaa9aa733200e57c9f_partition_1_id_key#!#2#!#2 +363863941f079adaa9aa733200e57c9f_partition_1#!#2#!#0 +363863941f079adaa9aa733200e57c9f_partition_1_value_idx#!#2#!#3 +363863941f079adaa9aa733200e57c9f_partition_2_id_key#!#3#!#2 +363863941f079adaa9aa733200e57c9f_partition_2#!#3#!#0 +363863941f079adaa9aa733200e57c9f_partition_2_value_idx#!#3#!#3 +363863941f079adaa9aa733200e57c9f_partition_3_value_idx#!#4#!#3 +363863941f079adaa9aa733200e57c9f_partition_3#!#4#!#0 +363863941f079adaa9aa733200e57c9f_partition_3_id_key#!#4#!#2 +partition_vu_prepare_normal_inded6315af14d88f45711ba24e46851b8f#!#1#!#2 +partition_vu_prepare_normal_table#!#1#!#0 +~~END~~ + + + + + + + + +-------------------------------------------------- +--- Test Partition Function Argument Limit +-------------------------------------------------- +-- create with max allowed limit +DECLARE @partition_count INT = 14998; +DECLARE @partition_interval INT = 1000; +DECLARE @partition_function_definition VARCHAR(MAX) = 'CREATE PARTITION FUNCTION PartitionFunctionWith14999Arg (int) AS RANGE RIGHT FOR VALUES ('; +-- Build the partition function definition +DECLARE @i INT = 1; +WHILE @i <= @partition_count +BEGIN + SET @partition_function_definition = @partition_function_definition + CAST((@i * @partition_interval) AS VARCHAR(10)) + ', ' + SET @i = @i + 1; +END +SET @partition_function_definition = @partition_function_definition + CAST((@i * @partition_interval) AS VARCHAR(10)) + ')' +-- Execute the partition function creation +EXEC (@partition_function_definition) +GO + +SELECT fanout FROM sys.partition_functions WHERE name = 'PartitionFunctionWith14999Arg' +GO +~~START~~ +int +15000 +~~END~~ + + +DROP PARTITION FUNCTION PartitionFunctionWith14999Arg +GO + + + + + + + +-- create when arg > max allowed limit should throw error +DECLARE @partition_count INT = 14999; +DECLARE @partition_interval INT = 1000; +DECLARE @partition_function_definition VARCHAR(MAX) = 'CREATE PARTITION FUNCTION PartitionFunctionWith15000Arg (int) AS RANGE RIGHT FOR VALUES ('; +-- Build the partition function definition +DECLARE @i INT = 1; +WHILE @i <= @partition_count +BEGIN + SET @partition_function_definition = @partition_function_definition + CAST((@i * @partition_interval) AS VARCHAR(10)) + ', ' + SET @i = @i + 1; +END +SET @partition_function_definition = @partition_function_definition + CAST((@i * @partition_interval) AS VARCHAR(10)) + ')' +-- Execute the partition function creation +EXEC (@partition_function_definition) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: CREATE/ALTER partition function failed as only a maximum of 15000 partitions can be created.)~~ + + + +-------------------------------------------------- +--- Test Partition Function/Scheme Name Limit +-------------------------------------------------- +CREATE PARTITION FUNCTION PartitionFunctionNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz (bigint) +AS RANGE RIGHT FOR VALUES (0, 10000, 100, 1000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The identifier that starts with 'PartitionFunctionNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmno' is too long. Maximum length is 128.)~~ + + +CREATE PARTITION SCHEME PartitionSchemeNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz AS +PARTITION PartitionFunctionDoesNotExists +ALL TO ([PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The identifier that starts with 'PartitionSchemeNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopq' is too long. Maximum length is 128.)~~ + + + +-------------------------------------------------- +--- TO test Permission +-------------------------------------------------- +USE PartitionDb; +GO + +CREATE LOGIN partition_l1 WITH PASSWORD = '12345678'; +GO + +CREATE USER partition_u1 FOR LOGIN partition_l1; +GO + +-- tsql user=partition_l1 password=12345678 +USE PartitionDb; +GO + +SELECT CURRENT_USER +GO +~~START~~ +varchar +partition_u1 +~~END~~ + + + +-- CREATE/DROP should throw permission error +------------------------------------------------------------ +--- only db owner and logins which are member of sysadmin +--- are allowed to create/drop partition function and scheme +------------------------------------------------------------ +CREATE PARTITION FUNCTION TestPartitionFunction (int) +AS RANGE RIGHT FOR VALUES (500, 1000, 10000); +Go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: User does not have permission to perform this action.)~~ + + +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION PartitionFunctionDoesNotExists +ALL TO ([PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: User does not have permission to perform this action.)~~ + + +DROP PARTITION FUNCTION IntPartitionFunction +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the partition function 'IntPartitionFunction', because it does not exist or you do not have permission.)~~ + + +DROP PARTITION SCHEME IntPartitionScheme +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the partition scheme 'IntPartitionScheme', because it does not exist or you do not have permission.)~~ + + +------------------------------------------ +--- all user can access the metadata +------------------------------------------ +SELECT + name, type, type_desc, fanout, boundary_value_on_right, is_system + FROM + sys.partition_functions +go +~~START~~ +nvarchar#!#char#!#nvarchar#!#int#!#bit#!#bit +PartitionDb_PartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +~~END~~ + + +SELECT + ps.name as scheme_name, pf.name as function_name, ps.type, ps.type_desc, ps.is_default, ps.is_system + FROM + sys.partition_schemes ps + INNER JOIN + sys.partition_functions pf on (ps.function_id = pf.function_id) +go +~~START~~ +nvarchar#!#nvarchar#!#char#!#nvarchar#!#bit#!#bit +PartitionDb_PartitionScheme#!#PartitionDb_PartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +~~END~~ + + + +-- psql + +------------------------------------------------------------ +--- all user can use the metadata of the partition scheme +--- to create table if they permission to create table +------------------------------------------------------------ +-- grant create permission to user on schema so that it can create table +DO $$ +DECLARE + schema_name TEXT; +BEGIN + IF current_setting('babelfishpg_tsql.migration_mode') = 'multi-db' THEN + schema_name := 'partitiondb_dbo'; + ELSE + schema_name := 'dbo'; + END IF; + EXECUTE 'GRANT CREATE ON SCHEMA ' || quote_ident(schema_name) || ' TO partitiondb_partition_u1'; +END$$; +GO + +-- tsql user=partition_l1 password=12345678 +USE PartitionDb; +GO + +SELECT CURRENT_USER +GO +~~START~~ +varchar +partition_u1 +~~END~~ + + +CREATE TABLE PartitionDb_TestPartitionTable ( + Id INT, + Value sys.varchar(20) +) ON PartitionDb_PartitionScheme(Id); +GO + +DROP TABLE PartitionDb_TestPartitionTable +GO + +-- psql + +-- revoke create permission from user on schema +DO $$ +DECLARE + schema_name TEXT; +BEGIN + IF current_setting('babelfishpg_tsql.migration_mode') = 'multi-db' THEN + schema_name := 'partitiondb_dbo'; + ELSE + schema_name := 'dbo'; + END IF; + EXECUTE 'REVOKE CREATE ON SCHEMA ' || quote_ident(schema_name) || ' FROM partitiondb_partition_u1'; +END$$; +GO + +-- tsql +----------------------------------------------------------------------------------- +--- DB owner should be able to create/drop partition function and scheme +---------------------------------------------------------------------------------- +-- make the user a DB owner +USE PartitionDb; +GO + +DROP USER partition_u1; +GO + +execute sp_changedbowner 'partition_l1' +GO + +-- tsql user=partition_l1 password=12345678 +USE PartitionDb; +GO + +SELECT CURRENT_USER +GO +~~START~~ +varchar +dbo +~~END~~ + +-- CREATE/DROP should work now +CREATE PARTITION FUNCTION TestPartitionFunction (int) +AS RANGE RIGHT FOR VALUES (500, 1000, 10000); +Go + +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION TestPartitionFunction +ALL TO ([PRIMARY]); +GO + +DROP PARTITION SCHEME TestPartitionScheme +go + +DROP PARTITION FUNCTION TestPartitionFunction +go + +-- tsql +USE master +GO + + +------------------------------------------------------------------------------------------------------------ +--- Test error during Implicit Conversion of range values in Partition Function for each datatypes +------------------------------------------------------------------------------------------------------------ +CREATE PARTITION FUNCTION NewIntPartitionFunction (int) +AS RANGE RIGHT FOR VALUES (500, 1000, cast('xyz' as varchar)); +-- having duplicates also, but first it should try to convert and fail +CREATE PARTITION FUNCTION NewBigIntPartitionFunction (bigint) +AS RANGE RIGHT FOR VALUES (1000, 1000, 1000, cast('xyz' as varchar), 1000, 1000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewSmallIntPartitionFunction (smallint) +AS RANGE RIGHT FOR VALUES ('xyz', 32767, -32768); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 1 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewTinyIntPartitionFunction (tinyint) +AS RANGE RIGHT FOR VALUES (0, 255, cast('xyz' as varchar)); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewDecimalPartitionFunction (decimal(10, 5)) +AS RANGE RIGHT FOR VALUES (0.0, 300.0, 200.0, 'xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 4 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewNumericPartitionFunction (numeric(5, 2)) +AS RANGE RIGHT FOR VALUES (0.0, 30.0, 10.0, 'xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 4 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewDatePartitionFunction (date) +AS RANGE RIGHT FOR VALUES ('2022-07-01', '2022-01-01','xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewDateTimePartitionFunction (datetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01 00:00:00', 'xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewDateTime2PartitionFunction (datetime2(3)) +AS RANGE RIGHT FOR VALUES ('2022-01-01 00:00:00.000', '2022-07-01 00:00:00.000', 'xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewSmallDateTimePartitionFunction (smalldatetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01', cast(0x123 as binary(4))); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewCharPartitionFunction (char(5)) +AS RANGE RIGHT FOR VALUES ('A', 'F', 'K', 'P', 'U', 'Z', cast(0x123 as binary(4))); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 7 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewNCharPartitionFunction (nchar(5)) +AS RANGE RIGHT FOR VALUES (N'A', N'F', N'K', N'P', N'U', N'Z', cast(0x123 as binary(4))); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 7 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewBinaryPartitionFunction (binary(4)) +AS RANGE RIGHT FOR VALUES (0x000, 0x800, 0x400, 'xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 4 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewVarBinaryPartitionFunction (varbinary(8)) +AS RANGE RIGHT FOR VALUES (0x0000000000000000, 0x8000000000000000, 0x4000000000000000, 'xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 4 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewUniqueIdentifierPartitionFunction (uniqueidentifier) +AS RANGE RIGHT FOR VALUES ('00000000-0000-0000-0000-000000000000', 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF', 123); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + + +-------------------------------------------------- +--- DROP PARTITION FUNCTION/SCHEME/TABLE using procedure +-------------------------------------------------- +EXEC PartitionProcedureDropPartitionTable +GO + +EXEC PartitionProcedureDropPartitionScheme +GO + +EXEC PartitionProcedureDropPartitionFunction +GO + +EXEC PartitionProcedureDropPartitionFunctionSchemeAndTable +GO + + +--------------------------------------------------------------------------- +--- PARTITIONED TABLES test +--------------------------------------------------------------------------- +SELECT * FROM GetPartitionedTableListFromSysTablesView +GO +~~START~~ +varchar +partition_vu_prepare_bigint_table +partition_vu_prepare_binary_table +partition_vu_prepare_char_table +partition_vu_prepare_date_table +partition_vu_prepare_datetime_table +partition_vu_prepare_datetime2_table +partition_vu_prepare_decimal_table +partition_vu_prepare_int_table +partition_vu_prepare_money_table +partition_vu_prepare_nchar_table +partition_vu_prepare_normal_table +partition_vu_prepare_numeric_table +partition_vu_prepare_nvarchar_table +partition_vu_prepare_smalldatetime_table +partition_vu_prepare_smallint_table +partition_vu_prepare_smallmoney_table +partition_vu_prepare_tinyint_table +partition_vu_prepare_uniqueidentifier_table +partition_vu_prepare_varbinary_table +partition_vu_prepare_varchar_table +~~END~~ + + +--------------------------------------------------------------------------- +--- PARTITIONED INDEX test +--------------------------------------------------------------------------- +SELECT * FROM GetPartitionedIndexListFromSysIndexesView +GO +~~START~~ +varchar +partition_vu_prepare_bigint_ind877afb285426cec9d46b047e3cf96f63 +partition_vu_prepare_binary_ind48a88b3c8178211af1ed1dcf4cfbe503 +partition_vu_prepare_char_index32fed8129381de1b5745e90cd811516f +partition_vu_prepare_date_indexf571a291edad587ba646fc34c4566844 +partition_vu_prepare_datetime_i364577d0a406eee6e806be980ac15d2e +partition_vu_prepare_datetime2_4cad7647322c234b34b97cddb3cd1ad6 +partition_vu_prepare_decimal_infc7570aeccbb040dde39974c476a7ec9 +partition_vu_prepare_int_indexpbbe9a6f0ef5edf6e63fa853dac4ed046 +partition_vu_prepare_int_table_id_key +partition_vu_prepare_money_inde9b6a61ad06c0883c6d0f95b2fec9eeee +partition_vu_prepare_nchar_indecdc4872501ea902494c8f710f4e9dbb1 +partition_vu_prepare_normal_inded6315af14d88f45711ba24e46851b8f +partition_vu_prepare_numeric_inf04f315c86929345e23bee80713cf963 +partition_vu_prepare_nvarchar_if89fa8cc46282fa6dc23e9f5b834f3ec +partition_vu_prepare_smalldatetfe8f8bfb8c766f9a1bcd804238ff35d8 +partition_vu_prepare_smallint_i3eae48e3a131ed23416aa2891b58d579 +partition_vu_prepare_smallmoney68389bf5dc5c581b33c4dbb8a3dc1dc8 +partition_vu_prepare_tinyint_in02b271c73e639954190c6a45bd5dd1bb +partition_vu_prepare_uniqueidend39220cd3f46c5b2cea8c338a387aedf +partition_vu_prepare_varbinary_26e1223f68c4186a96126a57446ac386 +partition_vu_prepare_varchar_inc528f397ba573964de161e03035b8f08 +~~END~~ + + + +---------------------------------------------------------------------------------------------- +--- System views should list only metadata of Partitioned table(not of the partitions) +---------------------------------------------------------------------------------------------- +SELECT count(*) from sys.tables where name = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +1 +~~END~~ + + +SELECT count(*) from sys.all_columns where object_id = OBJECT_ID('partition_vu_prepare_int_table') +GO +~~START~~ +int +2 +~~END~~ + + +SELECT count(*) from sys.columns where object_id = OBJECT_ID('partition_vu_prepare_int_table') +GO +~~START~~ +int +2 +~~END~~ + + +SELECT count(*) from sys.indexes where object_id = OBJECT_ID('partition_vu_prepare_int_table') +GO +~~START~~ +int +3 +~~END~~ + + +SELECT count(*) from sys.index_columns where object_id = OBJECT_ID('partition_vu_prepare_int_table') +GO +~~START~~ +int +5 +~~END~~ + + +SELECT count(*) from sys.all_objects where name = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +1 +~~END~~ + + +SELECT count(*) from sys.sp_tables_view where TABLE_NAME = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +1 +~~END~~ + + +SELECT count(*) from information_schema.columns where TABLE_NAME = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +2 +~~END~~ + + +SELECT count(*) from information_schema.tables where TABLE_NAME = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +1 +~~END~~ + + +SELECT count(*) from information_schema.table_constraints where TABLE_NAME = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +2 +~~END~~ + + +SELECT count(*) from information_schema.CONSTRAINT_COLUMN_USAGE where TABLE_NAME = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +2 +~~END~~ + + +SELECT count(*) from information_schema.key_column_usage where TABLE_NAME = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +1 +~~END~~ + + +--------------------------------------------------------- +--- System views should not list metadata of Partitions +--------------------------------------------------------- +SELECT count(*) from sys.tables where name = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from sys.all_columns where object_id = OBJECT_ID('363863941f079adaa9aa733200e57c9f_partition_0') +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from sys.columns where object_id = OBJECT_ID('363863941f079adaa9aa733200e57c9f_partition_0') +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from sys.indexes where object_id = OBJECT_ID('363863941f079adaa9aa733200e57c9f_partition_0') +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from sys.index_columns where object_id = OBJECT_ID('363863941f079adaa9aa733200e57c9f_partition_0') +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from sys.all_objects where name = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from sys.sp_tables_view where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from information_schema.columns where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from information_schema.tables where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from information_schema.table_constraints where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from information_schema.CONSTRAINT_COLUMN_USAGE where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from information_schema.key_column_usage where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + + + +-- psql +--------------------------------------------------------------------------- +--- Run analyze on each table and enable query plan +--------------------------------------------------------------------------- +ANALYZE master_dbo.partition_vu_prepare_int_table; +ANALYZE master_dbo.partition_vu_prepare_bigint_table; +ANALYZE master_dbo.partition_vu_prepare_smallint_table; +ANALYZE master_dbo.partition_vu_prepare_tinyint_table; +ANALYZE master_dbo.partition_vu_prepare_decimal_table; +ANALYZE master_dbo.partition_vu_prepare_numeric_table; +ANALYZE master_dbo.partition_vu_prepare_money_table; +ANALYZE master_dbo.partition_vu_prepare_smallmoney_table; +ANALYZE master_dbo.partition_vu_prepare_date_table; +ANALYZE master_dbo.partition_vu_prepare_datetime_table; +ANALYZE master_dbo.partition_vu_prepare_datetime2_table; +ANALYZE master_dbo.partition_vu_prepare_smalldatetime_table; +ANALYZE master_dbo.partition_vu_prepare_char_table; +ANALYZE master_dbo.partition_vu_prepare_varchar_table; +ANALYZE master_dbo.partition_vu_prepare_nvarchar_table; +ANALYZE master_dbo.partition_vu_prepare_nchar_table; +ANALYZE master_dbo.partition_vu_prepare_binary_table; +ANALYZE master_dbo.partition_vu_prepare_varbinary_table; +ANALYZE master_dbo.partition_vu_prepare_uniqueidentifier_table; +GO + +-- tsql +SELECT set_config('babelfishpg_tsql.explain_costs', 'off', false) +GO +~~START~~ +text +off +~~END~~ + + +SET BABELFISH_SHOWPLAN_ALL ON +GO + + +--------------------------------------------------------------------------- +--- Query plan of select on partitioned tables +--------------------------------------------------------------------------- +SELECT * FROM partition_vu_prepare_int_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_int_table +Append + -> Seq Scan on "363863941f079adaa9aa733200e57c9f_partition_1" partition_vu_prepare_int_table_1 + -> Seq Scan on "363863941f079adaa9aa733200e57c9f_partition_2" partition_vu_prepare_int_table_2 + -> Seq Scan on "363863941f079adaa9aa733200e57c9f_partition_3" partition_vu_prepare_int_table_3 + -> Seq Scan on "363863941f079adaa9aa733200e57c9f_partition_0" partition_vu_prepare_int_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.752 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_bigint_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_bigint_table +Append + -> Seq Scan on "548bb344374ce8d65342b36428375873_partition_1" partition_vu_prepare_bigint_table_1 + -> Seq Scan on "548bb344374ce8d65342b36428375873_partition_2" partition_vu_prepare_bigint_table_2 + -> Seq Scan on "548bb344374ce8d65342b36428375873_partition_3" partition_vu_prepare_bigint_table_3 + -> Seq Scan on "548bb344374ce8d65342b36428375873_partition_4" partition_vu_prepare_bigint_table_4 + -> Seq Scan on "548bb344374ce8d65342b36428375873_partition_0" partition_vu_prepare_bigint_table_5 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.129 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_smallint_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_smallint_table +Append + -> Seq Scan on "12025e103721b70925744c196ce004cd_partition_1" partition_vu_prepare_smallint_table_1 + -> Seq Scan on "12025e103721b70925744c196ce004cd_partition_2" partition_vu_prepare_smallint_table_2 + -> Seq Scan on "12025e103721b70925744c196ce004cd_partition_3" partition_vu_prepare_smallint_table_3 + -> Seq Scan on "12025e103721b70925744c196ce004cd_partition_0" partition_vu_prepare_smallint_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.124 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_tinyint_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_tinyint_table +Append + -> Seq Scan on "61446d711d19b5970809387caa7fd3d3_partition_1" partition_vu_prepare_tinyint_table_1 + -> Seq Scan on "61446d711d19b5970809387caa7fd3d3_partition_2" partition_vu_prepare_tinyint_table_2 + -> Seq Scan on "61446d711d19b5970809387caa7fd3d3_partition_3" partition_vu_prepare_tinyint_table_3 + -> Seq Scan on "61446d711d19b5970809387caa7fd3d3_partition_0" partition_vu_prepare_tinyint_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.099 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_decimal_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_decimal_table +Append + -> Seq Scan on cda2902d769fd61eb60b1a461650212f_partition_1 partition_vu_prepare_decimal_table_1 + -> Seq Scan on cda2902d769fd61eb60b1a461650212f_partition_2 partition_vu_prepare_decimal_table_2 + -> Seq Scan on cda2902d769fd61eb60b1a461650212f_partition_3 partition_vu_prepare_decimal_table_3 + -> Seq Scan on cda2902d769fd61eb60b1a461650212f_partition_4 partition_vu_prepare_decimal_table_4 + -> Seq Scan on cda2902d769fd61eb60b1a461650212f_partition_0 partition_vu_prepare_decimal_table_5 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.095 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_numeric_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_numeric_table +Append + -> Seq Scan on "57405760297bb338f333c148aac5f845_partition_1" partition_vu_prepare_numeric_table_1 + -> Seq Scan on "57405760297bb338f333c148aac5f845_partition_2" partition_vu_prepare_numeric_table_2 + -> Seq Scan on "57405760297bb338f333c148aac5f845_partition_3" partition_vu_prepare_numeric_table_3 + -> Seq Scan on "57405760297bb338f333c148aac5f845_partition_4" partition_vu_prepare_numeric_table_4 + -> Seq Scan on "57405760297bb338f333c148aac5f845_partition_0" partition_vu_prepare_numeric_table_5 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.095 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_money_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_money_table +Append + -> Seq Scan on "640187c54e2c2984d190957d245a5fa5_partition_1" partition_vu_prepare_money_table_1 + -> Seq Scan on "640187c54e2c2984d190957d245a5fa5_partition_2" partition_vu_prepare_money_table_2 + -> Seq Scan on "640187c54e2c2984d190957d245a5fa5_partition_3" partition_vu_prepare_money_table_3 + -> Seq Scan on "640187c54e2c2984d190957d245a5fa5_partition_0" partition_vu_prepare_money_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.130 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_smallmoney_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_smallmoney_table +Append + -> Seq Scan on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_1" partition_vu_prepare_smallmoney_table_1 + -> Seq Scan on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_2" partition_vu_prepare_smallmoney_table_2 + -> Seq Scan on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_3" partition_vu_prepare_smallmoney_table_3 + -> Seq Scan on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_0" partition_vu_prepare_smallmoney_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.131 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_date_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_date_table +Append + -> Seq Scan on "4867824426e52acac5c93d9cbe8aa366_partition_1" partition_vu_prepare_date_table_1 + -> Seq Scan on "4867824426e52acac5c93d9cbe8aa366_partition_2" partition_vu_prepare_date_table_2 + -> Seq Scan on "4867824426e52acac5c93d9cbe8aa366_partition_3" partition_vu_prepare_date_table_3 + -> Seq Scan on "4867824426e52acac5c93d9cbe8aa366_partition_0" partition_vu_prepare_date_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.093 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_datetime_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_datetime_table +Append + -> Seq Scan on "751ce655481adf15600727bf291667f7_partition_1" partition_vu_prepare_datetime_table_1 + -> Seq Scan on "751ce655481adf15600727bf291667f7_partition_2" partition_vu_prepare_datetime_table_2 + -> Seq Scan on "751ce655481adf15600727bf291667f7_partition_3" partition_vu_prepare_datetime_table_3 + -> Seq Scan on "751ce655481adf15600727bf291667f7_partition_0" partition_vu_prepare_datetime_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.091 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_datetime2_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_datetime2_table +Append + -> Seq Scan on "5ed003cf80dacbb8cce0b21e175f7f94_partition_1" partition_vu_prepare_datetime2_table_1 + -> Seq Scan on "5ed003cf80dacbb8cce0b21e175f7f94_partition_2" partition_vu_prepare_datetime2_table_2 + -> Seq Scan on "5ed003cf80dacbb8cce0b21e175f7f94_partition_3" partition_vu_prepare_datetime2_table_3 + -> Seq Scan on "5ed003cf80dacbb8cce0b21e175f7f94_partition_0" partition_vu_prepare_datetime2_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.098 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_smalldatetime_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_smalldatetime_table +Append + -> Seq Scan on b5c2e665ec4a1219ba8510e33e45379b_partition_1 partition_vu_prepare_smalldatetime_table_1 + -> Seq Scan on b5c2e665ec4a1219ba8510e33e45379b_partition_2 partition_vu_prepare_smalldatetime_table_2 + -> Seq Scan on b5c2e665ec4a1219ba8510e33e45379b_partition_3 partition_vu_prepare_smalldatetime_table_3 + -> Seq Scan on b5c2e665ec4a1219ba8510e33e45379b_partition_0 partition_vu_prepare_smalldatetime_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.096 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_char_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_char_table +Append + -> Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_1" partition_vu_prepare_char_table_1 + -> Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_2" partition_vu_prepare_char_table_2 + -> Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_3" partition_vu_prepare_char_table_3 + -> Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_4" partition_vu_prepare_char_table_4 + -> Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_5" partition_vu_prepare_char_table_5 + -> Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_6" partition_vu_prepare_char_table_6 + -> Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_7" partition_vu_prepare_char_table_7 + -> Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_0" partition_vu_prepare_char_table_8 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.094 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_varchar_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_varchar_table +Append + -> Seq Scan on "933a5c7f0de13890324e53ee0711424b_partition_1" partition_vu_prepare_varchar_table_1 + -> Seq Scan on "933a5c7f0de13890324e53ee0711424b_partition_2" partition_vu_prepare_varchar_table_2 + -> Seq Scan on "933a5c7f0de13890324e53ee0711424b_partition_3" partition_vu_prepare_varchar_table_3 + -> Seq Scan on "933a5c7f0de13890324e53ee0711424b_partition_4" partition_vu_prepare_varchar_table_4 + -> Seq Scan on "933a5c7f0de13890324e53ee0711424b_partition_5" partition_vu_prepare_varchar_table_5 + -> Seq Scan on "933a5c7f0de13890324e53ee0711424b_partition_0" partition_vu_prepare_varchar_table_6 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.097 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_nvarchar_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_nvarchar_table +Append + -> Seq Scan on "320465af1d1bd21f5b29c57f9f4e5c51_partition_1" partition_vu_prepare_nvarchar_table_1 + -> Seq Scan on "320465af1d1bd21f5b29c57f9f4e5c51_partition_2" partition_vu_prepare_nvarchar_table_2 + -> Seq Scan on "320465af1d1bd21f5b29c57f9f4e5c51_partition_3" partition_vu_prepare_nvarchar_table_3 + -> Seq Scan on "320465af1d1bd21f5b29c57f9f4e5c51_partition_4" partition_vu_prepare_nvarchar_table_4 + -> Seq Scan on "320465af1d1bd21f5b29c57f9f4e5c51_partition_5" partition_vu_prepare_nvarchar_table_5 + -> Seq Scan on "320465af1d1bd21f5b29c57f9f4e5c51_partition_0" partition_vu_prepare_nvarchar_table_6 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.097 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_nchar_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_nchar_table +Append + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_1 partition_vu_prepare_nchar_table_1 + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_2 partition_vu_prepare_nchar_table_2 + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_3 partition_vu_prepare_nchar_table_3 + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_4 partition_vu_prepare_nchar_table_4 + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_5 partition_vu_prepare_nchar_table_5 + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_6 partition_vu_prepare_nchar_table_6 + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_7 partition_vu_prepare_nchar_table_7 + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_0 partition_vu_prepare_nchar_table_8 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.095 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_binary_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_binary_table +Append + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_1" partition_vu_prepare_binary_table_1 + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_2" partition_vu_prepare_binary_table_2 + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_3" partition_vu_prepare_binary_table_3 + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_4" partition_vu_prepare_binary_table_4 + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_0" partition_vu_prepare_binary_table_5 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.094 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_varbinary_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_varbinary_table +Append + -> Seq Scan on "77718961234110c3a22a3c977bc252d8_partition_1" partition_vu_prepare_varbinary_table_1 + -> Seq Scan on "77718961234110c3a22a3c977bc252d8_partition_2" partition_vu_prepare_varbinary_table_2 + -> Seq Scan on "77718961234110c3a22a3c977bc252d8_partition_3" partition_vu_prepare_varbinary_table_3 + -> Seq Scan on "77718961234110c3a22a3c977bc252d8_partition_4" partition_vu_prepare_varbinary_table_4 + -> Seq Scan on "77718961234110c3a22a3c977bc252d8_partition_0" partition_vu_prepare_varbinary_table_5 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.098 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_uniqueidentifier_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_uniqueidentifier_table +Append + -> Seq Scan on f3baf999c06d6ea82082a4c549baeb77_partition_1 partition_vu_prepare_uniqueidentifier_table_1 + -> Seq Scan on f3baf999c06d6ea82082a4c549baeb77_partition_2 partition_vu_prepare_uniqueidentifier_table_2 + -> Seq Scan on f3baf999c06d6ea82082a4c549baeb77_partition_3 partition_vu_prepare_uniqueidentifier_table_3 + -> Seq Scan on f3baf999c06d6ea82082a4c549baeb77_partition_0 partition_vu_prepare_uniqueidentifier_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.096 ms +~~END~~ + + +----------------------------------------------------------------------------------------- +--- Query plan of select on partitioned tables with predicate and enforced index scan +----------------------------------------------------------------------------------------- +SET BABELFISH_SHOWPLAN_ALL OFF +GO + +SELECT set_config('enable_seqscan', 'off', false); +SELECT set_config('enable_bitmapscan', 'off', false); +GO +~~START~~ +text +off +~~END~~ + +~~START~~ +text +off +~~END~~ + + +SET BABELFISH_SHOWPLAN_ALL ON +GO + + +SELECT * FROM partition_vu_prepare_int_table WHERE Id >= 0 AND Id < 500; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_int_table WHERE Id >= 0 AND Id < 500 +Index Scan using "363863941f079adaa9aa733200e57c9f_partition_1_id_key" on "363863941f079adaa9aa733200e57c9f_partition_1" partition_vu_prepare_int_table + Index Cond: ((id >= 0) AND (id < 500)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 11.417 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_bigint_table WHERE Id >= 0 AND Id < 100; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_bigint_table WHERE Id >= 0 AND Id < 100 +Index Scan using "548bb344374ce8d65342b36428375873_partition_1_id_idx" on "548bb344374ce8d65342b36428375873_partition_1" partition_vu_prepare_bigint_table + Index Cond: ((id >= 0) AND (id < 100)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.174 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_smallint_table WHERE Id >= -32768 AND Id < 0; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_smallint_table WHERE Id >= -32768 AND Id < 0 +Index Scan using "12025e103721b70925744c196ce004cd_partition_1_id_idx" on "12025e103721b70925744c196ce004cd_partition_1" partition_vu_prepare_smallint_table + Index Cond: ((id >= '-32768'::integer) AND (id < 0)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 7.570 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_tinyint_table WHERE Id >= 0 AND Id < 128; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_tinyint_table WHERE Id >= 0 AND Id < 128 +Index Scan using "61446d711d19b5970809387caa7fd3d3_partition_1_id_idx" on "61446d711d19b5970809387caa7fd3d3_partition_1" partition_vu_prepare_tinyint_table + Index Cond: (((id)::smallint >= 0) AND ((id)::smallint < 128)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.175 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_decimal_table WHERE Id >= 0.0 AND Id < 100.0; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_decimal_table WHERE Id >= 0.0 AND Id < 100.0 +Index Scan using cda2902d769fd61eb60b1a461650212f_partition_1_id_idx on cda2902d769fd61eb60b1a461650212f_partition_1 partition_vu_prepare_decimal_table + Index Cond: (((id)::numeric >= 0.0) AND ((id)::numeric < 100.0)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 6.722 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_numeric_table WHERE Id >= 0.0 AND Id < 10.0; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_numeric_table WHERE Id >= 0.0 AND Id < 10.0 +Index Scan using "57405760297bb338f333c148aac5f845_partition_1_id_idx" on "57405760297bb338f333c148aac5f845_partition_1" partition_vu_prepare_numeric_table + Index Cond: ((id >= 0.0) AND (id < 10.0)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.194 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_money_table WHERE Id >= 2.56789 AND Id < 3.56789; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_money_table WHERE Id >= 2.56789 AND Id < 3.56789 +Append + -> Index Scan using "640187c54e2c2984d190957d245a5fa5_partition_1_id_idx" on "640187c54e2c2984d190957d245a5fa5_partition_1" partition_vu_prepare_money_table_1 + Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + -> Index Scan using "640187c54e2c2984d190957d245a5fa5_partition_0_id_idx" on "640187c54e2c2984d190957d245a5fa5_partition_0" partition_vu_prepare_money_table_2 + Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.230 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_smallmoney_table WHERE Id >= 2.56789 AND Id < 3.56789; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_smallmoney_table WHERE Id >= 2.56789 AND Id < 3.56789 +Append + -> Index Scan using "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_1_id_idx" on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_1" partition_vu_prepare_smallmoney_table_1 + Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + -> Index Scan using "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_0_id_idx" on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_0" partition_vu_prepare_smallmoney_table_2 + Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.163 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_date_table WHERE Id >= '2022-01-01' AND Id < '2022-07-01'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_date_table WHERE Id >= '2022-01-01' AND Id < '2022-07-01' +Index Scan using "4867824426e52acac5c93d9cbe8aa366_partition_1_id_idx" on "4867824426e52acac5c93d9cbe8aa366_partition_1" partition_vu_prepare_date_table + Index Cond: ((id >= '2022-01-01'::date) AND (id < '2022-07-01'::date)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.273 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_datetime_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_datetime_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01' +Index Scan using "751ce655481adf15600727bf291667f7_partition_1_id_idx" on "751ce655481adf15600727bf291667f7_partition_1" partition_vu_prepare_datetime_table + Index Cond: ((id >= '2019-01-01 00:00:00'::datetime) AND (id < '2022-01-01 00:00:00'::datetime)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.170 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_datetime2_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_datetime2_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01' +Index Scan using "5ed003cf80dacbb8cce0b21e175f7f94_partition_1_id_idx" on "5ed003cf80dacbb8cce0b21e175f7f94_partition_1" partition_vu_prepare_datetime2_table + Index Cond: ((id >= '2019-01-01 00:00:00'::datetime2) AND (id < '2022-01-01 00:00:00'::datetime2)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.169 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_smalldatetime_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_smalldatetime_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01' +Index Scan using b5c2e665ec4a1219ba8510e33e45379b_partition_1_id_idx on b5c2e665ec4a1219ba8510e33e45379b_partition_1 partition_vu_prepare_smalldatetime_table + Index Cond: ((id >= '2019-01-01 00:00:00'::smalldatetime) AND (id < '2022-01-01 00:00:00'::smalldatetime)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.246 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_char_table WHERE Id >= 'A' AND Id < 'B'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_char_table WHERE Id >= 'A' AND Id < 'B' +Index Scan using "5d20bd977eb6e6f1304dec45598c09f5_partition_1_id_idx" on "5d20bd977eb6e6f1304dec45598c09f5_partition_1" partition_vu_prepare_char_table + Index Cond: ((id >= 'A'::bpchar) AND (id < 'B'::bpchar)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.180 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_varchar_table WHERE Id >= 'Apple' AND Id < 'Banana'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_varchar_table WHERE Id >= 'Apple' AND Id < 'Banana' +Index Scan using "933a5c7f0de13890324e53ee0711424b_partition_1_id_idx" on "933a5c7f0de13890324e53ee0711424b_partition_1" partition_vu_prepare_varchar_table + Index Cond: ((id >= 'Apple'::"varchar") AND (id < 'Banana'::"varchar")) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.168 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_nvarchar_table WHERE Id >= N'Apple' AND Id < N'Banana'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_nvarchar_table WHERE Id >= N'Apple' AND Id < N'Banana' +Index Scan using "320465af1d1bd21f5b29c57f9f4e5c51_partition_1_id_idx" on "320465af1d1bd21f5b29c57f9f4e5c51_partition_1" partition_vu_prepare_nvarchar_table + Index Cond: (((id)::"varchar" >= 'Apple'::"varchar") AND ((id)::"varchar" < 'Banana'::"varchar")) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.172 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_nchar_table WHERE Id >= N'A' AND Id < N'B'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_nchar_table WHERE Id >= N'A' AND Id < N'B' +Gather + Workers Planned: 2 + -> Parallel Append + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_3 partition_vu_prepare_nchar_table_3 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_5 partition_vu_prepare_nchar_table_5 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_7 partition_vu_prepare_nchar_table_7 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_1 partition_vu_prepare_nchar_table_1 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_2 partition_vu_prepare_nchar_table_2 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_4 partition_vu_prepare_nchar_table_4 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_6 partition_vu_prepare_nchar_table_6 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_0 partition_vu_prepare_nchar_table_8 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.184 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_binary_table WHERE Id >= 0x0000 AND Id < 0x0400; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_binary_table WHERE Id >= 0x0000 AND Id < 0x0400 +Append + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_1" partition_vu_prepare_binary_table_1 + Filter: (((id)::bbf_varbinary >= '0x0000'::bbf_varbinary) AND ((id)::bbf_varbinary < '0x0400'::bbf_varbinary)) + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_2" partition_vu_prepare_binary_table_2 + Filter: (((id)::bbf_varbinary >= '0x0000'::bbf_varbinary) AND ((id)::bbf_varbinary < '0x0400'::bbf_varbinary)) + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_3" partition_vu_prepare_binary_table_3 + Filter: (((id)::bbf_varbinary >= '0x0000'::bbf_varbinary) AND ((id)::bbf_varbinary < '0x0400'::bbf_varbinary)) + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_4" partition_vu_prepare_binary_table_4 + Filter: (((id)::bbf_varbinary >= '0x0000'::bbf_varbinary) AND ((id)::bbf_varbinary < '0x0400'::bbf_varbinary)) + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_0" partition_vu_prepare_binary_table_5 + Filter: (((id)::bbf_varbinary >= '0x0000'::bbf_varbinary) AND ((id)::bbf_varbinary < '0x0400'::bbf_varbinary)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 7.260 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_varbinary_table WHERE Id >= 0x0000000000000000 AND Id < 0x4000000000000000; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_varbinary_table WHERE Id >= 0x0000000000000000 AND Id < 0x4000000000000000 +Index Scan using "77718961234110c3a22a3c977bc252d8_partition_1_id_idx" on "77718961234110c3a22a3c977bc252d8_partition_1" partition_vu_prepare_varbinary_table + Index Cond: (((id)::bbf_varbinary >= '0x0000000000000000'::bbf_varbinary) AND ((id)::bbf_varbinary < '0x4000000000000000'::bbf_varbinary)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.180 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_uniqueidentifier_table WHERE Id >= '00000000-0000-0000-0000-000000000000' AND Id < '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_uniqueidentifier_table WHERE Id >= '00000000-0000-0000-0000-000000000000' AND Id < '6F9619FF-8B86-D011-B42D-00C04FC964FF' +Index Scan using f3baf999c06d6ea82082a4c549baeb77_partition_1_id_idx on f3baf999c06d6ea82082a4c549baeb77_partition_1 partition_vu_prepare_uniqueidentifier_table + Index Cond: ((id >= '00000000-0000-0000-0000-000000000000'::uniqueidentifier) AND (id < '6F9619FF-8B86-D011-B42D-00C04FC964FF'::uniqueidentifier)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.198 ms +~~END~~ + + +SET BABELFISH_SHOWPLAN_ALL OFF +GO + +SELECT set_config('enable_seqscan', 'on', false); +SELECT set_config('enable_bitmapscan', 'on', false); +SELECT set_config('babelfishpg_tsql.explain_costs', 'on', false) +GO +~~START~~ +text +on +~~END~~ + +~~START~~ +text +on +~~END~~ + +~~START~~ +text +on +~~END~~ + + + + +-- psql +------------------------------------------ +--- Blocked Operation For Partitioned Tables +------------------------------------------- +-- user should not be allowed to CREATE/ATTACH/DETACH partition +-- to babelfish partitioned table from psql endpoint +SET ROLE master_dbo; +GO + +-- Attempt to create new partition with random values +CREATE TABLE NonExistentTable PARTITION OF master_dbo.partition_vu_prepare_int_table +FOR VALUES FROM (0) TO (500); +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: partition "nonexistenttable" would overlap partition "363863941f079adaa9aa733200e57c9f_partition_1" + Position: 157 + Server SQLState: 42P17)~~ + + +-- Attempt to create new partition with DEFAULT +CREATE TABLE NonExistentTable PARTITION OF master_dbo.partition_vu_prepare_int_table +DEFAULT +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: partition "nonexistenttable" conflicts with existing default partition "363863941f079adaa9aa733200e57c9f_partition_0" + Position: 134 + Server SQLState: 42P17)~~ + + +-- Attempt to drop partition of babelfish partitioned table from psql endpoint +DROP TABLE master_dbo."363863941f079adaa9aa733200e57c9f_partition_0"; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot drop the babelfish partition table '363863941f079adaa9aa733200e57c9f_partition_0'. + Server SQLState: 42704)~~ + + + +-- Attempt to detach +-- explicit schema name specified +ALTER TABLE master_dbo.partition_vu_prepare_int_table +DETACH PARTITION master_dbo."363863941f079adaa9aa733200e57c9f_partition_0"; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot detach partition from babelfish partitioned table 'partition_vu_prepare_int_table'. + Server SQLState: 0A000)~~ + + +-- using search_path +SET search_path = public, master_dbo; +ALTER TABLE master_dbo.partition_vu_prepare_int_table +DETACH PARTITION master_dbo."363863941f079adaa9aa733200e57c9f_partition_0"; +RESET search_path; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot detach partition from babelfish partitioned table 'partition_vu_prepare_int_table'. + Server SQLState: 0A000)~~ + + +-- Attempt to detach using CONCURRENTLY option +ALTER TABLE master_dbo.partition_vu_prepare_int_table +DETACH PARTITION master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +CONCURRENTLY; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot detach partition from babelfish partitioned table 'partition_vu_prepare_int_table'. + Server SQLState: 0A000)~~ + + +-- Attempt to detach using FINALIZE option +ALTER TABLE master_dbo.partition_vu_prepare_int_table +DETACH PARTITION master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +FINALIZE; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot detach partition from babelfish partitioned table 'partition_vu_prepare_int_table'. + Server SQLState: 0A000)~~ + + +-- Attempt to attach with Default value +ALTER TABLE master_dbo.partition_vu_prepare_int_table +ATTACH PARTITION NonExistentTable DEFAULT; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot attach partition to babelfish partitioned table 'partition_vu_prepare_int_table'. + Server SQLState: 0A000)~~ + + +-- Attempt to attach with random value +ALTER TABLE master_dbo.partition_vu_prepare_int_table +ATTACH PARTITION NonExistentTable FOR VALUES FROM (10) TO (20); +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot attach partition to babelfish partitioned table 'partition_vu_prepare_int_table'. + Server SQLState: 0A000)~~ + + + +-- user should not be allowed to modify partition +-- of babelfish partitioned table neither from psql nor tsql endpoint +-- explicit schema name specified +ALTER TABLE master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +ADD CONSTRAINT xyz CHECK ( id > 10 and id < 20); +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Modifying partitions directly is not supported. You can modify the partitions by modifying the parent table. + Server SQLState: 0A000)~~ + + +-- using search_path +SET search_path = public, master_dbo; +ALTER TABLE "363863941f079adaa9aa733200e57c9f_partition_0" +ADD CONSTRAINT xyz CHECK ( id > 10 and id < 20); +RESET search_path; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Modifying partitions directly is not supported. You can modify the partitions by modifying the parent table. + Server SQLState: 0A000)~~ + + +RESET ROLE; +GO + +-- Attempt to ADD storage parameter to babelfish partitioned table (not on the partitions) +SET babelfishpg_tsql.sql_dialect = "tsql"; +GO + +ALTER TABLE master_dbo.partition_vu_prepare_int_table SET (autovacuum_enabled = false); +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: cannot specify storage parameters for a partitioned table + Hint: Specify storage parameters for its leaf partitions instead. + Server SQLState: 42809)~~ + + +RESET babelfishpg_tsql.sql_dialect; +GO + + +-- tsql +ALTER TABLE [363863941f079adaa9aa733200e57c9f_partition_0] +ADD new_col int +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Modifying partitions directly is not supported. You can modify the partitions by modifying the parent table.)~~ + + + +ALTER TABLE [363863941f079adaa9aa733200e57c9f_partition_0] +ADD CONSTRAINT xyz DEFAULT 10 FOR id; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Modifying partitions directly is not supported. You can modify the partitions by modifying the parent table.)~~ + + +-- with explicity schema name +ALTER TABLE dbo.[363863941f079adaa9aa733200e57c9f_partition_0] +ADD new_col int +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Modifying partitions directly is not supported. You can modify the partitions by modifying the parent table.)~~ + + +ALTER TABLE dbo.[363863941f079adaa9aa733200e57c9f_partition_0] +ADD CONSTRAINT xyz DEFAULT 10 FOR id; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Modifying partitions directly is not supported. You can modify the partitions by modifying the parent table.)~~ + + +-- Attempt to drop partition of babelfish partitioned table from tsql endpoint +DROP TABLE [363863941f079adaa9aa733200e57c9f_partition_0] +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the babelfish partition table '363863941f079adaa9aa733200e57c9f_partition_0'.)~~ + + +-- psql +-------------------------------------------------------------------- +-- user should not be allowed to rename partition of +-- babelfish partitioned table neither from psql nor tsql endpoint +-------------------------------------------------------------------- +-- Attempt to rename partition of babelfish partitioned table from psql endpoint +-- explicit schema name specified +ALTER TABLE master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +RENAME TO xyz +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot rename babelfish partition table '363863941f079adaa9aa733200e57c9f_partition_0'. + Server SQLState: 0A000)~~ + + +-- using search_path +SET search_path = public, master_dbo; +ALTER TABLE "363863941f079adaa9aa733200e57c9f_partition_1" +RENAME TO xyz1 +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot rename babelfish partition table '363863941f079adaa9aa733200e57c9f_partition_1'. + Server SQLState: 0A000)~~ + + +-- tsql +-- Attempt to rename partition of babelfish partitioned table from tsql endpoint +-- NOTE: object not found error because sp_rename lookup in sys.objects which +-- will not list child objects +EXEC sp_rename '363863941f079adaa9aa733200e57c9f_partition_2', 'xyz2', 'OBJECT' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: There is no object with the given @objname.)~~ + + +-------------------------------------------------------------------- +--- Unsupported Option with CREATE TABLE with PARTITION SCHEME +-------------------------------------------------------------------- +-- Computed column as partitioning column is not yet supported in babelfish +CREATE TABLE TestPartitionedTable +( + id INT, + value INT, + computed_col AS id + value +) +ON IntPartitionScheme(computed_col); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cannot use generated column in partition key)~~ + + +CREATE TABLE TestPartitionedTable +( + id INT, + value INT, + computed_col AS id + value PERSISTED +) +ON IntPartitionScheme(computed_col); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cannot use generated column in partition key)~~ + + +-- temporary table +CREATE TABLE #TestPartitionedTable +( + id INT, + value INT +) +ON IntPartitionScheme(id); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Creation of temporary partitioned tables is not supported in Babelfish.)~~ + + + +--------------------------------------------------------------- +--- Negative Scenarios for CREATE TABLE with PARTITION SCHEME +--------------------------------------------------------------- +-- Attempt to create with multiple columns as partitioning scheme +CREATE TABLE TestPartitionedTable +( + id INT, + value INT +) +ON IntPartitionScheme(id, value); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near ',' at line 10 and character position 24)~~ + + +-- Attempt to create with a partition scheme that doesn't exist and column that doesn't exist in the table +CREATE TABLE TestPartitionedTable +( + id INT, + value INT +) +ON NonExistentPartitionScheme(NonExistentColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: column "nonexistentcolumn" named in partition key does not exist)~~ + + +-- Attempt to create with a partition scheme that doesn't exist +CREATE TABLE TestPartitionedTable +( + id INT, + value INT +) +ON NonExistentPartitionScheme(id); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid partition scheme 'NonExistentPartitionScheme' specifed.)~~ + + +-- Attempt to use two part name with partition scheme +CREATE TABLE TestPartitionedTable +( + id INT, + value INT +) +ON master.IntPartitionScheme(id); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '.' at line 7 and character position 9)~~ + + +-- Attempt to create with a unique constraint on a non-partition column +CREATE TABLE TestPartitionedTable +( + Id INT, + PartitionColumn INT, + Col1 INT UNIQUE +) +ON IntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: unique constraint on partitioned table must include all partitioning columns)~~ + + +-- Attempt to create with a primary key constraint on a non-partition column +CREATE TABLE TestPartitionedTable +( + Id INT, + PartitionColumn INT, + Col1 INT PRIMARY KEY +) +ON IntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: unique constraint on partitioned table must include all partitioning columns)~~ + + +--------------------------------------------------------------- +--- Negative Scenarios for CREATE TABLE with PARTITION SCHEME +--- Attempt to create with an incompatible partition column data type +--------------------------------------------------------------- +CREATE TABLE TestPartitionedTable1 +( + Id INT, + PartitionColumn DECIMAL(10, 2) +) +ON IntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'decimal' which is different from the partition function 'IntPartitionFunction' parameter data type 'int'.)~~ + + +CREATE TABLE TestPartitionedTable2 +( + Id INT, + PartitionColumn DATETIME +) +ON DatePartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'datetime' which is different from the partition function 'DatePartitionFunction' parameter data type 'date'.)~~ + + +CREATE TABLE TestPartitionedTable3 +( + Id INT, + PartitionColumn VARCHAR(10) +) +ON CharPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'varchar' which is different from the partition function 'CharPartitionFunction' parameter data type 'char'.)~~ + + +CREATE TABLE TestPartitionedTable4 +( + Id INT, + PartitionColumn VARBINARY(10) +) +ON BinaryPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'varbinary' which is different from the partition function 'BinaryPartitionFunction' parameter data type 'binary'.)~~ + + +CREATE TABLE TestPartitionedTable5 +( + Id INT, + PartitionColumn SMALLINT +) +ON BigIntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'int2' which is different from the partition function 'BigIntPartitionFunction' parameter data type 'bigint'.)~~ + + +CREATE TABLE TestPartitionedTable6 +( + Id INT, + PartitionColumn DECIMAL(10, 2) +) +ON SmallIntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'decimal' which is different from the partition function 'SmallIntPartitionFunction' parameter data type 'smallint'.)~~ + + +CREATE TABLE TestPartitionedTable7 +( + Id INT, + PartitionColumn DECIMAL(10, 5) +) +ON TinyIntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'decimal' which is different from the partition function 'TinyIntPartitionFunction' parameter data type 'tinyint'.)~~ + + +CREATE TABLE TestPartitionedTable8 +( + Id INT, + PartitionColumn BIGINT +) +ON DecimalPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'int8' which is different from the partition function 'DecimalPartitionFunction' parameter data type 'decimal'.)~~ + + +CREATE TABLE TestPartitionedTable9 +( + Id INT, + PartitionColumn MONEY +) +ON NumericPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'money' which is different from the partition function 'NumericPartitionFunction' parameter data type 'numeric'.)~~ + + +CREATE TABLE TestPartitionedTable10 +( + Id INT, + PartitionColumn INT +) +ON MoneyPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'int4' which is different from the partition function 'MoneyPartitionFunction' parameter data type 'money'.)~~ + + +CREATE TABLE TestPartitionedTable11 +( + Id INT, + PartitionColumn DATETIME +) +ON SmallMoneyPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'datetime' which is different from the partition function 'SmallMoneyPartitionFunction' parameter data type 'smallmoney'.)~~ + + +CREATE TABLE TestPartitionedTable12 +( + Id INT, + PartitionColumn DATETIME2(3) +) +ON DateTimePartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'datetime2' which is different from the partition function 'DateTimePartitionFunction' parameter data type 'datetime'.)~~ + + +CREATE TABLE TestPartitionedTable13 +( + Id INT, + PartitionColumn SMALLDATETIME +) +ON DateTime2PartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'smalldatetime' which is different from the partition function 'DateTime2PartitionFunction' parameter data type 'datetime2'.)~~ + + +CREATE TABLE TestPartitionedTable14 +( + Id INT, + PartitionColumn NVARCHAR(10) +) +ON SmallDateTimePartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'nvarchar' which is different from the partition function 'SmallDateTimePartitionFunction' parameter data type 'smalldatetime'.)~~ + + +CREATE TABLE TestPartitionedTable15 +( + Id INT, + PartitionColumn INT +) +ON NVarCharPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'int4' which is different from the partition function 'NVarCharPartitionFunction' parameter data type 'nvarchar'.)~~ + + +CREATE TABLE TestPartitionedTable16 +( + Id INT, + PartitionColumn NCHAR(5) +) +ON VarCharPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'nchar' which is different from the partition function 'VarCharPartitionFunction' parameter data type 'varchar'.)~~ + + +CREATE TABLE TestPartitionedTable17 +( + Id INT, + PartitionColumn INT +) +ON NCharPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'int4' which is different from the partition function 'NCharPartitionFunction' parameter data type 'nchar'.)~~ + + +-- using user defined type +CREATE TYPE PartitionUserDefinedType FROM SMALLINT; +GO + +CREATE TABLE TestPartitionedTable18 +( + Id INT, + PartitionColumn PartitionUserDefinedType +) +ON BigIntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'partitionuserdefinedtype' which is different from the partition function 'BigIntPartitionFunction' parameter data type 'bigint'.)~~ + + +DROP TYPE PartitionUserDefinedType +GO + +--------------------------------------------------------------- +--- Negative Scenarios for CREATE Index with PARTITION SCHEME +--------------------------------------------------------------- +CREATE TABLE TestPartitionedTable ( + PartitionColumn INT, + NonPartitionColumn INT +) ON IntPartitionScheme(PartitionColumn); +GO + +CREATE TABLE TestNonPartitionedTable ( + a INT, + b INT +) +GO + +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonExistentColumn1) +ON NonExistentPartitionScheme (NonExistentColumn2); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: column "nonexistentcolumn1" does not exist)~~ + + +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonPartitionColumn) +ON NonExistentPartitionScheme (NonExistentColumn2); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: column 'nonexistentcolumn2' does not exist)~~ + + +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonPartitionColumn) +ON NonExistentPartitionScheme (NonPartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid object name 'NonExistentPartitionScheme'.)~~ + + +-- scheme is different from the partition scheme used in the table +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonPartitionColumn) +ON BigIntPartitionScheme (NonPartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Un-aligned Index is not supported in Babelfish.)~~ + + +-- column specified with partition scheme is different +-- from the partition column used in the table +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonPartitionColumn) +ON IntPartitionScheme (NonPartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Un-aligned Index is not supported in Babelfish.)~~ + + +-- should work +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonPartitionColumn) +ON IntPartitionScheme (PartitionColumn); +GO + +DROP INDEX TestPartitionIndex ON TestPartitionedTable +GO + +-- usage of partition scheme on non-partitioned table (should fail) +CREATE INDEX TestPartitionIndex +ON TestNonPartitionedTable(a) +ON IntPartitionScheme (a); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Un-aligned Index is not supported in Babelfish.)~~ + + + +DROP TABLE TestPartitionedTable +GO + +DROP TABLE TestNonPartitionedTable +GO +-- psql +------------------------------------------------------------------------------------------- +--- Rename Operation on Partitioned Tables should update name in babelfish_partition_depend +--- and it should also update the name of all the partitions +------------------------------------------------------------------------------------------- +SELECT sys.db_name(dbid) as db_name, partition_scheme_name, schema_name, table_name FROM sys.babelfish_partition_depend where table_name = 'partition_vu_prepare_int_table'; +GO +~~START~~ +"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar" +master#!#IntPartitionScheme#!#dbo#!#partition_vu_prepare_int_table +~~END~~ + + +SELECT inhrelid::regclass as partition_name from pg_inherits where inhparent = (select oid from pg_class where relname = 'partition_vu_prepare_int_table')::regclass; +GO +~~START~~ +regclass +master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +master_dbo."363863941f079adaa9aa733200e57c9f_partition_1" +master_dbo."363863941f079adaa9aa733200e57c9f_partition_2" +master_dbo."363863941f079adaa9aa733200e57c9f_partition_3" +~~END~~ + + +-- tsql +-- trigger rename from TSQL endpoint +EXEC sp_rename 'partition_vu_prepare_int_table', 'partition_vu_prepare_int_table_renamed', 'OBJECT' +GO + +-- psql +SELECT sys.db_name(dbid) as db_name, partition_scheme_name, schema_name, table_name FROM sys.babelfish_partition_depend where table_name = 'partition_vu_prepare_int_table_renamed'; +GO +~~START~~ +"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar" +master#!#IntPartitionScheme#!#dbo#!#partition_vu_prepare_int_table_renamed +~~END~~ + + +SELECT inhrelid::regclass as partition_name from pg_inherits where inhparent = (select oid from pg_class where relname = 'partition_vu_prepare_int_table_renamed')::regclass; +GO +~~START~~ +regclass +master_dbo.c2647401dc3e9a950809daafcd188637_partition_0 +master_dbo.c2647401dc3e9a950809daafcd188637_partition_1 +master_dbo.c2647401dc3e9a950809daafcd188637_partition_2 +master_dbo.c2647401dc3e9a950809daafcd188637_partition_3 +~~END~~ + + +-- trigger rename from PSQL endpoint +ALTER TABLE master_dbo.partition_vu_prepare_int_table_renamed RENAME TO partition_vu_prepare_int_table; +GO + +-- we should get orginal here +SELECT sys.db_name(dbid) as db_name, partition_scheme_name, schema_name, table_name FROM sys.babelfish_partition_depend where table_name = 'partition_vu_prepare_int_table'; +GO +~~START~~ +"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar" +master#!#IntPartitionScheme#!#dbo#!#partition_vu_prepare_int_table +~~END~~ + + +SELECT inhrelid::regclass as partition_name from pg_inherits where inhparent = (select oid from pg_class where relname = 'partition_vu_prepare_int_table')::regclass; +GO +~~START~~ +regclass +master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +master_dbo."363863941f079adaa9aa733200e57c9f_partition_1" +master_dbo."363863941f079adaa9aa733200e57c9f_partition_2" +master_dbo."363863941f079adaa9aa733200e57c9f_partition_3" +~~END~~ + + +-- tsql +---------------------------------------------------------- +--- DOLLAR PARTITION FUNCTION name identifiers tests +---------------------------------------------------------- +SET QUOTED_IDENTIFIER ON; +GO + +SELECT $PARTITION."IntPartitionFunction" (100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT $PARTITION."PARTITION_FUNCTION 😎$@ #123 🌍rder "(100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT "master".$PARTITION."PARTITION_FUNCTION 😎$@ #123 🌍rder "(100) +GO +~~START~~ +int +2 +~~END~~ + + +SET QUOTED_IDENTIFIER OFF; +GO + + +SELECT $PARTITION.[PARTITION_FUNCTION 유니코드스키마👻 ] (100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT [master].$PARTITION.[PARTITION_FUNCTION 유니코드스키마👻 ] (100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT $PARTITION.[IntPartitionFunction] (100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT [master].$PARTITION.[IntPartitionFunction] (100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT $PARTITION.PARTITION_FUNCTIONログインαιώνια (100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT master.$PARTITION.PARTITION_FUNCTIONログインαιώνια (100) +GO +~~START~~ +int +2 +~~END~~ + + +------------------------------------------ +--- DOLLAR PARTITION FUNCTION Negative test +------------------------------------------ +-- explicit NULL value test +SELECT $PARTITION.IntPartitionFunction(NULL) +GO +~~START~~ +int +1 +~~END~~ + + +SELECT master.$PARTITION.IntPartitionFunction(NULL) +GO +~~START~~ +int +1 +~~END~~ + + +-- variable as NULL value +declare @var int = NULL +SELECT $PARTITION.IntPartitionFunction(@var) +GO +~~START~~ +int +1 +~~END~~ + + +-- non-existent database +SELECT NonExistentDatabase.$PARTITION.IntPartitionFunction(10) +GO +~~START~~ +int +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid database name 'NonExistentDatabase'.)~~ + + +-- error during implicit Conversion of values to partition function parameter type +SELECT $PARTITION.IntPartitionFunction('xyz') +GO +~~START~~ +int +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type integer: "xyz")~~ + + +-- using query +SELECT $PARTITION.IntPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_varchar_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type integer: "Apple")~~ + +--------------------------------------------------------------------- +--- Test for all the Supported Datatypes for Dollar Partition Function +--------------------------------------------------------------------- +SELECT $PARTITION.IntPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_int_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#int +1#!# +2#!#1 +2#!#100 +4#!#10000 +~~END~~ + + +SELECT $PARTITION.BigIntPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_bigint_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#bigint +1#!# +2#!#1 +3#!#100 +5#!#10000 +5#!#1000000000 +~~END~~ + + +SELECT $PARTITION.SmallIntPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_smallint_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#smallint +1#!# +2#!#-32768 +3#!#1 +4#!#32767 +~~END~~ + + +SELECT $PARTITION.TinyIntPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_tinyint_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#tinyint +1#!# +2#!#1 +3#!#128 +4#!#255 +~~END~~ + + +SELECT $PARTITION.DecimalPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_decimal_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#numeric +1#!# +2#!#1.00000 +3#!#100.00000 +4#!#200.00000 +5#!#300.00000 +~~END~~ + + +SELECT $PARTITION.NumericPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_numeric_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#numeric +1#!# +2#!#1.00 +3#!#10.00 +4#!#20.00 +5#!#30.00 +~~END~~ + + +SELECT $PARTITION.MoneyPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_money_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#money +1#!# +1#!#1.0000 +2#!#2.5679 +4#!#4.9100 +~~END~~ + + +SELECT $PARTITION.SmallMoneyPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_smallmoney_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#smallmoney +1#!# +1#!#1.0000 +2#!#2.5679 +4#!#4.9100 +~~END~~ + + +SELECT $PARTITION.DatePartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_date_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#date +1#!# +2#!#2022-01-01 +3#!#2022-07-01 +4#!#2023-01-01 +~~END~~ + + +SELECT $PARTITION.DateTimePartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_datetime_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#datetime +1#!# +2#!#2019-01-01 00:00:00.0 +3#!#2022-01-01 00:00:00.0 +4#!#2022-07-01 00:00:00.0 +~~END~~ + + +SELECT $PARTITION.DateTime2PartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_datetime2_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#datetime2 +1#!# +2#!#2019-01-01 00:00:00.000 +3#!#2022-01-01 00:00:00.000 +4#!#2022-07-01 00:00:00.000 +~~END~~ + + +SELECT $PARTITION.SmallDateTimePartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_smalldatetime_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#smalldatetime +1#!# +2#!#2019-01-01 00:00:00.0 +3#!#2022-01-01 00:00:00.0 +4#!#2022-07-01 00:00:00.0 +~~END~~ + + +SELECT $PARTITION.CharPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_char_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#char +1#!# +2#!#A +3#!#D +5#!#K +7#!#U +~~END~~ + + +SELECT $PARTITION.VarCharPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_varchar_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#varchar +1#!# +2#!#Apple +3#!#Banana +4#!#Cherry +5#!#Date +6#!#Mango +~~END~~ + + +SELECT $PARTITION.NVarCharPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_nvarchar_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#nvarchar +1#!# +2#!#Apple +3#!#Banana +4#!#Cherry +5#!#Date +6#!#Mango +~~END~~ + + +SELECT $PARTITION.NCharPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_nchar_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#nchar +1#!# +2#!#A +3#!#B +5#!#K +7#!#U +~~END~~ + + +SELECT $PARTITION.BinaryPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_binary_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#binary +1#!# +2#!#00000000 +2#!#00C00000 +3#!#04000000 +4#!#08000000 +~~END~~ + + +SELECT $PARTITION.VarBinaryPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_varbinary_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#varbinary +1#!# +2#!#0000000000000000 +3#!#4000000000000000 +4#!#8000000000000000 +5#!#C000000000000000 +~~END~~ + + +SELECT $PARTITION.UniqueIdentifierPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_uniqueidentifier_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#uniqueidentifier +1#!# +2#!#00000000-0000-0000-0000-000000000000 +3#!#6F9619FF-8B86-D011-B42D-00C04FC964FF +4#!#FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF +~~END~~ + + +---------------------------------------------- +--- DOLLAR PARTITION FUNCTION Dependency test +---------------------------------------------- +-- non-null test +SELECT * FROM DollarPartitionFunctionView +GO +~~START~~ +int#!#int +1#!# +2#!#1 +2#!#100 +4#!#10000 +~~END~~ + + +EXEC DollarPartitionFunctionProc +GO +~~START~~ +int#!#int +1#!# +2#!#1 +2#!#100 +4#!#10000 +~~END~~ + + +SELECT * FROM DollarPartitionFunctionFunc() +GO +~~START~~ +int#!#int +1#!# +2#!#1 +2#!#100 +4#!#10000 +~~END~~ + + +-- null test +SELECT * FROM DollarPartitionFunctionNullView +GO +~~START~~ +int +1 +~~END~~ + + +EXEC DollarPartitionFunctionNullProc +GO +~~START~~ +int +1 +~~END~~ + + +SELECT * FROM DollarPartitionFunctionNullFunc() +GO +~~START~~ +int +1 +~~END~~ + + +SELECT * FROM SysSearchPartitionDepView +GO +~~START~~ +int +2 +~~END~~ + + +SELECT * FROM SysSearchPartitionNULLDepView +GO +~~START~~ +int +2 +~~END~~ + +------------------------------------------------------ +--- DOLLAR PARTITION FUNCTION Cross Database test +------------------------------------------------------ +-- in current database with explicity lookup +SELECT master.$PARTITION.[IntPartitionFunction] (100) +GO +~~START~~ +int +2 +~~END~~ + + +-- use different database +USE PartitionDb; +GO + +SELECT CURRENT_USER +GO +~~START~~ +varchar +dbo +~~END~~ + + +SELECT master.$PARTITION.[IntPartitionFunction] (100) +GO +~~START~~ +int +2 +~~END~~ + + +-- test using guest login +CREATE LOGIN partition_l2 WITH PASSWORD = '12345678'; +GO + +CREATE USER partition_u2 FOR LOGIN partition_l2; +GO + +-- tsql user=partition_l2 password=12345678 database=partitiondb +SELECT CURRENT_USER +GO +~~START~~ +varchar +partition_u2 +~~END~~ + + +SELECT master.$PARTITION.[IntPartitionFunction] (100) +GO +~~START~~ +int +2 +~~END~~ + + +-- tsql +USE PartitionDb; +GO + +DROP USER partition_u2 +GO diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/TestHalfvecDatatype.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/TestHalfvecDatatype.out new file mode 100644 index 00000000000..a56df52f315 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/TestHalfvecDatatype.out @@ -0,0 +1,1771 @@ +-- tsql +-- should throw error since vector is only allowed in sys +exec sp_execute_postgresql 'create extension vector'; +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'vector' extension creation is restricted to 'sys' schema)~~ + + +exec sp_execute_postgresql 'create extension vector with schema sys'; +go + +create login vector_login with password='12345678' +go + +Alter server role sysadmin add member vector_login +go + +create database vector_db; +go + +use vector_db +go + +-- tsql user=vector_login password=12345678 +use vector_db; +go + +select set_config('babelfishpg_tsql.explain_costs', 'off', false); +go +~~START~~ +text +off +~~END~~ + +select set_config('babelfishpg_tsql.explain_timing', 'off', false); +go +~~START~~ +text +off +~~END~~ + +select set_config('babelfishpg_tsql.explain_summary', 'off', false); +go +~~START~~ +text +off +~~END~~ + + +SELECT CAST('[1,2,3]' as halfvec); +go +~~START~~ +varchar +[1,2,3] +~~END~~ + + +SELECT CAST('[-1,-2,-3]' as halfvec); +go +~~START~~ +varchar +[-1,-2,-3] +~~END~~ + + +SELECT CAST('[1.,2.,3.]' as halfvec); +go +~~START~~ +varchar +[1,2,3] +~~END~~ + + +SELECT CAST(' [ 1, 2 , 3 ] ' as halfvec); +go +~~START~~ +varchar +[1,2,3] +~~END~~ + + +SELECT CAST('[1.23456]' as halfvec); +go +~~START~~ +varchar +[1.234375] +~~END~~ + + +SELECT CAST('[hello,1]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[hello,1]")~~ + + +SELECT CAST('[NaN,1]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: NaN not allowed in halfvec)~~ + + +SELECT CAST('[Infinity,1]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: infinite value not allowed in halfvec)~~ + + +SELECT CAST('[-Infinity,1]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: infinite value not allowed in halfvec)~~ + + +SELECT CAST('[65519,-65519]' as halfvec); +go +~~START~~ +varchar +[65504,-65504] +~~END~~ + + +SELECT CAST('[65520,-65520]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: "65520" is out of range for type halfvec)~~ + + +SELECT CAST('[1e-8,-1e-8]' as halfvec); +go +~~START~~ +varchar +[0,-0] +~~END~~ + + +SELECT CAST('[4e38,1]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: "4e38" is out of range for type halfvec)~~ + + +SELECT CAST('[1e-46,1]' as halfvec); +go +~~START~~ +varchar +[0,1] +~~END~~ + + +SELECT CAST('[1,2,3' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[1,2,3")~~ + + +SELECT CAST('[1,2,3]9' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[1,2,3]9")~~ + + +SELECT CAST('1,2,3' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "1,2,3")~~ + + +SELECT CAST('' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "")~~ + + +SELECT CAST('[' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[")~~ + + +SELECT CAST('[ ' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[ ")~~ + + +SELECT CAST('[,' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[,")~~ + + +SELECT CAST('[]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: halfvec must have at least 1 dimension)~~ + + +SELECT CAST('[ ]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: halfvec must have at least 1 dimension)~~ + + +SELECT CAST('[,]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[,]")~~ + + +SELECT CAST('[1,]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[1,]")~~ + + +SELECT CAST('[1a]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[1a]")~~ + + +SELECT CAST('[1,,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[1,,3]")~~ + + +SELECT CAST('[1, ,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[1, ,3]")~~ + + +SELECT CAST('[1,2,3]' as halfvec(3)); +go +~~START~~ +varchar +[1,2,3] +~~END~~ + + +SELECT CAST('[1,2,3]' as halfvec(2)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: expected 2 dimensions, not 3)~~ + + +SELECT CAST('[1,2,3]' as halfvec(3, 2)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid type modifier)~~ + + +SELECT CAST('[1,2,3]' as halfvec('a')); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '(' at line 1 and character position 32)~~ + + +SELECT CAST('[1,2,3]' as halfvec(0)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: dimensions for type halfvec must be at least 1)~~ + + +SELECT CAST('[1,2,3]' as halfvec(16001)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: dimensions for type halfvec cannot exceed 16000)~~ + + +SELECT CAST('{"[1,2,3]"}' as halfvec(2)[]); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '[]' at line 1 and character position 39)~~ + + +SELECT CAST('[1,2,3]' as halfvec) + CAST('[4,5,6]' as halfvec); +go +~~START~~ +varchar +[5,7,9] +~~END~~ + + +SELECT CAST('[65519]' as halfvec) + CAST('[65519]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: value out of range: overflow)~~ + + +SELECT CAST('[1,2]' as halfvec) + CAST('[3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT CAST('[1,2,3]' as halfvec) - CAST('[4,5,6]' as halfvec); +go +~~START~~ +varchar +[-3,-3,-3] +~~END~~ + + +SELECT CAST('[-65519]' as halfvec) - CAST('[65519]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: value out of range: overflow)~~ + + +SELECT CAST('[1,2]' as halfvec) - CAST('[3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT CAST('[1,2,3]' as halfvec) * CAST('[4,5,6]' as halfvec); +go +~~START~~ +varchar +[4,10,18] +~~END~~ + + +SELECT CAST('[65519]' as halfvec) * CAST('[65519]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: value out of range: overflow)~~ + + +SELECT CAST('[1e-7]' as halfvec) * CAST('[1e-7]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: value out of range: underflow)~~ + + +SELECT CAST('[1,2]' as halfvec) * CAST('[3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT CAST('[1,2,3]' as halfvec) + CAST('[4,5]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 3 and 2)~~ + + +SELECT CAST('[1,2,3]' as halfvec) < CAST('[1,2,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '<' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) < CAST('[1,2]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '<' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) <= CAST('[1,2,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '<' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) <= CAST('[1,2]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '<' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) = CAST('[1,2,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '=' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) = CAST('[1,2]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '=' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) != CAST('[1,2,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '!' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) != CAST('[1,2]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '!' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) >= CAST('[1,2,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '>' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) >= CAST('[1,2]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '>' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) > CAST('[1,2,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '>' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) > CAST('[1,2]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '>' at line 1 and character position 34)~~ + + +SELECT halfvec_cmp(CAST('[1,2,3]' as halfvec), CAST('[1,2,3]' as halfvec)); +go +~~START~~ +int +0 +~~END~~ + + +SELECT halfvec_cmp(CAST('[1,2,3]' as halfvec), CAST('[0,0,0]' as halfvec)); +go +~~START~~ +int +1 +~~END~~ + + +SELECT halfvec_cmp(CAST('[0,0,0]' as halfvec), CAST('[1,2,3]' as halfvec)); +go +~~START~~ +int +-1 +~~END~~ + + +SELECT halfvec_cmp(CAST('[1,2]' as halfvec), CAST('[1,2,3]' as halfvec)); +go +~~START~~ +int +-1 +~~END~~ + + +SELECT halfvec_cmp(CAST('[1,2,3]' as halfvec), CAST('[1,2]' as halfvec)); +go +~~START~~ +int +1 +~~END~~ + + +SELECT halfvec_cmp(CAST('[1,2]' as halfvec), CAST('[2,3,4]' as halfvec)); +go +~~START~~ +int +-1 +~~END~~ + + +SELECT halfvec_cmp(CAST('[2,3]' as halfvec), CAST('[1,2,3]' as halfvec)); +go +~~START~~ +int +1 +~~END~~ + + +SELECT vector_dims(CAST('[1,2,3]' as halfvec)); +go +~~START~~ +int +3 +~~END~~ + + +SELECT ROUND(CAST(l2_norm(CAST('[1,1]' as halfvec)) as numeric), 5); +go +~~START~~ +numeric +1.00000 +~~END~~ + + +SELECT l2_norm(CAST('[3,4]' as halfvec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_norm(CAST('[0,1]' as halfvec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT l2_norm(CAST('[0,0]' as halfvec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT l2_norm(CAST('[2]' as halfvec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT l2_distance(CAST('[0,0]' as halfvec), CAST('[3,4]' as halfvec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_distance(CAST('[0,0]' as halfvec), CAST('[0,1]' as halfvec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT l2_distance(CAST('[1,2]' as halfvec), CAST('[3]' as halfvec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT l2_distance(CAST('[1,1,1,1,1,1,1,1,1]' as halfvec), CAST('[1,1,1,1,1,1,1,4,5]' as halfvec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT CAST('[0,0]' as halfvec) <-> CAST('[3,4]' as halfvec); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT inner_product(CAST('[1,2]' as halfvec), CAST('[3,4]' as halfvec)); +go +~~START~~ +float +11.0 +~~END~~ + + +SELECT inner_product(CAST('[1,2]' as halfvec), CAST('[3]' as halfvec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT inner_product(CAST('[65504]' as halfvec), CAST('[65504]' as halfvec)); +go +~~START~~ +float +4.290774016E9 +~~END~~ + + +SELECT inner_product(CAST('[1,1,1,1,1,1,1,1,1]' as halfvec), CAST('[1,2,3,4,5,6,7,8,9]' as halfvec)); +go +~~START~~ +float +45.0 +~~END~~ + + +SELECT CAST('[1,2]' as halfvec) <#> CAST('[3,4]' as halfvec); +go +~~START~~ +float +-11.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,2]' as halfvec), CAST('[2,4]' as halfvec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,2]' as halfvec), CAST('[0,0]' as halfvec)); +go +~~START~~ +float +NaN +~~END~~ + + +SELECT cosine_distance(CAST('[1,1]' as halfvec), CAST('[1,1]' as halfvec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,0]' as halfvec), CAST('[0,2]' as halfvec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,1]' as halfvec), CAST('[-1,-1]' as halfvec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,2]' as halfvec), CAST('[3]' as halfvec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT cosine_distance(CAST('[1,1]' as halfvec), CAST('[1.1,1.1]' as halfvec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,1]' as halfvec), CAST('[-1.1,-1.1]' as halfvec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,2,3,4,5,6,7,8,9]' as halfvec), CAST('[1,2,3,4,5,6,7,8,9]' as halfvec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,2,3,4,5,6,7,8,9]' as halfvec), CAST('[-1,-2,-3,-4,-5,-6,-7,-8,-9]' as halfvec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT CAST('[1,2]' as halfvec) <=> CAST('[2,4]' as halfvec); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT l1_distance(CAST('[0,0]' as halfvec), CAST('[3,4]' as halfvec)); +go +~~START~~ +float +7.0 +~~END~~ + + +SELECT l1_distance(CAST('[0,0]' as halfvec), CAST('[0,1]' as halfvec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT l1_distance(CAST('[1,2]' as halfvec), CAST('[3]' as halfvec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT l1_distance(CAST('[1,2,3,4,5,6,7,8,9]' as halfvec), CAST('[1,2,3,4,5,6,7,8,9]' as halfvec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT l1_distance(CAST('[1,2,3,4,5,6,7,8,9]' as halfvec), CAST('[0,3,2,5,4,7,6,9,8]' as halfvec)); +go +~~START~~ +float +9.0 +~~END~~ + + +SELECT CAST('[0,0]' as halfvec) <+> CAST('[3,4]' as halfvec); +go +~~START~~ +float +7.0 +~~END~~ + + +SELECT l2_normalize(CAST('[3,4]' as halfvec)); +go +~~START~~ +varchar +[0.60009766,0.7998047] +~~END~~ + + +SELECT l2_normalize(CAST('[3,0]' as halfvec)); +go +~~START~~ +varchar +[1,0] +~~END~~ + + +SELECT l2_normalize(CAST('[0,0.1]' as halfvec)); +go +~~START~~ +varchar +[0,1] +~~END~~ + + +SELECT l2_normalize(CAST('[0,0]' as halfvec)); +go +~~START~~ +varchar +[0,0] +~~END~~ + + +SELECT l2_normalize(CAST('[65504]' as halfvec)); +go +~~START~~ +varchar +[1] +~~END~~ + + +SELECT binary_quantize(CAST('[1,0,-1]' as halfvec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: data type bit is not supported yet)~~ + + +SELECT binary_quantize(CAST('[0,0.1,-0.2,-0.3,0.4,0.5,0.6,-0.7,0.8,-0.9,1]' as halfvec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: data type bit is not supported yet)~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 1, 3); +go +~~START~~ +varchar +[1,2,3] +~~END~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 3, 2); +go +~~START~~ +varchar +[3,4] +~~END~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), -1, 3); +go +~~START~~ +varchar +[1] +~~END~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 3, 9); +go +~~START~~ +varchar +[3,4,5] +~~END~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 1, 0); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: halfvec must have at least 1 dimension)~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 3, -1); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: halfvec must have at least 1 dimension)~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), -1, 2); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: halfvec must have at least 1 dimension)~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 2147483647, 10); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: halfvec must have at least 1 dimension)~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 3, 2147483647); +go +~~START~~ +varchar +[3,4,5] +~~END~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), -2147483644, 2147483647); +go +~~START~~ +varchar +[1,2] +~~END~~ + + +SELECT halfvec_avg(array_agg(CAST(n as halfvec))) FROM generate_series(1, 16002) n; +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cannot cast type integer to halfvec)~~ + + +-- hnsw_halfvec +-- l2 +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING hnsw (val halfvec_l2_ops); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,2,3] +[1,2,4] +[1,1,1] +[0,0,0] +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec) NULLS LAST +Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <-> '[3,3,3]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <-> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <-> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <-> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SELECT COUNT(*) FROM halfvec_table; +go +~~START~~ +int +5 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM halfvec_table +Aggregate (actual rows=1 loops=1) + -> Seq Scan on halfvec_table (actual rows=5 loops=1) +~~END~~ + + +TRUNCATE TABLE halfvec_table; +go + +SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec) NULLS LAST +Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=0 loops=1) + Order By: (val <-> '[3,3,3]'::halfvec) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- inner product +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING hnsw (val halfvec_ip_ops); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <#> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,2,4] +[1,2,3] +[1,1,1] +[0,0,0] +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <#> CAST('[3,3,3]' AS halfvec) NULLS LAST +Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <#> '[3,3,3]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <#> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <#> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <#> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- cosine +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING hnsw (val halfvec_cosine_ops); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <=> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,1,1] +[1,2,3] +[1,2,4] +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <=> CAST('[3,3,3]' AS halfvec) NULLS LAST +Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=3 loops=1) + Order By: (val <=> '[3,3,3]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> CAST('[0,0,0]' AS halfvec)) t2; +go +~~START~~ +int +3 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> CAST('[0,0,0]' AS halfvec) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=3 loops=1) + Order By: (val <=> '[0,0,0]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +3 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=3 loops=1) + Order By: (val <=> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- L1 +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING hnsw (val halfvec_l1_ops); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <+> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,2,3] +[1,2,4] +[1,1,1] +[0,0,0] +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <+> CAST('[3,3,3]' AS halfvec) NULLS LAST +Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <+> '[3,3,3]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <+> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <+> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <+> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + +-- ivfflat +-- l2 +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING ivfflat (val halfvec_l2_ops) WITH (lists = 1); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,2,3] +[1,2,4] +[1,1,1] +[0,0,0] +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec) NULLS LAST +Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <-> '[3,3,3]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <-> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <-> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <-> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SELECT COUNT(*) FROM halfvec_table; +go +~~START~~ +int +5 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM halfvec_table +Aggregate (actual rows=1 loops=1) + -> Seq Scan on halfvec_table (actual rows=5 loops=1) +~~END~~ + + +TRUNCATE TABLE halfvec_table; +go + +SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec) NULLS LAST +Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=0 loops=1) + Order By: (val <-> '[3,3,3]'::halfvec) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- inner product +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING ivfflat (val halfvec_ip_ops) WITH (lists = 1) WITH (lists = 1); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near 'lists' at line 1 and character position 92)~~ + + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <#> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,2,4] +[1,2,3] +[1,1,1] +[0,0,0] + +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <#> CAST('[3,3,3]' AS halfvec) NULLS LAST +Sort (actual rows=5 loops=1) + Sort Key: ((val <#> '[3,3,3]'::halfvec)) + Sort Method: quicksort Memory: 25kB + -> Seq Scan on halfvec_table (actual rows=5 loops=1) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <#> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +5 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <#> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Sort (actual rows=5 loops=1) + Sort Key: ((halfvec_table.val <#> $0)) + Sort Method: quicksort Memory: 25kB + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) + -> Seq Scan on halfvec_table (actual rows=5 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- cosine +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING ivfflat (val halfvec_cosine_ops) WITH (lists = 1); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <=> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,1,1] +[1,2,3] +[1,2,4] +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <=> CAST('[3,3,3]' AS halfvec) NULLS LAST +Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=3 loops=1) + Order By: (val <=> '[3,3,3]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> CAST('[0,0,0]' AS halfvec)) t2; +go +~~START~~ +int +3 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> CAST('[0,0,0]' AS halfvec) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=3 loops=1) + Order By: (val <=> '[0,0,0]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +3 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=3 loops=1) + Order By: (val <=> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + +select set_config('babelfishpg_tsql.explain_costs', 'on', false); +go +~~START~~ +text +on +~~END~~ + +select set_config('babelfishpg_tsql.explain_timing', 'on', false); +go +~~START~~ +text +on +~~END~~ + +select set_config('babelfishpg_tsql.explain_summary', 'on', false); +go +~~START~~ +text +on +~~END~~ + + +-- system metadata, all objects get their datatype info from one of: +-- typecodes or datatype_info data we have created. Testing sys.types for typecodes +-- and sp_sproc_columns_100 for datatype_info is enough +select count(*) from sys.types where name = 'halfvec'; +go +~~START~~ +int +1 +~~END~~ + + +create procedure halfvec_proc_1 @a halfvec, @b varchar(max) as select @a as a, @b as b; +go + +exec sp_sproc_columns_100 @procedure_name= 'halfvec_proc_1' +go +~~START~~ +varchar#!#varchar#!#nvarchar#!#varchar#!#smallint#!#smallint#!#varchar#!#int#!#int#!#smallint#!#smallint#!#smallint#!#varchar#!#nvarchar#!#smallint#!#smallint#!#int#!#int#!#varchar#!#tinyint +vector_db#!#dbo#!#halfvec_proc_1;1#!#@RETURN_VALUE#!#5#!#4#!#int#!#10#!#4#!#0#!#10#!#0#!##!##!#4#!##!##!#0#!#NO#!#56 +vector_db#!#dbo#!#halfvec_proc_1;1#!#@a#!#1#!##!#halfvec#!#0#!#-1#!#0#!##!##!##!##!##!##!##!#1#!#NO#!# +vector_db#!#dbo#!#halfvec_proc_1;1#!#@b#!#1#!#12#!#varchar#!#0#!#8000#!#0#!##!#1#!##!##!#12#!##!##!#2#!#YES#!#39 +~~END~~ + + +drop procedure halfvec_proc_1; +go + +create table t(a halfvec(3), b varchar(max)) +go +select * from information_schema.columns where table_name = 't' +go +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#int#!#nvarchar#!#varchar#!#nvarchar#!#int#!#int#!#tinyint#!#smallint#!#int#!#smallint#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +vector_db#!#dbo#!#t#!#a#!#1#!##!#YES#!#halfvec#!#-1#!##!##!##!##!##!##!##!##!##!##!##!##!##!# +vector_db#!#dbo#!#t#!#b#!#2#!##!#YES#!#varchar#!#-1#!#-1#!##!##!##!##!##!##!##!##!##!#chinese_prc_ci_as#!##!##!# +~~END~~ + +select count(*) from sys.columns where object_id = sys.object_id('t') +go +~~START~~ +int +2 +~~END~~ + +drop table t; +go + +-- Testing with different typmod +CREATE TABLE document_embeddings ( + id int PRIMARY KEY, + embedding halfvec(4) NOT NULL +); +go +CREATE INDEX document_embeddings_embedding_idx ON document_embeddings USING hnsw (embedding vector_l2_ops); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: operator class "vector_l2_ops" does not accept data type halfvec)~~ + +INSERT INTO document_embeddings(id, embedding) VALUES(1, CAST('[21,-2,0,2.5]' as halfvec)); +INSERT INTO document_embeddings(id, embedding) VALUES(2, CAST('[5, 10000, -9.75, 8]' as halfvec)); +INSERT INTO document_embeddings(id, embedding) VALUES(3, CAST('[-0.02,23,3.14,00]' as halfvec)); +WITH cte AS ( + SELECT CAST(2e2 AS real) a, 80 b, CAST('-65519' AS real) c, -1 d +) +INSERT INTO document_embeddings(id, embedding) SELECT 4, CAST(CONCAT('[',a, ',', b, ',', c, ',', d, ']') as halfvec) FROM cte; +go +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +SELECT * FROM document_embeddings; +go +~~START~~ +int#!#varchar +1#!#[21,-2,0,2.5] +2#!#[5,10000,-9.75,8] +3#!#[-0.020004272,23,3.140625,0] +4#!#[200,80,-65504,-1] +~~END~~ + +SELECT TOP 5 * FROM document_embeddings ORDER BY embedding <=> '[3,1,2,4]'; +go +~~START~~ +int#!#varchar +1#!#[21,-2,0,2.5] +3#!#[-0.020004272,23,3.140625,0] +2#!#[5,10000,-9.75,8] +4#!#[200,80,-65504,-1] +~~END~~ + +-- extending PG syntax to have generic vector expression support +SELECT count(embedding <-> '[3,1,2,0]') FROM document_embeddings; +SELECT count(embedding <=> '[3,1,2,0]') FROM document_embeddings; +SELECT count(embedding <#> '[3,1,2,0]') FROM document_embeddings; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +int +4 +~~END~~ + +~~START~~ +int +4 +~~END~~ + + +-- WHERE clause expressions +SELECT * FROM document_embeddings WHERE embedding <-> '[3,20, 1,-2.5]' < 5; +SELECT * FROM document_embeddings WHERE embedding <=> '[3,20, 1,-2.5]' < 5; +SELECT * FROM document_embeddings WHERE embedding <#> '[3,20, 1,-2.5]' < 5; +go +~~START~~ +int#!#varchar +~~END~~ + +~~START~~ +int#!#varchar +1#!#[21,-2,0,2.5] +2#!#[5,10000,-9.75,8] +3#!#[-0.020004272,23,3.140625,0] +4#!#[200,80,-65504,-1] +~~END~~ + +~~START~~ +int#!#varchar +1#!#[21,-2,0,2.5] +2#!#[5,10000,-9.75,8] +3#!#[-0.020004272,23,3.140625,0] +~~END~~ + + +SELECT AVG(embedding) FROM document_embeddings; +go +~~START~~ +varchar +[56.5,2526,-16376,2.375] +~~END~~ + + +SELECT id, AVG(embedding) FROM document_embeddings GROUP BY id; +go +~~START~~ +int#!#varchar +2#!#[5,10000,-9.75,8] +3#!#[-0.020004272,23,3.140625,0] +4#!#[200,80,-65504,-1] +1#!#[21,-2,0,2.5] +~~END~~ + + +Drop table document_embeddings +go + +-- psql +-- Need to terminate active session before cleaning up the login +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'vector_login' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +GO +~~START~~ +bool +t +~~END~~ + + +-- tsql +use master +go + +exec sp_execute_postgresql 'drop extension vector'; +go + +drop login vector_login +go + +drop database vector_db; +go diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/TestSparsevecDatatype.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/TestSparsevecDatatype.out new file mode 100644 index 00000000000..aa069df9fdc --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/TestSparsevecDatatype.out @@ -0,0 +1,1583 @@ +-- tsql +-- should throw error since vector is only allowed in sys +exec sp_execute_postgresql 'create extension vector'; +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'vector' extension creation is restricted to 'sys' schema)~~ + + +exec sp_execute_postgresql 'create extension vector with schema sys'; +go + +create login vector_login with password='12345678' +go + +Alter server role sysadmin add member vector_login +go + +create database vector_db; +go + +use vector_db +go + +-- tsql user=vector_login password=12345678 +use vector_db; +go + +select set_config('babelfishpg_tsql.explain_costs', 'off', false); +go +~~START~~ +text +off +~~END~~ + +select set_config('babelfishpg_tsql.explain_timing', 'off', false); +go +~~START~~ +text +off +~~END~~ + +select set_config('babelfishpg_tsql.explain_summary', 'off', false); +go +~~START~~ +text +off +~~END~~ + + +SELECT CAST('{1:1.5,3:3.5}/5' as sparsevec); +go +~~START~~ +varchar +{1:1.5,3:3.5}/5 +~~END~~ + + +SELECT CAST('{1:-2,3:-4}/5' as sparsevec); +go +~~START~~ +varchar +{1:-2,3:-4}/5 +~~END~~ + + +SELECT CAST('{1:2.,3:4.}/5' as sparsevec); +go +~~START~~ +varchar +{1:2,3:4}/5 +~~END~~ + + +SELECT CAST(' { 1 : 1.5 , 3 : 3.5 } / 5 ' as sparsevec); +go +~~START~~ +varchar +{1:1.5,3:3.5}/5 +~~END~~ + + +SELECT CAST('{1:1.23456}/1' as sparsevec); +go +~~START~~ +varchar +{1:1.23456}/1 +~~END~~ + + +SELECT CAST('{1:hello,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{1:hello,2:1}/2")~~ + + +SELECT CAST('{1:NaN,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: NaN not allowed in sparsevec)~~ + + +SELECT CAST('{1:Infinity,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: infinite value not allowed in sparsevec)~~ + + +SELECT CAST('{1:-Infinity,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: infinite value not allowed in sparsevec)~~ + + +SELECT CAST('{1:1.5e38,2:-1.5e38}/2' as sparsevec); +go +~~START~~ +varchar +{1:1.5e+38,2:-1.5e+38}/2 +~~END~~ + + +SELECT CAST('{1:1.5e+38,2:-1.5e+38}/2' as sparsevec); +go +~~START~~ +varchar +{1:1.5e+38,2:-1.5e+38}/2 +~~END~~ + + +SELECT CAST('{1:1.5e-38,2:-1.5e-38}/2' as sparsevec); +go +~~START~~ +varchar +{1:1.5e-38,2:-1.5e-38}/2 +~~END~~ + + +SELECT CAST('{1:4e38,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: "4e38" is out of range for type sparsevec)~~ + + +SELECT CAST('{1:-4e38,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: "-4e38" is out of range for type sparsevec)~~ + + +SELECT CAST('{1:1e-46,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: "1e-46" is out of range for type sparsevec)~~ + + +SELECT CAST('{1:-1e-46,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: "-1e-46" is out of range for type sparsevec)~~ + + +SELECT CAST('' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "")~~ + + +SELECT CAST('{' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{")~~ + + +SELECT CAST('{ ' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{ ")~~ + + +SELECT CAST('{:' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{:")~~ + + +SELECT CAST('{,' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{,")~~ + + +SELECT CAST('{}' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{}")~~ + + +SELECT CAST('{}/'' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near ''{}/'' at line 1 and character position 12)~~ + + +SELECT CAST('{}/1' as sparsevec); +go +~~START~~ +varchar +{}/1 +~~END~~ + + +SELECT CAST('{}/1a' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{}/1a")~~ + + +SELECT CAST('{ }/1' as sparsevec); +go +~~START~~ +varchar +{}/1 +~~END~~ + + +SELECT CAST('{:}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{:}/1")~~ + + +SELECT CAST('{,}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{,}/1")~~ + + +SELECT CAST('{1,}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{1,}/1")~~ + + +SELECT CAST('{:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{:1}/1")~~ + + +SELECT CAST('{1:}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{1:}/1")~~ + + +SELECT CAST('{1a:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{1a:1}/1")~~ + + +SELECT CAST('{1:1a}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{1:1a}/1")~~ + + +SELECT CAST('{1:1,}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{1:1,}/1")~~ + + +SELECT CAST('{1:0,2:1,3:0}/3' as sparsevec); +go +~~START~~ +varchar +{2:1}/3 +~~END~~ + + +SELECT CAST('{2:1,1:1}/2' as sparsevec); +go +~~START~~ +varchar +{1:1,2:1}/2 +~~END~~ + + +SELECT CAST('{1:1,1:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec indices must not contain duplicates)~~ + + +SELECT CAST('{1:1,2:1,1:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec indices must not contain duplicates)~~ + + +SELECT CAST('{}/5' as sparsevec); +go +~~START~~ +varchar +{}/5 +~~END~~ + + +SELECT CAST('{}/-1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec must have at least 1 dimension)~~ + + +SELECT CAST('{}/1000000001' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec cannot have more than 1000000000 dimensions)~~ + + +SELECT CAST('{}/2147483648' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec cannot have more than 1000000000 dimensions)~~ + + +SELECT CAST('{}/-2147483649' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec must have at least 1 dimension)~~ + + +SELECT CAST('{}/9223372036854775808' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec cannot have more than 1000000000 dimensions)~~ + + +SELECT CAST('{}/-9223372036854775809' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec must have at least 1 dimension)~~ + + +SELECT CAST('{2147483647:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec index out of bounds)~~ + + +SELECT CAST('{2147483648:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec index out of bounds)~~ + + +SELECT CAST('{-2147483648:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec index out of bounds)~~ + + +SELECT CAST('{-2147483649:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec index out of bounds)~~ + + +SELECT CAST('{0:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec index out of bounds)~~ + + +SELECT CAST('{2:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec index out of bounds)~~ + + +SELECT CAST('{}/3' as sparsevec(3)); +go +~~START~~ +varchar +{}/3 +~~END~~ + + +SELECT CAST('{}/3' as sparsevec(2)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: expected 2 dimensions, not 3)~~ + + +SELECT CAST('{}/3' as sparsevec(3, 2)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid type modifier)~~ + + +SELECT CAST('{}/3' as sparsevec('a')); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '(' at line 1 and character position 31)~~ + + +SELECT CAST('{}/3' as sparsevec(0)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: dimensions for type sparsevec must be at least 1)~~ + + +SELECT CAST('{}/3' as sparsevec(1000000001)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: dimensions for type sparsevec cannot exceed 1000000000)~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) < CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +0 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) < CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +0 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) <= CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +1 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) <= CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +0 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) = CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +1 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) = CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +0 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) != CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +0 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) != CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +1 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) >= CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +1 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) >= CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +1 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) > CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +0 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) > CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +1 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{1:1,2:2,3:3}/3' as sparsevec), CAST('{1:1,2:2,3:3}/3' as sparsevec)); +go +~~START~~ +int +0 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{1:1,2:2,3:3}/3' as sparsevec), CAST('{}/3' as sparsevec)); +go +~~START~~ +int +1 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{}/3' as sparsevec), CAST('{1:1,2:2,3:3}/3' as sparsevec)); +go +~~START~~ +int +-1 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:1,2:2,3:3}/3' as sparsevec)); +go +~~START~~ +int +-1 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{1:1,2:2,3:3}/3' as sparsevec), CAST('{1:1,2:2}/2' as sparsevec)); +go +~~START~~ +int +1 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:2,2:3,3:4}/3' as sparsevec)); +go +~~START~~ +int +-1 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{1:2,2:3}/2' as sparsevec), CAST('{1:1,2:2,3:3}/3' as sparsevec)); +go +~~START~~ +int +1 +~~END~~ + + +SELECT ROUND(l2_norm(CAST('{1:1,2:1}/2' as sparsevec)), 5); +go +~~START~~ +numeric +1.41421 +~~END~~ + + +SELECT l2_norm(CAST('{1:3,2:4}/2' as sparsevec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_norm(CAST('{2:1}/2' as sparsevec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT l2_norm(CAST('{1:3e37,2:4e37}/2' as sparsevec)); +go +~~START~~ +float +5.000000042966943E37 +~~END~~ + + +SELECT l2_norm(CAST('{}/2' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT l2_norm(CAST('{1:2}/1' as sparsevec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT l2_distance(CAST('{}/2' as sparsevec), CAST('{1:3,2:4}/2' as sparsevec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_distance(CAST('{1:3}/2' as sparsevec), CAST('{2:4}/2' as sparsevec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_distance(CAST('{2:4}/2' as sparsevec), CAST('{1:3}/2' as sparsevec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_distance(CAST('{1:3,2:4}/2' as sparsevec), CAST('{}/2' as sparsevec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_distance(CAST('{}/2' as sparsevec), CAST('{2:1}/2' as sparsevec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT CAST('{}/2' as sparsevec) <-> CAST('{1:3,2:4}/2' as sparsevec); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT inner_product(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:2,2:4}/2' as sparsevec)); +go +~~START~~ +float +10.0 +~~END~~ + + +SELECT inner_product(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:3}/1' as sparsevec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different sparsevec dimensions 2 and 1)~~ + + +SELECT inner_product(CAST('{1:1,3:3}/4' as sparsevec), CAST('{2:2,4:4}/4' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT inner_product(CAST('{2:2,4:4}/4' as sparsevec), CAST('{1:1,3:3}/4' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT inner_product(CAST('{1:1,3:3,5:5}/5' as sparsevec), CAST('{2:4,3:6,4:8}/5' as sparsevec)); +go +~~START~~ +float +18.0 +~~END~~ + + +SELECT inner_product(CAST('{1:1}/2' as sparsevec), CAST('{}/2' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT inner_product(CAST('{}/2' as sparsevec), CAST('{1:1}/2' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT inner_product(CAST('{1:3e38}/1' as sparsevec), CAST('{1:3e38}/1' as sparsevec)); +go +~~START~~ +float +Infinity +~~END~~ + + +SELECT inner_product(CAST('{1:1,3:3,5:5}/5' as sparsevec), CAST('{2:4,3:6,4:8}/5' as sparsevec)); +go +~~START~~ +float +18.0 +~~END~~ + + +SELECT CAST('{1:1,2:2}/2' as sparsevec) <#> CAST('{1:3,2:4}/2' as sparsevec); +go +~~START~~ +float +-11.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:2,2:4}/2' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:1,2:2}/2' as sparsevec), CAST('{}/2' as sparsevec)); +go +~~START~~ +float +NaN +~~END~~ + + +SELECT cosine_distance(CAST('{1:1,2:1}/2' as sparsevec), CAST('{1:1,2:1}/2' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:1}/2' as sparsevec), CAST('{2:2}/2' as sparsevec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:1,2:1}/2' as sparsevec), CAST('{1:-1,2:-1}/2' as sparsevec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:2}/2' as sparsevec), CAST('{2:2}/2' as sparsevec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT cosine_distance(CAST('{2:2}/2' as sparsevec), CAST('{1:2}/2' as sparsevec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:3}/1' as sparsevec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different sparsevec dimensions 2 and 1)~~ + + +SELECT cosine_distance(CAST('{1:1,2:1}/2' as sparsevec), CAST('{1:1.1,2:1.1}/2' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:1,2:1}/2' as sparsevec), CAST('{1:-1.1,2:-1.1}/2' as sparsevec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:3e38}/1' as sparsevec), CAST('{1:3e38}/1' as sparsevec)); +go +~~START~~ +float +NaN +~~END~~ + + +SELECT cosine_distance(CAST('{}/1' as sparsevec), CAST('{}/1' as sparsevec)); +go +~~START~~ +float +NaN +~~END~~ + + +SELECT CAST('{1:1,2:2}/2' as sparsevec) <=> CAST('{1:2,2:4}/2' as sparsevec); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT l1_distance(CAST('{}/2' as sparsevec), CAST('{1:3,2:4}/2' as sparsevec)); +go +~~START~~ +float +7.0 +~~END~~ + + +SELECT l1_distance(CAST('{}/2' as sparsevec), CAST('{2:1}/2' as sparsevec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT l1_distance(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:3}/1' as sparsevec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different sparsevec dimensions 2 and 1)~~ + + +SELECT l1_distance(CAST('{1:3e38}/1' as sparsevec), CAST('{1:-3e38}/1' as sparsevec)); +go +~~START~~ +float +Infinity +~~END~~ + + +SELECT l1_distance(CAST('{1:1,3:3,5:5,7:7}/8' as sparsevec), CAST('{2:2,4:4,6:6,8:8}/8' as sparsevec)); +go +~~START~~ +float +36.0 +~~END~~ + + +SELECT l1_distance(CAST('{1:1,3:3,5:5,7:7,9:9}/9' as sparsevec), CAST('{2:2,4:4,6:6,8:8}/9' as sparsevec)); +go +~~START~~ +float +45.0 +~~END~~ + + +SELECT CAST('{}/2' as sparsevec) <+> CAST('{1:3,2:4}/2' as sparsevec); +go +~~START~~ +float +7.0 +~~END~~ + + +SELECT l2_normalize(CAST('{1:3,2:4}/2' as sparsevec)); +go +~~START~~ +varchar +{1:0.6,2:0.8}/2 +~~END~~ + + +SELECT l2_normalize(CAST('{1:3}/2' as sparsevec)); +go +~~START~~ +varchar +{1:1}/2 +~~END~~ + + +SELECT l2_normalize(CAST('{2:0.1}/2' as sparsevec)); +go +~~START~~ +varchar +{2:1}/2 +~~END~~ + + +SELECT l2_normalize(CAST('{}/2' as sparsevec)); +go +~~START~~ +varchar +{}/2 +~~END~~ + + +SELECT l2_normalize(CAST('{1:3e38}/1' as sparsevec)); +go +~~START~~ +varchar +{1:1}/1 +~~END~~ + + +SELECT l2_normalize(CAST('{1:3e38,2:1e-37}/2' as sparsevec)); +go +~~START~~ +varchar +{1:1}/2 +~~END~~ + + +SELECT l2_normalize(CAST('{2:3e37,4:3e-37,6:4e37,8:4e-37}/9' as sparsevec)); +go +~~START~~ +varchar +{2:0.6,6:0.8}/9 +~~END~~ + + + +-- L2 +CREATE TABLE sparsevec_table (val sparsevec(3)); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{}/3' AS sparsevec)), (CAST('{1:1,2:2,3:3}/3' AS sparsevec)), (CAST('{1:1,2:1,3:1}/3' AS sparsevec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON sparsevec_table USING hnsw (val sparsevec_l2_ops); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{1:1,2:2,3:4}/3' AS sparsevec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM sparsevec_table ORDER BY val <-> CAST('{1:3,2:3,3:3}/3' AS sparsevec); +go +~~START~~ +varchar +{1:1,2:2,3:3}/3 +{1:1,2:2,3:4}/3 +{1:1,2:1,3:1}/3 +{}/3 +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM sparsevec_table ORDER BY val <-> CAST('{1:3,2:3,3:3}/3' AS sparsevec) NULLS LAST +Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=4 loops=1) + Order By: (val <-> '{1:3,2:3,3:3}/3'::sparsevec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <-> (SELECT CAST(NULL as sparsevec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <-> (SELECT CAST(NULL as sparsevec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=4 loops=1) + Order By: (val <-> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SELECT COUNT(*) FROM sparsevec_table; +go +~~START~~ +int +5 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM sparsevec_table +Aggregate (actual rows=1 loops=1) + -> Seq Scan on sparsevec_table (actual rows=5 loops=1) +~~END~~ + + +TRUNCATE TABLE sparsevec_table; +go + +SELECT * FROM sparsevec_table ORDER BY val <-> CAST('{1:3,2:3,3:3}/3' AS sparsevec); +go +~~START~~ +varchar +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM sparsevec_table ORDER BY val <-> CAST('{1:3,2:3,3:3}/3' AS sparsevec) NULLS LAST +Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=0 loops=1) + Order By: (val <-> '{1:3,2:3,3:3}/3'::sparsevec) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE sparsevec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- inner product +CREATE TABLE sparsevec_table (val sparsevec(3)); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{}/3' AS sparsevec)), (CAST('{1:1,2:2,3:3}/3' AS sparsevec)), (CAST('{1:1,2:1,3:1}/3' AS sparsevec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON sparsevec_table USING hnsw (val sparsevec_ip_ops); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{1:1,2:2,3:4}/3' AS sparsevec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM sparsevec_table ORDER BY val <#> CAST('{1:3,2:3,3:3}/3' AS sparsevec); +go +~~START~~ +varchar +{1:1,2:2,3:4}/3 +{1:1,2:2,3:3}/3 +{1:1,2:1,3:1}/3 +{}/3 +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM sparsevec_table ORDER BY val <#> CAST('{1:3,2:3,3:3}/3' AS sparsevec) NULLS LAST +Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=4 loops=1) + Order By: (val <#> '{1:3,2:3,3:3}/3'::sparsevec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <#> (SELECT CAST(NULL as sparsevec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <#> (SELECT CAST(NULL as sparsevec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=4 loops=1) + Order By: (val <#> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE sparsevec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- cosine +CREATE TABLE sparsevec_table (val sparsevec(3)); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{}/3' AS sparsevec)), (CAST('{1:1,2:2,3:3}/3' AS sparsevec)), (CAST('{1:1,2:1,3:1}/3' AS sparsevec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON sparsevec_table USING hnsw (val sparsevec_cosine_ops); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{1:1,2:2,3:4}/3' AS sparsevec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM sparsevec_table ORDER BY val <=> CAST('{1:3,2:3,3:3}/3' AS sparsevec); +go +~~START~~ +varchar +{1:1,2:1,3:1}/3 +{1:1,2:2,3:3}/3 +{1:1,2:2,3:4}/3 +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM sparsevec_table ORDER BY val <=> CAST('{1:3,2:3,3:3}/3' AS sparsevec) NULLS LAST +Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=3 loops=1) + Order By: (val <=> '{1:3,2:3,3:3}/3'::sparsevec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <=> CAST('{}/3' AS sparsevec)) t2; +go +~~START~~ +int +3 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <=> CAST('{}/3' AS sparsevec) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=3 loops=1) + Order By: (val <=> '{}/3'::sparsevec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <=> (SELECT CAST(NULL as sparsevec))) t2; +go +~~START~~ +int +3 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <=> (SELECT CAST(NULL as sparsevec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=3 loops=1) + Order By: (val <=> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE sparsevec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- L1 +CREATE TABLE sparsevec_table (val sparsevec(3)); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{}/3' AS sparsevec)), (CAST('{1:1,2:2,3:3}/3' AS sparsevec)), (CAST('{1:1,2:1,3:1}/3' AS sparsevec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON sparsevec_table USING hnsw (val sparsevec_l1_ops); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{1:1,2:2,3:4}/3' AS sparsevec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM sparsevec_table ORDER BY val <+> CAST('{1:3,2:3,3:3}/3' AS sparsevec); +go +~~START~~ +varchar +{1:1,2:2,3:3}/3 +{1:1,2:2,3:4}/3 +{1:1,2:1,3:1}/3 +{}/3 +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM sparsevec_table ORDER BY val <+> CAST('{1:3,2:3,3:3}/3' AS sparsevec) NULLS LAST +Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=4 loops=1) + Order By: (val <+> '{1:3,2:3,3:3}/3'::sparsevec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <+> (SELECT CAST(NULL as sparsevec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <+> (SELECT CAST(NULL as sparsevec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=4 loops=1) + Order By: (val <+> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE sparsevec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- non-zero elements +CREATE TABLE sparsevec_table (val sparsevec(1001)); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST(array_fill(1, ARRAY[1001]) AS sparsevec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '(' at line 1 and character position 46)~~ + + +CREATE INDEX idx ON sparsevec_table USING hnsw (val sparsevec_l2_ops); +go + +TRUNCATE TABLE sparsevec_table; +go + +DROP TABLE sparsevec_table; +go + +select set_config('babelfishpg_tsql.explain_costs', 'on', false); +go +~~START~~ +text +on +~~END~~ + +select set_config('babelfishpg_tsql.explain_timing', 'on', false); +go +~~START~~ +text +on +~~END~~ + +select set_config('babelfishpg_tsql.explain_summary', 'on', false); +go +~~START~~ +text +on +~~END~~ + + +-- system metadata, all objects get their datatype info from one of: +-- typecodes or datatype_info data we have created. Testing sys.types for typecodes +-- and sp_sproc_columns_100 for datatype_info is enough +select count(*) from sys.types where name = 'sparsevec'; +go +~~START~~ +int +1 +~~END~~ + + +create procedure sparsevec_proc_1 @a sparsevec, @b varchar(max) as select @a as a, @b as b; +go + +exec sp_sproc_columns_100 @procedure_name= 'sparsevec_proc_1' +go +~~START~~ +varchar#!#varchar#!#nvarchar#!#varchar#!#smallint#!#smallint#!#varchar#!#int#!#int#!#smallint#!#smallint#!#smallint#!#varchar#!#nvarchar#!#smallint#!#smallint#!#int#!#int#!#varchar#!#tinyint +vector_db#!#dbo#!#sparsevec_proc_1;1#!#@RETURN_VALUE#!#5#!#4#!#int#!#10#!#4#!#0#!#10#!#0#!##!##!#4#!##!##!#0#!#NO#!#56 +vector_db#!#dbo#!#sparsevec_proc_1;1#!#@a#!#1#!##!#sparsevec#!#0#!#-1#!#0#!##!##!##!##!##!##!##!#1#!#NO#!# +vector_db#!#dbo#!#sparsevec_proc_1;1#!#@b#!#1#!#12#!#varchar#!#0#!#8000#!#0#!##!#1#!##!##!#12#!##!##!#2#!#YES#!#39 +~~END~~ + + +drop procedure sparsevec_proc_1; +go + +create table t(a sparsevec(3), b varchar(max)) +go +select * from information_schema.columns where table_name = 't' +go +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#int#!#nvarchar#!#varchar#!#nvarchar#!#int#!#int#!#tinyint#!#smallint#!#int#!#smallint#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +vector_db#!#dbo#!#t#!#a#!#1#!##!#YES#!#sparsevec#!#-1#!##!##!##!##!##!##!##!##!##!##!##!##!##!# +vector_db#!#dbo#!#t#!#b#!#2#!##!#YES#!#varchar#!#-1#!#-1#!##!##!##!##!##!##!##!##!##!#chinese_prc_ci_as#!##!##!# +~~END~~ + +select count(*) from sys.columns where object_id = sys.object_id('t') +go +~~START~~ +int +2 +~~END~~ + +drop table t; +go + +-- Testing with different typmod +CREATE TABLE document_embeddings ( + id int PRIMARY KEY, + embedding sparsevec(5) NOT NULL +); +go +CREATE INDEX document_embeddings_embedding_idx ON document_embeddings USING hnsw (embedding vector_l2_ops); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: operator class "vector_l2_ops" does not accept data type sparsevec)~~ + +INSERT INTO document_embeddings(id, embedding) VALUES(1, CAST('{1:5,2:1}/5' as sparsevec)); +INSERT INTO document_embeddings(id, embedding) VALUES(2, CAST('{1:5, 2:10000, 3:-9.75, 4:8}/5' as sparsevec)); +INSERT INTO document_embeddings(id, embedding) VALUES(3, CAST('{1:-0.02,2:23,4:3.14,5:00}/5' as sparsevec)); +WITH cte AS ( + SELECT CAST(2e2 AS real) a, 80 b, CAST('-305' AS real) c, -1 d +) +INSERT INTO document_embeddings(id, embedding) SELECT 4, CAST(CONCAT('{1:',a, ',3:', b, ',4:', c, ',5:', d, '}/5') as sparsevec) FROM cte; +go +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +SELECT * FROM document_embeddings; +go +~~START~~ +int#!#varchar +1#!#{1:5,2:1}/5 +2#!#{1:5,2:10000,3:-9.75,4:8}/5 +3#!#{1:-0.02,2:23,4:3.14}/5 +4#!#{1:200,3:80,4:-305,5:-1}/5 +~~END~~ + +SELECT TOP 5 * FROM document_embeddings ORDER BY embedding <=> '{1:1,2:2,3:4}/5'; +go +~~START~~ +int#!#varchar +2#!#{1:5,2:10000,3:-9.75,4:8}/5 +3#!#{1:-0.02,2:23,4:3.14}/5 +4#!#{1:200,3:80,4:-305,5:-1}/5 +1#!#{1:5,2:1}/5 +~~END~~ + +-- extending PG syntax to have generic vector expression support +SELECT count(embedding <-> '{1:1,2:2,3:4}/5') FROM document_embeddings; +SELECT count(embedding <=> '{1:1,2:2,3:4}/5') FROM document_embeddings; +SELECT count(embedding <#> '{1:1,2:2,3:4}/5') FROM document_embeddings; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +int +4 +~~END~~ + +~~START~~ +int +4 +~~END~~ + + +-- WHERE clause expressions +SELECT * FROM document_embeddings WHERE embedding <-> '{1:1,2:2,4:4}/5' < 5; +SELECT * FROM document_embeddings WHERE embedding <=> '{1:1,2:2,4:4}/5' < 5; +SELECT * FROM document_embeddings WHERE embedding <#> '{1:1,2:2,4:4}/5' < 5; +go +~~START~~ +int#!#varchar +~~END~~ + +~~START~~ +int#!#varchar +1#!#{1:5,2:1}/5 +2#!#{1:5,2:10000,3:-9.75,4:8}/5 +3#!#{1:-0.02,2:23,4:3.14}/5 +4#!#{1:200,3:80,4:-305,5:-1}/5 +~~END~~ + +~~START~~ +int#!#varchar +1#!#{1:5,2:1}/5 +2#!#{1:5,2:10000,3:-9.75,4:8}/5 +3#!#{1:-0.02,2:23,4:3.14}/5 +~~END~~ + + +SELECT AVG(embedding) FROM document_embeddings; +go +~~ERROR (Code: 206)~~ + +~~ERROR (Message: The function avg is found but cannot be used. Possibly due to datatype mismatch and implicit casting is not allowed.)~~ + + +SELECT id, AVG(embedding) FROM document_embeddings GROUP BY id; +go +~~ERROR (Code: 206)~~ + +~~ERROR (Message: The function avg is found but cannot be used. Possibly due to datatype mismatch and implicit casting is not allowed.)~~ + + +Drop table document_embeddings +go + +-- psql +-- Need to terminate active session before cleaning up the login +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'vector_login' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +GO +~~START~~ +bool +t +~~END~~ + + +-- tsql +use master +go + +exec sp_execute_postgresql 'drop extension vector'; +go + +drop login vector_login +go + +drop database vector_db; +go diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/TestVectorDatatype.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/TestVectorDatatype.out index f197835e1ee..f1f0bb5f9fe 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/TestVectorDatatype.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/TestVectorDatatype.out @@ -101,7 +101,7 @@ go ~~ERROR (Message: value out of range: underflow)~~ -SELECT vector_dims('[1,2,3]'); +SELECT vector_dims(CAST('[1,2,3]' as vector)); go ~~START~~ int @@ -140,7 +140,7 @@ go ~~ERROR (Message: syntax error near 'Cast' at line 1 and character position 19)~~ -SELECT l2_distance('[0,0]', '[3,4]'); +SELECT l2_distance(CAST('[0,0]' as vector), CAST('[3,4]' as vector)); go ~~START~~ float @@ -148,7 +148,7 @@ float ~~END~~ -SELECT l2_distance('[0,0]', '[0,1]'); +SELECT l2_distance(CAST('[0,0]' as vector), CAST('[0,1]' as vector)); go ~~START~~ float @@ -156,14 +156,14 @@ float ~~END~~ -SELECT l2_distance('[1,2]', '[3]'); +SELECT l2_distance(CAST('[1,2]' as vector), CAST('[3]' as vector)); go ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: different vector dimensions 2 and 1)~~ -SELECT l2_distance('[3e38]', '[-3e38]'); +SELECT l2_distance(CAST('[3e38]' as vector), CAST('[-3e38]' as vector)); go ~~START~~ float @@ -171,7 +171,7 @@ Infinity ~~END~~ -SELECT inner_product('[1,2]', '[3,4]'); +SELECT inner_product(CAST('[1,2]' as vector), CAST('[3,4]' as vector)); go ~~START~~ float @@ -179,14 +179,14 @@ float ~~END~~ -SELECT inner_product('[1,2]', '[3]'); +SELECT inner_product(CAST('[1,2]' as vector), CAST('[3]' as vector)); go ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: different vector dimensions 2 and 1)~~ -SELECT inner_product('[3e38]', '[3e38]'); +SELECT inner_product(CAST('[3e38]' as vector), CAST('[3e38]' as vector)); go ~~START~~ float @@ -194,7 +194,7 @@ Infinity ~~END~~ -SELECT cosine_distance('[1,2]', '[2,4]'); +SELECT cosine_distance(CAST('[1,2]' as vector), CAST('[2,4]' as vector)); go ~~START~~ float @@ -202,7 +202,7 @@ float ~~END~~ -SELECT cosine_distance('[1,2]', '[0,0]'); +SELECT cosine_distance(CAST('[1,2]' as vector), CAST('[0,0]' as vector)); go ~~START~~ float @@ -210,7 +210,7 @@ NaN ~~END~~ -SELECT cosine_distance('[1,1]', '[1,1]'); +SELECT cosine_distance(CAST('[1,1]' as vector), CAST('[1,1]' as vector)); go ~~START~~ float @@ -218,7 +218,7 @@ float ~~END~~ -SELECT cosine_distance('[1,0]', '[0,2]'); +SELECT cosine_distance(CAST('[1,0]' as vector), CAST('[0,2]' as vector)); go ~~START~~ float @@ -226,7 +226,7 @@ float ~~END~~ -SELECT cosine_distance('[1,1]', '[-1,-1]'); +SELECT cosine_distance(CAST('[1,1]' as vector), CAST('[-1,-1]' as vector)); go ~~START~~ float @@ -234,14 +234,14 @@ float ~~END~~ -SELECT cosine_distance('[1,2]', '[3]'); +SELECT cosine_distance(CAST('[1,2]' as vector), CAST('[3]' as vector)); go ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: different vector dimensions 2 and 1)~~ -SELECT cosine_distance('[1,1]', '[1.1,1.1]'); +SELECT cosine_distance(CAST('[1,1]' as vector), CAST('[1.1,1.1]' as vector)); go ~~START~~ float @@ -249,7 +249,7 @@ float ~~END~~ -SELECT cosine_distance('[1,1]', '[-1.1,-1.1]'); +SELECT cosine_distance(CAST('[1,1]' as vector), CAST('[-1.1,-1.1]' as vector)); go ~~START~~ float @@ -257,7 +257,7 @@ float ~~END~~ -SELECT cosine_distance('[3e38]', '[3e38]'); +SELECT cosine_distance(CAST('[3e38]' as vector), CAST('[3e38]' as vector)); go ~~START~~ float @@ -265,7 +265,7 @@ NaN ~~END~~ -SELECT l1_distance('[0,0]', '[3,4]'); +SELECT l1_distance(CAST('[0,0]' as vector), CAST('[3,4]' as vector)); go ~~START~~ float @@ -273,7 +273,7 @@ float ~~END~~ -SELECT l1_distance('[0,0]', '[0,1]'); +SELECT l1_distance(CAST('[0,0]' as vector), CAST('[0,1]' as vector)); go ~~START~~ float @@ -281,14 +281,14 @@ float ~~END~~ -SELECT l1_distance('[1,2]', '[3]'); +SELECT l1_distance(CAST('[1,2]' as vector), CAST('[3]' as vector)); go ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: different vector dimensions 2 and 1)~~ -SELECT l1_distance('[3e38]', '[-3e38]'); +SELECT l1_distance(CAST('[3e38]' as vector), CAST('[-3e38]' as vector)); go ~~START~~ float @@ -1160,49 +1160,49 @@ SELECT CAST('[4e38,1]' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: infinite value not allowed in vector)~~ +~~ERROR (Message: "4e38" is out of range for type vector)~~ SELECT CAST('[1,2,3' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "[1,2,3")~~ +~~ERROR (Message: invalid input syntax for type vector: "[1,2,3")~~ SELECT CAST('[1,2,3]9' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "[1,2,3]9")~~ +~~ERROR (Message: invalid input syntax for type vector: "[1,2,3]9")~~ SELECT CAST('1,2,3' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "1,2,3")~~ +~~ERROR (Message: invalid input syntax for type vector: "1,2,3")~~ SELECT CAST('' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "")~~ +~~ERROR (Message: invalid input syntax for type vector: "")~~ SELECT CAST('[' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "[")~~ +~~ERROR (Message: invalid input syntax for type vector: "[")~~ SELECT CAST('[,' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "[,")~~ +~~ERROR (Message: invalid input syntax for type vector: "[,")~~ SELECT CAST('[]' as vector); @@ -1230,7 +1230,7 @@ SELECT CAST('[1,,3]' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "[1,,3]")~~ +~~ERROR (Message: invalid input syntax for type vector: "[1,,3]")~~ SELECT CAST('[1, ,3]' as vector); diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/babel_collation.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/babel_collation.out index 6c17114b17e..767d4e3b165 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/babel_collation.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/babel_collation.out @@ -322,11 +322,11 @@ int#!#int DECLARE @haystack VARCHAR(100); SELECT @haystack = 'This is a haystack'; -SELECT CHARINDEX('', @haystack); -- empty string - expect 1 +SELECT CHARINDEX('', @haystack); -- empty string - expect 0 go ~~START~~ int -1 +0 ~~END~~ @@ -395,32 +395,32 @@ bike ~~END~~ ~~START~~ -text +varchar B A R bar B A RBar ~~END~~ ~~START~~ -text +varchar empty pattern ~~END~~ ~~START~~ -text +varchar ~~END~~ ~~START~~ -text +varchar ~~END~~ ~~START~~ -text +varchar bar bar FooBar ~~END~~ ~~START~~ -text +varchar nothing to do ~~END~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/babel_function.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/babel_function.out index f213a05f3cc..31870b6adec 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/babel_function.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/babel_function.out @@ -1795,7 +1795,7 @@ aijklmn select STUFF(N'abcdef', 2, 3, NULL); GO ~~START~~ -text +nvarchar aef ~~END~~ @@ -1803,21 +1803,21 @@ aef select STUFF('abcdef', 2, 3, 'ijklmn'); GO ~~START~~ -text +varchar aijklmnef ~~END~~ select STUFF('abcdef', 2, 3, N'ijklmn'); GO ~~START~~ -text +nvarchar aijklmnef ~~END~~ select STUFF(N'abcdef', 2, 3, 'ijklmn'); GO ~~START~~ -text +nvarchar aijklmnef ~~END~~ @@ -1825,21 +1825,21 @@ aijklmnef SELECT STUFF(CAST('abcdef' as text), 2, 3, CAST('ijklmn' as text)); GO ~~START~~ -text +varchar aijklmnef ~~END~~ SELECT STUFF(CAST('abcdef' as text), 2, 3, 'ijklmn'); GO ~~START~~ -text +varchar aijklmnef ~~END~~ SELECT STUFF('abcdef', 2, 3, CAST('ijklmn' as text)); GO ~~START~~ -text +varchar aijklmnef ~~END~~ @@ -1854,14 +1854,14 @@ aijklmnef SELECT STUFF('abcdef', 2, 3, CAST('ijklmn' as sys.varchar)); GO ~~START~~ -text +varchar aijklmnef ~~END~~ SELECT STUFF(CAST('abcdef' as sys.varchar), 2, 3, 'ijklmn'); GO ~~START~~ -text +varchar aijklmnef ~~END~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/left-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/left-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..028fff54cfb --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/left-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,745 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(25) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT LEFT(NULL, -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the left function.)~~ + + +SELECT LEFT(NULL, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT LEFT(NULL, 2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT LEFT('abc', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT LEFT(NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- edge case values for second parameter +SELECT LEFT('AbdefGhi', -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the left function.)~~ + + +SELECT '|' + LEFT('AbdefGhi', 0) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT LEFT('AbdefGhi', 2) +GO +~~START~~ +varchar +Ab +~~END~~ + + +SELECT LEFT('AbdefGhi', 2147483646) +GO +~~START~~ +varchar +AbdefGhi +~~END~~ + + +SELECT LEFT('AbdefGhi', 2147483650) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- misc tests +DECLARE @procedure_name NVARCHAR(134) = ';1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO +~~START~~ +nvarchar + +~~END~~ + + +DECLARE @procedure_name NVARCHAR(134) = 'procedureName;1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO +~~START~~ +nvarchar +procedureName +~~END~~ + + +-- procedure name with length equal to 134 +DECLARE @procedure_name NVARCHAR(134) = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO +~~START~~ +nvarchar +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 5) + '|' +GO +~~START~~ +varchar +|abc?d| +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) + '|' +GO +~~START~~ +varchar +|比尔·拉| +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比尔·拉| +~~END~~ + + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 50) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 5) +GO +~~START~~ +varchar +abc?d +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT LEFT(@inputString, 4) +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT LEFT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 50) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_4489_left_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_4489_left_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_4489_left_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_ci_as +GO +~~START~~ +varchar +الله +~~END~~ + + +SELECT LEFT(a, 4) COLLATE ARABIC_CI_AS FROM babel_4489_left_arabic_ci_as +GO +~~START~~ +varchar +الله +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_cs_as +GO +~~START~~ +varchar +الله +~~END~~ + + +SELECT LEFT(a, 4) COLLATE ARABIC_CS_AS FROM babel_4489_left_arabic_cs_as +GO +~~START~~ +varchar +الله +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_ci_ai +GO +~~START~~ +varchar +الله +~~END~~ + + +SELECT LEFT(a, 4) COLLATE ARABIC_CI_AI FROM babel_4489_left_arabic_ci_ai +GO +~~START~~ +varchar +الله +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 5) + '|' +GO +~~START~~ +nvarchar +|abc?d| +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) + '|' +GO +~~START~~ +nvarchar +|比尔·拉| +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 50) + '|' +GO +~~START~~ +nvarchar +|abc?defghi?? | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + LEFT(a, 5) + '|' FROM babel_4489_left_t1 +GO +~~START~~ +nvarchar +|abc🙂d| +|比尔·拉莫| +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 5) +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT LEFT(@inputString, 4) +GO +~~START~~ +nvarchar +比尔·拉 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 50) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT LEFT(@inputString, 4) +GO +~~START~~ +varchar +abcd +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT LEFT(@inputString, 4) +GO +~~START~~ +varchar +abcd +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_left_dep_view +GO +~~START~~ +text +abc?d +~~END~~ + + +EXEC babel_4489_left_dep_proc +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_func() +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +SELECT * FROM babel_4489_left_itvf_func() +GO +~~START~~ +text +abc?d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_1 +GO +~~START~~ +text +abc?d +比尔·拉莫 +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_2 +GO +~~START~~ +text +abc?d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_3 +GO +~~START~~ +text + abc +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_4 +GO +~~START~~ +text + abc +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_5 +GO +~~START~~ +text +0x202 +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_6 +GO +~~START~~ +text +abc?d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_7 +GO +~~START~~ +text +abc?d +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_left_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT LEFT(a, 3) FROM babel_4489_left_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of left function.)~~ + + +SELECT LEFT(b, 3) FROM babel_4489_left_UDT +GO +~~START~~ +varchar +abc +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +201 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +201 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +195 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +12: +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +196 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +196 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +6F9 +~~END~~ + + +SELECT LEFT(a, 5) from babel_4489_left_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of left function.)~~ + + +-- input datatype text +SELECT LEFT(a, 5) FROM babel_4489_left_text +GO +~~START~~ +varchar +abc?d +~~END~~ + + +-- input datatype ntext +SELECT LEFT(b, 5) FROM babel_4489_left_text +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LEFT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar +6F9 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LEFT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT LEFT(NULL, 2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT LEFT('abc', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT LEFT(NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- edge case values for second parameter +SELECT LEFT('AbdefGhi', -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the left function.)~~ + + +SELECT '|' + LEFT('AbdefGhi', 0) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT LEFT('AbdefGhi', 2) +GO +~~START~~ +varchar +Ab +~~END~~ + + +SELECT LEFT('AbdefGhi', 2147483646) +GO +~~START~~ +varchar +AbdefGhi +~~END~~ + + +SELECT LEFT('AbdefGhi', 2147483650) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- misc tests +DECLARE @procedure_name NVARCHAR(134) = ';1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO +~~START~~ +nvarchar + +~~END~~ + + +DECLARE @procedure_name NVARCHAR(134) = 'procedureName;1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO +~~START~~ +nvarchar +procedureName +~~END~~ + + +-- procedure name with length equal to 134 +DECLARE @procedure_name NVARCHAR(134) = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO +~~START~~ +nvarchar +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 5) + '|' +GO +~~START~~ +varchar +|abc?d| +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) + '|' +GO +~~START~~ +varchar +|比尔·拉| +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比尔·拉| +~~END~~ + + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 50) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 5) +GO +~~START~~ +varchar +abc?d +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT LEFT(@inputString, 4) +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT LEFT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 50) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_4489_left_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_4489_left_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_4489_left_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_ci_as +GO +~~START~~ +varchar +الله +~~END~~ + + +SELECT LEFT(a, 4) COLLATE ARABIC_CI_AS FROM babel_4489_left_arabic_ci_as +GO +~~START~~ +varchar +الله +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_cs_as +GO +~~START~~ +varchar +الله +~~END~~ + + +SELECT LEFT(a, 4) COLLATE ARABIC_CS_AS FROM babel_4489_left_arabic_cs_as +GO +~~START~~ +varchar +الله +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_ci_ai +GO +~~START~~ +varchar +الله +~~END~~ + + +SELECT LEFT(a, 4) COLLATE ARABIC_CI_AI FROM babel_4489_left_arabic_ci_ai +GO +~~START~~ +varchar +الله +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 5) + '|' +GO +~~START~~ +nvarchar +|abc?d| +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) + '|' +GO +~~START~~ +nvarchar +|比尔·拉| +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 50) + '|' +GO +~~START~~ +nvarchar +|abc?defghi?? | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + LEFT(a, 5) + '|' FROM babel_4489_left_t1 +GO +~~START~~ +nvarchar +|abc🙂d| +|比尔·拉莫| +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 5) +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT LEFT(@inputString, 4) +GO +~~START~~ +nvarchar +比尔·拉 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 50) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT LEFT(@inputString, 4) +GO +~~START~~ +varchar +abcd +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT LEFT(@inputString, 4) +GO +~~START~~ +varchar +abcd +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_left_dep_view +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +EXEC babel_4489_left_dep_proc +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_func() +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +SELECT * FROM babel_4489_left_itvf_func() +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_1 +GO +~~START~~ +nvarchar +abc🙂d +比尔·拉莫 +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_2 +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_3 +GO +~~START~~ +varchar + abc +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_4 +GO +~~START~~ +varchar + abc +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_5 +GO +~~START~~ +varchar + abc +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_6 +GO +~~START~~ +varchar +abc?d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_7 +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_left_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT LEFT(a, 3) FROM babel_4489_left_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of left function.)~~ + + +SELECT LEFT(b, 3) FROM babel_4489_left_UDT +GO +~~START~~ +varchar +abc +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +201 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +201 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +195 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +12: +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +196 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +196 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +6F9 +~~END~~ + + +SELECT LEFT(a, 5) from babel_4489_left_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of left function.)~~ + + +-- input datatype text +SELECT LEFT(a, 5) FROM babel_4489_left_text +GO +~~START~~ +varchar +abc?d +~~END~~ + + +-- input datatype ntext +SELECT LEFT(b, 5) FROM babel_4489_left_text +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LEFT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar +6F9 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LEFT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_ci_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_ltrim_chinese_prc_ci_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_cs_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_ltrim_chinese_prc_cs_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_ltrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_ltrim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_ltrim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_ltrim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_t1 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +|比尔·拉莫斯 | +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯 | +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x202061626364656667682020 +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abcdefgh| +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x202061626364656667682020 +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abcdefgh| +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_ltrim_dep_view +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +EXEC babel_4489_ltrim_dep_proc +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_func() +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_itvf_func() +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_1 +GO +~~START~~ +varchar +|abc?defghi?? | +|比尔·拉莫斯 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_2 +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_3 +GO +~~START~~ +varchar +|abcdefghi | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_4 +GO +~~START~~ +varchar +|abcdefghi | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_5 +GO +~~START~~ +varchar +|0x2020616263642020| +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_6 +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_7 +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_ltrim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT LTRIM(a) FROM babel_4489_ltrim_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of ltrim function.)~~ + + +SELECT LTRIM(b) FROM babel_4489_ltrim_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12:10:05.1237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +123456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +SELECT LTRIM(a) from babel_4489_ltrim_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of ltrim function.)~~ + + +-- input datatype text +SELECT LTRIM(a) FROM babel_4489_ltrim_text +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT LTRIM(b) FROM babel_4489_ltrim_text +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +POINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/ltrim-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/ltrim-vu-verify.out new file mode 100644 index 00000000000..88ad03f724c --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/ltrim-vu-verify.out @@ -0,0 +1,610 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(50) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT LTRIM(NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_ci_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_ltrim_chinese_prc_ci_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_cs_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_ltrim_chinese_prc_cs_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_ltrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_ltrim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_ltrim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_ltrim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_t1 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +|比尔·拉莫斯 | +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯 | +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x202061626364656667682020 +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abcdefgh| +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x202061626364656667682020 +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abcdefgh| +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_ltrim_dep_view +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +EXEC babel_4489_ltrim_dep_proc +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_func() +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_itvf_func() +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_1 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +|比尔·拉莫斯 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_2 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_3 +GO +~~START~~ +varchar +|abcdefghi | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_4 +GO +~~START~~ +varchar +|abcdefghi | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_5 +GO +~~START~~ +varchar +|abcd | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_6 +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_7 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_ltrim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT LTRIM(a) FROM babel_4489_ltrim_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of ltrim function.)~~ + + +SELECT LTRIM(b) FROM babel_4489_ltrim_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12:10:05.1237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +123456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +SELECT LTRIM(a) from babel_4489_ltrim_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of ltrim function.)~~ + + +-- input datatype text +SELECT LTRIM(a) FROM babel_4489_ltrim_text +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT LTRIM(b) FROM babel_4489_ltrim_text +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +POINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/psql_logical_babelfish_db.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/psql_logical_babelfish_db.out index 5c2c80407b5..5537cb8b498 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/psql_logical_babelfish_db.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/psql_logical_babelfish_db.out @@ -1,6 +1,6 @@ -- psql -- check whether we can query system views before setting the GUC. Should return zero rows -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases'; +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go ~~START~~ "sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#int4#!#"sys"."varchar"#!#varchar#!#"sys"."varchar"#!#int4#!#int4#!#int2#!#int2#!#int4#!#int2#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar" @@ -30,21 +30,21 @@ master -- query system views. Should return metadata of master database -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases'; +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go ~~START~~ "sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#int4#!#"sys"."varchar"#!#varchar#!#"sys"."varchar"#!#int4#!#int4#!#int2#!#int2#!#int4#!#int2#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar" -master#!#dbo#!#sysdatabases#!#name#!#1#!##!#YES#!#text#!#2147483647#!#2147483647#!##!##!##!##!##!##!##!##!##!#C#!##!##!# +master#!#dbo#!#sysdatabases#!#category#!#9#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#cmptlevel#!#10#!##!#YES#!#tinyint#!##!##!#3#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#crdate#!#7#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# master#!#dbo#!#sysdatabases#!#dbid#!#2#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#sid#!#3#!##!#YES#!#varbinary#!#85#!#85#!##!##!##!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#filename#!#11#!##!#YES#!#nvarchar#!#260#!#520#!##!##!##!##!##!##!##!##!##!#chinese_prc_ci_as#!##!##!# master#!#dbo#!#sysdatabases#!#mode#!#4#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#name#!#1#!##!#YES#!#text#!#2147483647#!#2147483647#!##!##!##!##!##!##!##!##!##!#C#!##!##!# +master#!#dbo#!#sysdatabases#!#reserved#!#8#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#sid#!#3#!##!#YES#!#varbinary#!#85#!#85#!##!##!##!##!##!##!##!##!##!##!##!##!# master#!#dbo#!#sysdatabases#!#status#!#5#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# master#!#dbo#!#sysdatabases#!#status2#!#6#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#crdate#!#7#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#reserved#!#8#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#category#!#9#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#cmptlevel#!#10#!##!#YES#!#tinyint#!##!##!#3#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#filename#!#11#!##!#YES#!#nvarchar#!#260#!#520#!##!##!##!##!##!##!##!##!##!#chinese_prc_ci_as#!##!##!# master#!#dbo#!#sysdatabases#!#version#!#12#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# ~~END~~ @@ -54,7 +54,7 @@ set psql_logical_babelfish_db_name = 'invalid_db' go -- should return zero rows as the database set does not exist -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases'; +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go ~~START~~ "sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#int4#!#"sys"."varchar"#!#varchar#!#"sys"."varchar"#!#int4#!#int4#!#int2#!#int2#!#int4#!#int2#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar" @@ -63,21 +63,21 @@ go -- tsql -- should return data of master as the current database is master -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go ~~START~~ nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#int#!#nvarchar#!#varchar#!#nvarchar#!#int#!#int#!#tinyint#!#smallint#!#int#!#smallint#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar -master#!#dbo#!#sysdatabases#!#name#!#1#!##!#YES#!#text#!#2147483647#!#2147483647#!##!##!##!##!##!##!##!##!##!#C#!##!##!# +master#!#dbo#!#sysdatabases#!#category#!#9#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#cmptlevel#!#10#!##!#YES#!#tinyint#!##!##!#3#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#crdate#!#7#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# master#!#dbo#!#sysdatabases#!#dbid#!#2#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#sid#!#3#!##!#YES#!#varbinary#!#85#!#85#!##!##!##!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#filename#!#11#!##!#YES#!#nvarchar#!#260#!#520#!##!##!##!##!##!##!##!##!##!#chinese_prc_ci_as#!##!##!# master#!#dbo#!#sysdatabases#!#mode#!#4#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#name#!#1#!##!#YES#!#text#!#2147483647#!#2147483647#!##!##!##!##!##!##!##!##!##!#C#!##!##!# +master#!#dbo#!#sysdatabases#!#reserved#!#8#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#sid#!#3#!##!#YES#!#varbinary#!#85#!#85#!##!##!##!##!##!##!##!##!##!##!##!##!# master#!#dbo#!#sysdatabases#!#status#!#5#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# master#!#dbo#!#sysdatabases#!#status2#!#6#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#crdate#!#7#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#reserved#!#8#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#category#!#9#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#cmptlevel#!#10#!##!#YES#!#tinyint#!##!##!#3#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#filename#!#11#!##!#YES#!#nvarchar#!#260#!#520#!##!##!##!##!##!##!##!##!##!#chinese_prc_ci_as#!##!##!# master#!#dbo#!#sysdatabases#!#version#!#12#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# ~~END~~ @@ -96,21 +96,21 @@ logical_database_db1 -- should return data of master as the current database is master -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go ~~START~~ nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#int#!#nvarchar#!#varchar#!#nvarchar#!#int#!#int#!#tinyint#!#smallint#!#int#!#smallint#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar -master#!#dbo#!#sysdatabases#!#name#!#1#!##!#YES#!#text#!#2147483647#!#2147483647#!##!##!##!##!##!##!##!##!##!#C#!##!##!# +master#!#dbo#!#sysdatabases#!#category#!#9#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#cmptlevel#!#10#!##!#YES#!#tinyint#!##!##!#3#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#crdate#!#7#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# master#!#dbo#!#sysdatabases#!#dbid#!#2#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#sid#!#3#!##!#YES#!#varbinary#!#85#!#85#!##!##!##!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#filename#!#11#!##!#YES#!#nvarchar#!#260#!#520#!##!##!##!##!##!##!##!##!##!#chinese_prc_ci_as#!##!##!# master#!#dbo#!#sysdatabases#!#mode#!#4#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#name#!#1#!##!#YES#!#text#!#2147483647#!#2147483647#!##!##!##!##!##!##!##!##!##!#C#!##!##!# +master#!#dbo#!#sysdatabases#!#reserved#!#8#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#sid#!#3#!##!#YES#!#varbinary#!#85#!#85#!##!##!##!##!##!##!##!##!##!##!##!##!# master#!#dbo#!#sysdatabases#!#status#!#5#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# master#!#dbo#!#sysdatabases#!#status2#!#6#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#crdate#!#7#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#reserved#!#8#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#category#!#9#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#cmptlevel#!#10#!##!#YES#!#tinyint#!##!##!#3#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#filename#!#11#!##!#YES#!#nvarchar#!#260#!#520#!##!##!##!##!##!##!##!##!##!#chinese_prc_ci_as#!##!##!# master#!#dbo#!#sysdatabases#!#version#!#12#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# ~~END~~ @@ -119,21 +119,21 @@ use logical_database_db1 go -- should return data of logical_database_db1 as the current database is logical_database_db1 -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go ~~START~~ nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#int#!#nvarchar#!#varchar#!#nvarchar#!#int#!#int#!#tinyint#!#smallint#!#int#!#smallint#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar -logical_database_db1#!#dbo#!#sysdatabases#!#name#!#1#!##!#YES#!#text#!#2147483647#!#2147483647#!##!##!##!##!##!##!##!##!##!#C#!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#category#!#9#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#cmptlevel#!#10#!##!#YES#!#tinyint#!##!##!#3#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#crdate#!#7#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# logical_database_db1#!#dbo#!#sysdatabases#!#dbid#!#2#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#sid#!#3#!##!#YES#!#varbinary#!#85#!#85#!##!##!##!##!##!##!##!##!##!##!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#filename#!#11#!##!#YES#!#nvarchar#!#260#!#520#!##!##!##!##!##!##!##!##!##!#chinese_prc_ci_as#!##!##!# logical_database_db1#!#dbo#!#sysdatabases#!#mode#!#4#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#name#!#1#!##!#YES#!#text#!#2147483647#!#2147483647#!##!##!##!##!##!##!##!##!##!#C#!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#reserved#!#8#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#sid#!#3#!##!#YES#!#varbinary#!#85#!#85#!##!##!##!##!##!##!##!##!##!##!##!##!# logical_database_db1#!#dbo#!#sysdatabases#!#status#!#5#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# logical_database_db1#!#dbo#!#sysdatabases#!#status2#!#6#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#crdate#!#7#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#reserved#!#8#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#category#!#9#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#cmptlevel#!#10#!##!#YES#!#tinyint#!##!##!#3#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#filename#!#11#!##!#YES#!#nvarchar#!#260#!#520#!##!##!##!##!##!##!##!##!##!#chinese_prc_ci_as#!##!##!# logical_database_db1#!#dbo#!#sysdatabases#!#version#!#12#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# ~~END~~ @@ -145,7 +145,7 @@ alter server role sysadmin add member logical_database_l1 go -- psql user=logical_database_l1 password=12345678 -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases'; +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go ~~START~~ "sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#int4#!#"sys"."varchar"#!#varchar#!#"sys"."varchar"#!#int4#!#int4#!#int2#!#int2#!#int4#!#int2#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar" @@ -156,21 +156,21 @@ go set psql_logical_babelfish_db_name = 'logical_database_db1' go -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases'; +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go ~~START~~ "sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#int4#!#"sys"."varchar"#!#varchar#!#"sys"."varchar"#!#int4#!#int4#!#int2#!#int2#!#int4#!#int2#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar" -logical_database_db1#!#dbo#!#sysdatabases#!#name#!#1#!##!#YES#!#text#!#2147483647#!#2147483647#!##!##!##!##!##!##!##!##!##!#C#!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#category#!#9#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#cmptlevel#!#10#!##!#YES#!#tinyint#!##!##!#3#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#crdate#!#7#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# logical_database_db1#!#dbo#!#sysdatabases#!#dbid#!#2#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#sid#!#3#!##!#YES#!#varbinary#!#85#!#85#!##!##!##!##!##!##!##!##!##!##!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#filename#!#11#!##!#YES#!#nvarchar#!#260#!#520#!##!##!##!##!##!##!##!##!##!#chinese_prc_ci_as#!##!##!# logical_database_db1#!#dbo#!#sysdatabases#!#mode#!#4#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#name#!#1#!##!#YES#!#text#!#2147483647#!#2147483647#!##!##!##!##!##!##!##!##!##!#C#!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#reserved#!#8#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#sid#!#3#!##!#YES#!#varbinary#!#85#!#85#!##!##!##!##!##!##!##!##!##!##!##!##!# logical_database_db1#!#dbo#!#sysdatabases#!#status#!#5#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# logical_database_db1#!#dbo#!#sysdatabases#!#status2#!#6#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#crdate#!#7#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#reserved#!#8#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#category#!#9#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#cmptlevel#!#10#!##!#YES#!#tinyint#!##!##!#3#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#filename#!#11#!##!#YES#!#nvarchar#!#260#!#520#!##!##!##!##!##!##!##!##!##!#chinese_prc_ci_as#!##!##!# logical_database_db1#!#dbo#!#sysdatabases#!#version#!#12#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# ~~END~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replace-before-14_3-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replace-before-14_3-vu-verify.out new file mode 100644 index 00000000000..7a3460efe32 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replace-before-14_3-vu-verify.out @@ -0,0 +1,2855 @@ +declare @string1 nvarchar(30) = N'比尔·拉',@string2 nvarchar(30) = N'斯', @pat nvarchar(10) = N'尔' +select REPLACE(@string1, @pat, @string2) +GO +~~START~~ +nvarchar +比斯·拉 +~~END~~ + + +-- NULL +SELECT replace(NULL, 'acs', 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace('scd', NULL, 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace('scd', 'scd', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace(NULL, NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace(NULL, 'aces', 'scdwe') +GO +~~START~~ +varchar + +~~END~~ + + +-- different no. of arguments +SELECT replace('aceds', 'aces', 'scdwe', 'acsdes') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.replace function requires 3 arguments)~~ + + +SELECT replace('aces', 'scdwe') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.replace function requires 3 arguments)~~ + + +-- input type char +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉莫斯 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_ci_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CI_AS FROM babel_4836_replace_chinese_prc_ci_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_cs_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CS_AS FROM babel_4836_replace_chinese_prc_cs_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_ci_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +SELECT replace(a, b, c) COLLATE ARABIC_CI_AS FROM babel_4836_replace_arabic_ci_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_cs_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +SELECT replace(a, b, c) COLLATE ARABIC_CS_AS FROM babel_4836_replace_arabic_cs_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +-- with table column of type nchar +SELECT replace(a, b, c) FROM babel_4836_replace_t1 +GO +~~START~~ +nvarchar + abc🙂defghi🙂🙂 + 比尔·拉莫斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +DECLARE @inputString BINARY(10) = 0x61626364656667, @pattern BINARY(10) = 0x6364, @replacement BINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +-- with table column of type binary +SELECT replace(a, b, c) FROM babel_4836_replace_t4 +GO +~~START~~ +varchar +atuvde +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +DECLARE @inputString VARBINARY(10) = 0x61626364656667, @pattern VARBINARY(10) = 0x6364, @replacement VARBINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +-- with table column of type varbinary +SELECT replace(a, b, c) FROM babel_4836_replace_t5 +GO +~~START~~ +varchar +atuvde +~~END~~ + + + +-- input type text +SELECT replace(a, b, c) FROM babel_4836_replace_text +GO +~~START~~ +varchar + abcjhi?ghi?? +~~END~~ + + +DECLARE @pattern VARCHAR(20) = '?de', @replacement VARCHAR(10) = 'x?y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_text +GO +~~START~~ +varchar + abc?defghi?? +~~END~~ + + +-- input type ntext +SELECT replace(a, b, c) FROM babel_4836_replace_ntext +GO +~~START~~ +varchar + abcjhi?ghi?? +~~END~~ + + +DECLARE @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(10) = N'x🙂y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_ntext +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4836_replace_dep_view +GO +~~START~~ +text +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: nondeterministic collations are not supported for substring searches)~~ + + +SELECT * FROM babel_4836_replace_dep_view1 +GO +~~START~~ +text +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: nondeterministic collations are not supported for substring searches)~~ + + +EXEC babel_4836_replace_dep_proc +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_dep_func() +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_itvf_func() +GO +~~START~~ +text + abcx?yfghi?? +~~END~~ + + +-- different datatypes of inputString and pattern/replacement +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?ywfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement)+ '|' +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'ABCDEF', @pattern BINARY(4) = 0x414243, @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +尔·比 DEF +~~END~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @pattern NCHAR(20) = N'尔·比', @replacement VARBINARY(2) = 0x4144 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +ABCD +~~END~~ + + +-- input type UDT +-- in table babel_4836_replace_image_UDT_t, col 'a', 'b' and 'c' has basetype image +SELECT replace(a, b, c) FROM babel_4836_replace_image_UDT_t +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +-- in table babel_4836_replace_var_UDT_t, col 'a', 'b' and 'c' has basetype varchar +SELECT replace(b, b, c) FROM babel_4836_replace_var_UDT_t +GO +~~START~~ +varchar +gh +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, '12', '06'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString date = '2016-12-21', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern date = '2016-12-21', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @replacement date = '2016-12-21'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @date date = '2016-12-21', @replacement VARCHAR(10) = '06'; +DECLARE @pattern datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @date date = '2016-12-21'; +DECLARE @replacement datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern smalldatetime = '2016-12-21 12:43:10', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern VARCHAR(30) = '2016-12-21 12:43:10', @replacement smalldatetime = '2016-12-21 12:43:10'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern time(4) = '12:10:05.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern VARCHAR(30) = '12:10:05.1237', @replacement time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @replacement datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern datetime2(4) = '1968-10-23 12:45:37.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1237', @replacement datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString decimal = 123456, @pattern decimal = 12, @replacement decimal = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern decimal = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement decimal = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString numeric = 12345.12, @pattern numeric = 12, @replacement numeric = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern numeric = 12.12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement numeric = 12.12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString float = 12345.1, @pattern float = 12, @replacement float = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern float = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement float = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString real = 12345.1, @pattern real = 12, @replacement real = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern real = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement real = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString bigint = 12345678, @pattern bigint = 12, @replacement bigint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bigint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bigint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString int = 12345678, @pattern int = 12, @replacement int = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern int = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement int = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smallint = 12356, @pattern smallint = 12, @replacement smallint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString tinyint = 235, @pattern tinyint = 12, @replacement tinyint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern tinyint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement tinyint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString money = 12356, @pattern money = 12, @replacement money = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern money = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement money = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smallmoney = 12356, @pattern smallmoney = 12, @replacement smallmoney = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallmoney = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallmoney = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString bit = 1, @pattern bit = 1, @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bit = 1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of replace function.)~~ + + +SELECT replace(a, a, a) FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +SELECT replace('a', a, 'a') FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of replace function.)~~ + + +SELECT replace('a', 'a', a) FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of replace function.)~~ + + +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(a, @pattern, @replacement) from babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern xml = CAST ('' AS xml), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geometry = geometry::STGeomFromText('POINT (1 2)', 0), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geography = geography::STGeomFromText('POINT (1 2)', 4326), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geography = geography::STGeomFromText('POINT (1 2)', 4326); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO +~~START~~ +varchar +5A9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(CAST (@inputString AS VARCHAR(50)), CAST (@pattern AS VARCHAR(50)), CAST (@replacement AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO +~~START~~ +varchar +POINT(4 5) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replace-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replace-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..a2a5a75a816 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replace-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,2853 @@ +declare @string1 nvarchar(30) = N'比尔·拉',@string2 nvarchar(30) = N'斯', @pat nvarchar(10) = N'尔' +select REPLACE(@string1, @pat, @string2) +GO +~~START~~ +nvarchar +比斯·拉 +~~END~~ + + +-- NULL +SELECT replace(NULL, 'acs', 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace('scd', NULL, 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace('scd', 'scd', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace(NULL, NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace(NULL, 'aces', 'scdwe') +GO +~~START~~ +varchar + +~~END~~ + + +-- different no. of arguments +SELECT replace('aceds', 'aces', 'scdwe', 'acsdes') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.replace function requires 3 arguments)~~ + + +SELECT replace('aces', 'scdwe') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.replace function requires 3 arguments)~~ + + +-- input type char +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉莫斯 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_ci_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CI_AS FROM babel_4836_replace_chinese_prc_ci_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_cs_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CS_AS FROM babel_4836_replace_chinese_prc_cs_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_ci_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +SELECT replace(a, b, c) COLLATE ARABIC_CI_AS FROM babel_4836_replace_arabic_ci_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_cs_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +SELECT replace(a, b, c) COLLATE ARABIC_CS_AS FROM babel_4836_replace_arabic_cs_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +-- with table column of type nchar +SELECT replace(a, b, c) FROM babel_4836_replace_t1 +GO +~~START~~ +nvarchar + abc🙂defghi🙂🙂 + 比尔·拉莫斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +DECLARE @inputString BINARY(10) = 0x61626364656667, @pattern BINARY(10) = 0x6364, @replacement BINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +-- with table column of type binary +SELECT replace(a, b, c) FROM babel_4836_replace_t4 +GO +~~START~~ +varchar +atuvde +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +DECLARE @inputString VARBINARY(10) = 0x61626364656667, @pattern VARBINARY(10) = 0x6364, @replacement VARBINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +-- with table column of type varbinary +SELECT replace(a, b, c) FROM babel_4836_replace_t5 +GO +~~START~~ +varchar +atuvde +~~END~~ + + + +-- input type text +SELECT replace(a, b, c) FROM babel_4836_replace_text +GO +~~START~~ +varchar + abcjhi?ghi?? +~~END~~ + + +DECLARE @pattern VARCHAR(20) = '?de', @replacement VARCHAR(10) = 'x?y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_text +GO +~~START~~ +varchar + abc?defghi?? +~~END~~ + + +-- input type ntext +SELECT replace(a, b, c) FROM babel_4836_replace_ntext +GO +~~START~~ +varchar + abcjhi?ghi?? +~~END~~ + + +DECLARE @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(10) = N'x🙂y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_ntext +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4836_replace_dep_view +GO +~~START~~ +text + abcx?yfghi?? +~~END~~ + + +SELECT * FROM babel_4836_replace_dep_view1 +GO +~~START~~ +text + abcx?yfghi?? +~~END~~ + + +EXEC babel_4836_replace_dep_proc +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_dep_func() +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_itvf_func() +GO +~~START~~ +text + abcx?yfghi?? +~~END~~ + + +-- different datatypes of inputString and pattern/replacement +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?ywfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement)+ '|' +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'ABCDEF', @pattern BINARY(4) = 0x414243, @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +尔·比 DEF +~~END~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @pattern NCHAR(20) = N'尔·比', @replacement VARBINARY(2) = 0x4144 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +ABCD +~~END~~ + + +-- input type UDT +-- in table babel_4836_replace_image_UDT_t, col 'a', 'b' and 'c' has basetype image +SELECT replace(a, b, c) FROM babel_4836_replace_image_UDT_t +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +-- in table babel_4836_replace_var_UDT_t, col 'a', 'b' and 'c' has basetype varchar +SELECT replace(b, b, c) FROM babel_4836_replace_var_UDT_t +GO +~~START~~ +varchar +gh +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, '12', '06'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString date = '2016-12-21', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern date = '2016-12-21', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @replacement date = '2016-12-21'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @date date = '2016-12-21', @replacement VARCHAR(10) = '06'; +DECLARE @pattern datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @date date = '2016-12-21'; +DECLARE @replacement datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern smalldatetime = '2016-12-21 12:43:10', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern VARCHAR(30) = '2016-12-21 12:43:10', @replacement smalldatetime = '2016-12-21 12:43:10'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern time(4) = '12:10:05.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern VARCHAR(30) = '12:10:05.1237', @replacement time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @replacement datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern datetime2(4) = '1968-10-23 12:45:37.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1237', @replacement datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString decimal = 123456, @pattern decimal = 12, @replacement decimal = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern decimal = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement decimal = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString numeric = 12345.12, @pattern numeric = 12, @replacement numeric = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern numeric = 12.12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement numeric = 12.12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString float = 12345.1, @pattern float = 12, @replacement float = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern float = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement float = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString real = 12345.1, @pattern real = 12, @replacement real = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern real = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement real = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString bigint = 12345678, @pattern bigint = 12, @replacement bigint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bigint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bigint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString int = 12345678, @pattern int = 12, @replacement int = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern int = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement int = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smallint = 12356, @pattern smallint = 12, @replacement smallint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString tinyint = 235, @pattern tinyint = 12, @replacement tinyint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern tinyint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement tinyint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString money = 12356, @pattern money = 12, @replacement money = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern money = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement money = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smallmoney = 12356, @pattern smallmoney = 12, @replacement smallmoney = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallmoney = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallmoney = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString bit = 1, @pattern bit = 1, @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bit = 1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of replace function.)~~ + + +SELECT replace(a, a, a) FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +SELECT replace('a', a, 'a') FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of replace function.)~~ + + +SELECT replace('a', 'a', a) FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of replace function.)~~ + + +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(a, @pattern, @replacement) from babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern xml = CAST ('' AS xml), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geometry = geometry::STGeomFromText('POINT (1 2)', 0), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geography = geography::STGeomFromText('POINT (1 2)', 4326), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geography = geography::STGeomFromText('POINT (1 2)', 4326); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO +~~START~~ +varchar +5A9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(CAST (@inputString AS VARCHAR(50)), CAST (@pattern AS VARCHAR(50)), CAST (@replacement AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO +~~START~~ +varchar +POINT(4 5) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replace-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replace-vu-verify.out new file mode 100644 index 00000000000..7a0da102e94 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replace-vu-verify.out @@ -0,0 +1,2853 @@ +declare @string1 nvarchar(30) = N'比尔·拉',@string2 nvarchar(30) = N'斯', @pat nvarchar(10) = N'尔' +select REPLACE(@string1, @pat, @string2) +GO +~~START~~ +nvarchar +比斯·拉 +~~END~~ + + +-- NULL +SELECT replace(NULL, 'acs', 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace('scd', NULL, 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace('scd', 'scd', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace(NULL, NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace(NULL, 'aces', 'scdwe') +GO +~~START~~ +varchar + +~~END~~ + + +-- different no. of arguments +SELECT replace('aceds', 'aces', 'scdwe', 'acsdes') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.replace function requires 3 arguments)~~ + + +SELECT replace('aces', 'scdwe') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.replace function requires 3 arguments)~~ + + +-- input type char +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉莫斯 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_ci_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CI_AS FROM babel_4836_replace_chinese_prc_ci_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_cs_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CS_AS FROM babel_4836_replace_chinese_prc_cs_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_ci_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +SELECT replace(a, b, c) COLLATE ARABIC_CI_AS FROM babel_4836_replace_arabic_ci_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_cs_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +SELECT replace(a, b, c) COLLATE ARABIC_CS_AS FROM babel_4836_replace_arabic_cs_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +-- with table column of type nchar +SELECT replace(a, b, c) FROM babel_4836_replace_t1 +GO +~~START~~ +nvarchar + abc🙂defghi🙂🙂 + 比尔·拉莫斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +DECLARE @inputString BINARY(10) = 0x61626364656667, @pattern BINARY(10) = 0x6364, @replacement BINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +-- with table column of type binary +SELECT replace(a, b, c) FROM babel_4836_replace_t4 +GO +~~START~~ +varchar +atuvde +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +DECLARE @inputString VARBINARY(10) = 0x61626364656667, @pattern VARBINARY(10) = 0x6364, @replacement VARBINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +-- with table column of type varbinary +SELECT replace(a, b, c) FROM babel_4836_replace_t5 +GO +~~START~~ +varchar +atuvde +~~END~~ + + + +-- input type text +SELECT replace(a, b, c) FROM babel_4836_replace_text +GO +~~START~~ +varchar + abcjhi?ghi?? +~~END~~ + + +DECLARE @pattern VARCHAR(20) = '?de', @replacement VARCHAR(10) = 'x?y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_text +GO +~~START~~ +varchar + abc?defghi?? +~~END~~ + + +-- input type ntext +SELECT replace(a, b, c) FROM babel_4836_replace_ntext +GO +~~START~~ +varchar + abcjhi?ghi?? +~~END~~ + + +DECLARE @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(10) = N'x🙂y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_ntext +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4836_replace_dep_view +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_dep_view1 +GO +~~START~~ +varchar + abcx?yfghi?? +~~END~~ + + +EXEC babel_4836_replace_dep_proc +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_dep_func() +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_itvf_func() +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +-- different datatypes of inputString and pattern/replacement +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?ywfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement)+ '|' +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'ABCDEF', @pattern BINARY(4) = 0x414243, @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +尔·比 DEF +~~END~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @pattern NCHAR(20) = N'尔·比', @replacement VARBINARY(2) = 0x4144 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +ABCD +~~END~~ + + +-- input type UDT +-- in table babel_4836_replace_image_UDT_t, col 'a', 'b' and 'c' has basetype image +SELECT replace(a, b, c) FROM babel_4836_replace_image_UDT_t +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +-- in table babel_4836_replace_var_UDT_t, col 'a', 'b' and 'c' has basetype varchar +SELECT replace(b, b, c) FROM babel_4836_replace_var_UDT_t +GO +~~START~~ +varchar +gh +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, '12', '06'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString date = '2016-12-21', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern date = '2016-12-21', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @replacement date = '2016-12-21'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @date date = '2016-12-21', @replacement VARCHAR(10) = '06'; +DECLARE @pattern datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @date date = '2016-12-21'; +DECLARE @replacement datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern smalldatetime = '2016-12-21 12:43:10', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern VARCHAR(30) = '2016-12-21 12:43:10', @replacement smalldatetime = '2016-12-21 12:43:10'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern time(4) = '12:10:05.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern VARCHAR(30) = '12:10:05.1237', @replacement time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @replacement datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern datetime2(4) = '1968-10-23 12:45:37.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1237', @replacement datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString decimal = 123456, @pattern decimal = 12, @replacement decimal = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern decimal = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement decimal = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString numeric = 12345.12, @pattern numeric = 12, @replacement numeric = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern numeric = 12.12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement numeric = 12.12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString float = 12345.1, @pattern float = 12, @replacement float = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern float = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement float = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString real = 12345.1, @pattern real = 12, @replacement real = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern real = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement real = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString bigint = 12345678, @pattern bigint = 12, @replacement bigint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bigint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bigint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString int = 12345678, @pattern int = 12, @replacement int = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern int = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement int = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smallint = 12356, @pattern smallint = 12, @replacement smallint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString tinyint = 235, @pattern tinyint = 12, @replacement tinyint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern tinyint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement tinyint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString money = 12356, @pattern money = 12, @replacement money = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern money = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement money = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smallmoney = 12356, @pattern smallmoney = 12, @replacement smallmoney = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallmoney = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallmoney = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString bit = 1, @pattern bit = 1, @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bit = 1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of replace function.)~~ + + +SELECT replace(a, a, a) FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +SELECT replace('a', a, 'a') FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of replace function.)~~ + + +SELECT replace('a', 'a', a) FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of replace function.)~~ + + +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(a, @pattern, @replacement) from babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern xml = CAST ('' AS xml), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geometry = geometry::STGeomFromText('POINT (1 2)', 0), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geography = geography::STGeomFromText('POINT (1 2)', 4326), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geography = geography::STGeomFromText('POINT (1 2)', 4326); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO +~~START~~ +varchar +5A9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(CAST (@inputString AS VARCHAR(50)), CAST (@pattern AS VARCHAR(50)), CAST (@replacement AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO +~~START~~ +varchar +POINT(4 5) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replicate-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replicate-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..288621ee44f --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replicate-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,658 @@ +-- NULL +SELECT replicate(NULL, -2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate(NULL, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate(NULL, 2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate('abc', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate(NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- edge case values for second parameter +SELECT replicate('AbdefGhi', -2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT '|' + replicate('AbdefGhi', 0) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT replicate('AbdefGhi', 2) +GO +~~START~~ +varchar +AbdefGhiAbdefGhi +~~END~~ + + +SELECT replicate('AbdefGhi', 1001) +GO +~~START~~ +varchar +AbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhi +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abc?defghi?? abc?defghi?? abc?defghi?? abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_862_replicate_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_862_replicate_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_862_replicate_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_ci_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +SELECT replicate(a, 4) COLLATE ARABIC_CI_AS FROM babel_862_replicate_arabic_ci_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_cs_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +SELECT replicate(a, 4) COLLATE ARABIC_CS_AS FROM babel_862_replicate_arabic_cs_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_ci_ai +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +SELECT replicate(a, 4) COLLATE ARABIC_CI_AI FROM babel_862_replicate_arabic_ci_ai +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +abc?defghi?? abc?defghi?? abc?defghi?? abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 +~~END~~ + + +-- with table column of type nchar +SELECT replicate(a, 4) FROM babel_862_replicate_t1 +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 +比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abcdefghabcdefghabcdefghabcdefgh +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abcdefghabcdefghabcdefghabcdefgh +~~END~~ + + +-- dependent objects +SELECT * FROM babel_862_replicate_dep_view +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +EXEC babel_862_replicate_dep_proc +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_func() +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_862_replicate_itvf_func() +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_1 +GO +~~START~~ +varchar +abc?defghi?? abc?defghi?? abc?defghi?? abc?defghi?? +比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_2 +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_3 +GO +~~START~~ +varchar +abcdefghi abcdefghi abcdefghi abcdefghi +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_4 +GO +~~START~~ +varchar +abcdefghiabcdefghiabcdefghiabcdefghi +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_5 +GO +~~START~~ +varchar +0x20206162636420200x20206162636420200x20206162636420200x2020616263642020 +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_6 +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_7 +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +-- input type UDT +-- -- in table babel_862_replicate_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT replicate(a, 4) FROM babel_862_replicate_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replicate function.)~~ + + +SELECT replicate(b, 4) FROM babel_862_replicate_UDT +GO +~~START~~ +varchar +abcdefabcdefabcdefabcdef +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +2016-12-212016-12-212016-12-212016-12-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +2016-12-21 00:00:002016-12-21 00:00:002016-12-21 00:00:002016-12-21 00:00:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1955-12-13 12:43:001955-12-13 12:43:001955-12-13 12:43:001955-12-13 12:43:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12:10:05.123712:10:05.123712:10:05.123712:10:05.1237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:001968-10-23 12:45:37.1234 +10:001968-10-23 12:45:37.1234 +10:001968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1968-10-23 12:45:37.12371968-10-23 12:45:37.12371968-10-23 12:45:37.12371968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +123456123456123456123456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345123451234512345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345.112345.112345.112345.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345.112345.112345.112345.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345678123456781234567812345678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345678123456781234567812345678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12356123561235612356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +235235235235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12356.000012356.000012356.000012356.0000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12356.000012356.000012356.000012356.0000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1111 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +SELECT replicate(a, 4) from babel_862_replicate_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replicate function.)~~ + + +-- input datatype text +SELECT replicate(a, 4) FROM babel_862_replicate_text +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT replicate(b, 4) FROM babel_862_replicate_text +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO +~~START~~ +varchar +POINT(1 2)POINT(1 2)POINT(1 2)POINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replicate-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replicate-vu-verify.out new file mode 100644 index 00000000000..867377f6ccb --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replicate-vu-verify.out @@ -0,0 +1,658 @@ +-- NULL +SELECT replicate(NULL, -2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate(NULL, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate(NULL, 2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate('abc', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate(NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- edge case values for second parameter +SELECT replicate('AbdefGhi', -2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT '|' + replicate('AbdefGhi', 0) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT replicate('AbdefGhi', 2) +GO +~~START~~ +varchar +AbdefGhiAbdefGhi +~~END~~ + + +SELECT replicate('AbdefGhi', 1001) +GO +~~START~~ +varchar +AbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhi +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abc?defghi?? abc?defghi?? abc?defghi?? abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_862_replicate_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_862_replicate_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_862_replicate_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_ci_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +SELECT replicate(a, 4) COLLATE ARABIC_CI_AS FROM babel_862_replicate_arabic_ci_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_cs_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +SELECT replicate(a, 4) COLLATE ARABIC_CS_AS FROM babel_862_replicate_arabic_cs_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_ci_ai +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +SELECT replicate(a, 4) COLLATE ARABIC_CI_AI FROM babel_862_replicate_arabic_ci_ai +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +abc?defghi?? abc?defghi?? abc?defghi?? abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 +~~END~~ + + +-- with table column of type nchar +SELECT replicate(a, 4) FROM babel_862_replicate_t1 +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 +比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abcdefghabcdefghabcdefghabcdefgh +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abcdefghabcdefghabcdefghabcdefgh +~~END~~ + + +-- dependent objects +SELECT * FROM babel_862_replicate_dep_view +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +EXEC babel_862_replicate_dep_proc +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_func() +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_862_replicate_itvf_func() +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_1 +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 +比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_2 +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_3 +GO +~~START~~ +varchar +abcdefghi abcdefghi abcdefghi abcdefghi +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_4 +GO +~~START~~ +varchar +abcdefghiabcdefghiabcdefghiabcdefghi +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_5 +GO +~~START~~ +varchar + abcd abcd abcd abcd +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_6 +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_7 +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +-- input type UDT +-- -- in table babel_862_replicate_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT replicate(a, 4) FROM babel_862_replicate_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replicate function.)~~ + + +SELECT replicate(b, 4) FROM babel_862_replicate_UDT +GO +~~START~~ +varchar +abcdefabcdefabcdefabcdef +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +2016-12-212016-12-212016-12-212016-12-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +2016-12-21 00:00:002016-12-21 00:00:002016-12-21 00:00:002016-12-21 00:00:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1955-12-13 12:43:001955-12-13 12:43:001955-12-13 12:43:001955-12-13 12:43:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12:10:05.123712:10:05.123712:10:05.123712:10:05.1237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:001968-10-23 12:45:37.1234 +10:001968-10-23 12:45:37.1234 +10:001968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1968-10-23 12:45:37.12371968-10-23 12:45:37.12371968-10-23 12:45:37.12371968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +123456123456123456123456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345123451234512345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345.112345.112345.112345.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345.112345.112345.112345.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345678123456781234567812345678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345678123456781234567812345678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12356123561235612356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +235235235235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12356.000012356.000012356.000012356.0000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12356.000012356.000012356.000012356.0000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1111 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +SELECT replicate(a, 4) from babel_862_replicate_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replicate function.)~~ + + +-- input datatype text +SELECT replicate(a, 4) FROM babel_862_replicate_text +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT replicate(b, 4) FROM babel_862_replicate_text +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO +~~START~~ +varchar +POINT(1 2)POINT(1 2)POINT(1 2)POINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/reverse-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/reverse-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..a71a9d05654 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/reverse-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,602 @@ +-- NULL +SELECT reverse(NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- empty string +SELECT reverse('') +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +varchar + ??ihgfed?cba +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +varchar + 斯莫拉·尔比 +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + 斯莫拉·尔比 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +varchar +??ihgfed?cba +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_ci_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +SELECT reverse(a) COLLATE CHINESE_PRC_CI_AS FROM babel_4839_reverse_chinese_prc_ci_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_cs_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +SELECT reverse(a) COLLATE CHINESE_PRC_CS_AS FROM babel_4839_reverse_chinese_prc_cs_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_ci_ai +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +SELECT reverse(a) COLLATE CHINESE_PRC_CI_AI FROM babel_4839_reverse_chinese_prc_ci_ai +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT reverse(a) FROM babel_4839_reverse_arabic_ci_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +SELECT reverse(a) COLLATE ARABIC_CI_AS FROM babel_4839_reverse_arabic_ci_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT reverse(a) FROM babel_4839_reverse_arabic_cs_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +SELECT reverse(a) COLLATE ARABIC_CS_AS FROM babel_4839_reverse_arabic_cs_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT reverse(a) FROM babel_4839_reverse_arabic_ci_ai +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +SELECT reverse(a) COLLATE ARABIC_CI_AI FROM babel_4839_reverse_arabic_ci_ai +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar + ??ihgfed?cba +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar + 斯莫拉·尔比 +~~END~~ + + +-- with table column of type nchar +SELECT reverse(a) FROM babel_4839_reverse_t1 +GO +~~START~~ +nvarchar + 🙂🙂ihgfed🙂cba + 斯莫拉·尔比 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar +斯莫拉·尔比 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT reverse(@inputString) +GO +~~START~~ +varchar +hgfedcba +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT reverse(@inputString) +GO +~~START~~ +varchar +hgfedcba +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4839_reverse_dep_view +GO +~~START~~ +text +??ihgfed?cba +~~END~~ + + +EXEC babel_4839_reverse_dep_proc +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_func() +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_itvf_func() +GO +~~START~~ +text +??ihgfed?cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_1 +GO +~~START~~ +text + ??ihgfed?cba + 斯莫拉·尔比 +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_2 +GO +~~START~~ +text +??ihgfed?cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_3 +GO +~~START~~ +text + ihgfedcba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_4 +GO +~~START~~ +text +ihgfedcba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_5 +GO +~~START~~ +text +0202463626160202x0 +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_6 +GO +~~START~~ +text +??ihgfed?cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_7 +GO +~~START~~ +text +??ihgfed?cba +~~END~~ + + +-- input type UDT +-- -- in table babel_4839_reverse_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT reverse(a) FROM babel_4839_reverse_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of reverse function.)~~ + + +SELECT reverse(b) FROM babel_4839_reverse_UDT +GO +~~START~~ +varchar +fedcba +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +12-21-6102 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +00:00:00 12-21-6102 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +00:34:21 31-21-5591 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +7321.50:01:21 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +00:01+ 4321.73:54:21 32-01-8691 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +7321.73:54:21 32-01-8691 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +654321 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +54321 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +1.54321 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +1.54321 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +87654321 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +87654321 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +65321 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +532 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +0000.65321 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +0000.65321 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT reverse(@inputString) +GO +~~START~~ +varchar +FF469CF40C00-D24B-110D-68B8-FF9169F6 +~~END~~ + + +SELECT reverse(a) from babel_4839_reverse_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of reverse function.)~~ + + +-- input datatype text +SELECT reverse(a) FROM babel_4839_reverse_text +GO +~~START~~ +varchar +??ihgfed?cba +~~END~~ + + +-- input datatype ntext +SELECT reverse(b) FROM babel_4839_reverse_text +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +FF469CF40C00-D24B-110D-68B8-FF9169F6 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +>ydob/<>/tiurf<>ydob< +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +)2 1(TNIOP +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/reverse-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/reverse-vu-verify.out new file mode 100644 index 00000000000..99256865d9d --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/reverse-vu-verify.out @@ -0,0 +1,602 @@ +-- NULL +SELECT reverse(NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- empty string +SELECT reverse('') +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +varchar + ??ihgfed?cba +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +varchar + 斯莫拉·尔比 +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + 斯莫拉·尔比 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +varchar +??ihgfed?cba +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_ci_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +SELECT reverse(a) COLLATE CHINESE_PRC_CI_AS FROM babel_4839_reverse_chinese_prc_ci_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_cs_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +SELECT reverse(a) COLLATE CHINESE_PRC_CS_AS FROM babel_4839_reverse_chinese_prc_cs_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_ci_ai +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +SELECT reverse(a) COLLATE CHINESE_PRC_CI_AI FROM babel_4839_reverse_chinese_prc_ci_ai +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT reverse(a) FROM babel_4839_reverse_arabic_ci_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +SELECT reverse(a) COLLATE ARABIC_CI_AS FROM babel_4839_reverse_arabic_ci_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT reverse(a) FROM babel_4839_reverse_arabic_cs_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +SELECT reverse(a) COLLATE ARABIC_CS_AS FROM babel_4839_reverse_arabic_cs_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT reverse(a) FROM babel_4839_reverse_arabic_ci_ai +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +SELECT reverse(a) COLLATE ARABIC_CI_AI FROM babel_4839_reverse_arabic_ci_ai +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar + ??ihgfed?cba +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar + 斯莫拉·尔比 +~~END~~ + + +-- with table column of type nchar +SELECT reverse(a) FROM babel_4839_reverse_t1 +GO +~~START~~ +nvarchar + 🙂🙂ihgfed🙂cba + 斯莫拉·尔比 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar +斯莫拉·尔比 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT reverse(@inputString) +GO +~~START~~ +varchar +hgfedcba +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT reverse(@inputString) +GO +~~START~~ +varchar +hgfedcba +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4839_reverse_dep_view +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +EXEC babel_4839_reverse_dep_proc +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_func() +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_itvf_func() +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_1 +GO +~~START~~ +nvarchar + 🙂🙂ihgfed🙂cba + 斯莫拉·尔比 +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_2 +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_3 +GO +~~START~~ +varchar + ihgfedcba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_4 +GO +~~START~~ +varchar +ihgfedcba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_5 +GO +~~START~~ +varchar + dcba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_6 +GO +~~START~~ +varchar +??ihgfed?cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_7 +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +-- input type UDT +-- -- in table babel_4839_reverse_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT reverse(a) FROM babel_4839_reverse_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of reverse function.)~~ + + +SELECT reverse(b) FROM babel_4839_reverse_UDT +GO +~~START~~ +varchar +fedcba +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +12-21-6102 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +00:00:00 12-21-6102 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +00:34:21 31-21-5591 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +7321.50:01:21 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +00:01+ 4321.73:54:21 32-01-8691 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +7321.73:54:21 32-01-8691 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +654321 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +54321 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +1.54321 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +1.54321 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +87654321 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +87654321 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +65321 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +532 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +0000.65321 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +0000.65321 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT reverse(@inputString) +GO +~~START~~ +varchar +FF469CF40C00-D24B-110D-68B8-FF9169F6 +~~END~~ + + +SELECT reverse(a) from babel_4839_reverse_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of reverse function.)~~ + + +-- input datatype text +SELECT reverse(a) FROM babel_4839_reverse_text +GO +~~START~~ +varchar +??ihgfed?cba +~~END~~ + + +-- input datatype ntext +SELECT reverse(b) FROM babel_4839_reverse_text +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +FF469CF40C00-D24B-110D-68B8-FF9169F6 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +>ydob/<>/tiurf<>ydob< +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +)2 1(TNIOP +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/right-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/right-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..8d2dd65532f --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/right-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,716 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(25) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT RIGHT(NULL, -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the right function.)~~ + + +SELECT RIGHT(NULL, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT RIGHT(NULL, 2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT RIGHT('abc', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT RIGHT(NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- edge case values for second parameter +SELECT RIGHT('AbdefGhi', -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the right function.)~~ + + +SELECT '|' + RIGHT('AbdefGhi', 0) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT RIGHT('AbdefGhi', 2) +GO +~~START~~ +varchar +hi +~~END~~ + + +SELECT RIGHT('AbdefGhi', 2147483646) +GO +~~START~~ +varchar +AbdefGhi +~~END~~ + + +SELECT RIGHT('AbdefGhi', 2147483650) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- input type char +DECLARE @inputString CHAR(15) = 'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 8) + '|' +GO +~~START~~ +varchar +|ghi?? | +~~END~~ + + +DECLARE @inputString CHAR(15) = '比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString CHAR(15) = '比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString CHAR(15) = 'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 50) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 5) +GO +~~START~~ +varchar +ghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 50) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_ci_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_4489_right_chinese_prc_ci_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_cs_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_4489_right_chinese_prc_cs_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_ci_ai +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_4489_right_chinese_prc_ci_ai +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_ci_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE ARABIC_CI_AS FROM babel_4489_right_arabic_ci_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_cs_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE ARABIC_CS_AS FROM babel_4489_right_arabic_cs_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_ci_ai +GO +~~START~~ +varchar +تقين +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE ARABIC_CI_AI FROM babel_4489_right_arabic_ci_ai +GO +~~START~~ +varchar +تقين +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(15) = N'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 8) + '|' +GO +~~START~~ +nvarchar +|ghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(15) = N'比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NCHAR(15) = N'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 50) + '|' +GO +~~START~~ +nvarchar +|abc?defghi?? | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + RIGHT(a, 13) + '|' FROM babel_4489_right_t1 +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂 | +|·拉莫斯 | +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 5) +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +nvarchar +·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 50) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +varchar +efgh +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +varchar +efgh +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_right_dep_view +GO +~~START~~ +text +ghi?? +~~END~~ + + +EXEC babel_4489_right_dep_proc +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4489_right_dep_func() +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4489_right_itvf_func() +GO +~~START~~ +text +ghi?? +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_1 +GO +~~START~~ +text +?? + +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_2 +GO +~~START~~ +text +ghi?? +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_3 +GO +~~START~~ +text + +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_4 +GO +~~START~~ +text +i +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_5 +GO +~~START~~ +text +42020 +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_6 +GO +~~START~~ +text +ghi?? +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_7 +GO +~~START~~ +text +ghi?? +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_right_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT RIGHT(a, 3) FROM babel_4489_right_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of right function.)~~ + + +SELECT RIGHT(b, 3) FROM babel_4489_right_UDT +GO +~~START~~ +varchar +def +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +5.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +5.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +4FF +~~END~~ + + +SELECT RIGHT(a, 5) from babel_4489_right_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of right function.)~~ + + +-- input datatype text +SELECT RIGHT(a, 5) FROM babel_4489_right_text +GO +~~START~~ +varchar +ghi?? +~~END~~ + + +-- input datatype ntext +SELECT RIGHT(b, 5) FROM babel_4489_right_text +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar +4FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar +dy> +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar + 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/right-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/right-vu-verify.out new file mode 100644 index 00000000000..d5da9980729 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/right-vu-verify.out @@ -0,0 +1,716 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(25) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT RIGHT(NULL, -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the right function.)~~ + + +SELECT RIGHT(NULL, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT RIGHT(NULL, 2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT RIGHT('abc', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT RIGHT(NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- edge case values for second parameter +SELECT RIGHT('AbdefGhi', -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the right function.)~~ + + +SELECT '|' + RIGHT('AbdefGhi', 0) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT RIGHT('AbdefGhi', 2) +GO +~~START~~ +varchar +hi +~~END~~ + + +SELECT RIGHT('AbdefGhi', 2147483646) +GO +~~START~~ +varchar +AbdefGhi +~~END~~ + + +SELECT RIGHT('AbdefGhi', 2147483650) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- input type char +DECLARE @inputString CHAR(15) = 'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 8) + '|' +GO +~~START~~ +varchar +|ghi?? | +~~END~~ + + +DECLARE @inputString CHAR(15) = '比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString CHAR(15) = '比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString CHAR(15) = 'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 50) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 5) +GO +~~START~~ +varchar +ghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 50) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_ci_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_4489_right_chinese_prc_ci_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_cs_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_4489_right_chinese_prc_cs_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_ci_ai +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_4489_right_chinese_prc_ci_ai +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_ci_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE ARABIC_CI_AS FROM babel_4489_right_arabic_ci_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_cs_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE ARABIC_CS_AS FROM babel_4489_right_arabic_cs_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_ci_ai +GO +~~START~~ +varchar +تقين +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE ARABIC_CI_AI FROM babel_4489_right_arabic_ci_ai +GO +~~START~~ +varchar +تقين +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(15) = N'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 8) + '|' +GO +~~START~~ +nvarchar +|ghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(15) = N'比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NCHAR(15) = N'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 50) + '|' +GO +~~START~~ +nvarchar +|abc?defghi?? | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + RIGHT(a, 13) + '|' FROM babel_4489_right_t1 +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂 | +|·拉莫斯 | +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 5) +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +nvarchar +·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 50) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +varchar +efgh +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +varchar +efgh +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_right_dep_view +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +EXEC babel_4489_right_dep_proc +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4489_right_dep_func() +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4489_right_itvf_func() +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_1 +GO +~~START~~ +nvarchar +🙂🙂 + +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_2 +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_3 +GO +~~START~~ +varchar + +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_4 +GO +~~START~~ +varchar +i +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_5 +GO +~~START~~ +varchar +bcd +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_6 +GO +~~START~~ +varchar +ghi?? +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_7 +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_right_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT RIGHT(a, 3) FROM babel_4489_right_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of right function.)~~ + + +SELECT RIGHT(b, 3) FROM babel_4489_right_UDT +GO +~~START~~ +varchar +def +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +5.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +5.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +4FF +~~END~~ + + +SELECT RIGHT(a, 5) from babel_4489_right_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of right function.)~~ + + +-- input datatype text +SELECT RIGHT(a, 5) FROM babel_4489_right_text +GO +~~START~~ +varchar +ghi?? +~~END~~ + + +-- input datatype ntext +SELECT RIGHT(b, 5) FROM babel_4489_right_text +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar +4FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar +dy> +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar + 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/rtrim-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/rtrim-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..49fdb73cc23 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/rtrim-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,610 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(50) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT RTRIM(NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_ci_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_rtrim_chinese_prc_ci_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_cs_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_rtrim_chinese_prc_cs_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_rtrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_rtrim_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_rtrim_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_rtrim_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| abc?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type nchar +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_t1 +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +| 比尔·拉莫斯| +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯| +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x202061626364656667682020 +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abcdefgh| +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x202061626364656667682020 +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abcdefgh| +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_rtrim_dep_view +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +EXEC babel_4489_rtrim_dep_proc +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_func() +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_itvf_func() +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_1 +GO +~~START~~ +varchar +| abc?defghi??| +| 比尔·拉莫斯| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_2 +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_3 +GO +~~START~~ +varchar +| abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_4 +GO +~~START~~ +varchar +| abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_5 +GO +~~START~~ +varchar +|0x2020616263642020| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_6 +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_7 +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_rtrim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT RTRIM(a) FROM babel_4489_rtrim_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of rtrim function.)~~ + + +SELECT RTRIM(b) FROM babel_4489_rtrim_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12:10:05.1237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +123456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +SELECT RTRIM(a) from babel_4489_rtrim_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of rtrim function.)~~ + + +-- input datatype text +SELECT RTRIM(a) FROM babel_4489_rtrim_text +GO +~~START~~ +varchar + abc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT RTRIM(b) FROM babel_4489_rtrim_text +GO +~~START~~ +nvarchar + abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +POINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/rtrim-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/rtrim-vu-verify.out new file mode 100644 index 00000000000..f45246480d1 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/rtrim-vu-verify.out @@ -0,0 +1,610 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(50) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT RTRIM(NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_ci_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_rtrim_chinese_prc_ci_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_cs_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_rtrim_chinese_prc_cs_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_rtrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_rtrim_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_rtrim_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_rtrim_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| abc?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type nchar +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_t1 +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +| 比尔·拉莫斯| +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯| +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x202061626364656667682020 +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abcdefgh| +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x202061626364656667682020 +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abcdefgh| +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_rtrim_dep_view +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +EXEC babel_4489_rtrim_dep_proc +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_func() +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_itvf_func() +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_1 +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +| 比尔·拉莫斯| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_2 +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_3 +GO +~~START~~ +varchar +| abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_4 +GO +~~START~~ +varchar +| abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_5 +GO +~~START~~ +varchar +| abcd| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_6 +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_7 +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_rtrim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT RTRIM(a) FROM babel_4489_rtrim_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of rtrim function.)~~ + + +SELECT RTRIM(b) FROM babel_4489_rtrim_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12:10:05.1237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +123456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +SELECT RTRIM(a) from babel_4489_rtrim_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of rtrim function.)~~ + + +-- input datatype text +SELECT RTRIM(a) FROM babel_4489_rtrim_text +GO +~~START~~ +varchar + abc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT RTRIM(b) FROM babel_4489_rtrim_text +GO +~~START~~ +nvarchar + abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +POINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/string_agg-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/string_agg-vu-verify.out new file mode 100644 index 00000000000..2cefc8d5fb7 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/string_agg-vu-verify.out @@ -0,0 +1,696 @@ +-- expression as column +SELECT STRING_AGG(a,'-') FROM string_agg_t +GO +~~START~~ +text +c-b-g-a-e-d-h +~~END~~ + + +SELECT STRING_AGG(a,'-') FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +c-a-d-h +b-g-e +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +h-d-c-a +e-g-b +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +h-d-c-a +e-g-b +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +a-c-d-h +b-g-e +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +a-c-h-d +g-b-e +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +a-c-d-h +b-g-e +~~END~~ + + +-- expression as expression of multiple columns +SELECT STRING_AGG(a+b,'-') FROM string_agg_t +GO +~~START~~ +text +cx-by-gu-az-ev-dw-ht +~~END~~ + + +SELECT STRING_AGG(a+b,'-') FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +cx-az-dw-ht +by-gu-ev +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +ht-dw-cx-az +ev-gu-by +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +ht-dw-cx-az +ev-gu-by +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-dw-ht +by-gu-ev +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-ht-dw +gu-by-ev +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-dw-ht +by-gu-ev +~~END~~ + + +-- expression as function +SELECT STRING_AGG(concat(a,b),'-') FROM string_agg_t +GO +~~START~~ +text +cx-by-gu-az-ev-dw-ht-s +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +cx-az-dw-ht +by-gu-ev-s +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +ht-dw-cx-az +s-ev-gu-by +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +ht-dw-cx-az +s-ev-gu-by +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-dw-ht +by-gu-ev-s +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-ht-dw +s-gu-by-ev +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-dw-ht +s-by-gu-ev +~~END~~ + + +-- Delimeter as a function +SELECT STRING_AGG(a, char(10)) FROM string_agg_t +GO +~~START~~ +text +cbgaedh +~~END~~ + + +SELECT STRING_AGG(a, char(10)) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +cadh +bge +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +hdca +egb +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +hdca +egb +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +acdh +bge +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +achd +gbe +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +acdh +bge +~~END~~ + + +-- order by clause on string column +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY a ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +a-c-d-h +b-e-g +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY a DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +h-d-c-a +g-e-b +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY a+b ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-dw-ht +by-ev-gu +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY a+b DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +ht-dw-cx-az +gu-ev-by +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY concat(a,b) ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-dw-ht +by-ev-gu-s +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY concat(a,b) DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +ht-dw-cx-az +s-gu-ev-by +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY a ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +acdh +beg +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY a DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +hdca +geb +~~END~~ + + +-- Batch statements +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g ORDER BY g +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +hdca +egb +~~END~~ + +~~START~~ +text +hdca +egb +~~END~~ + +~~START~~ +text +acdh +bge +~~END~~ + +~~START~~ +text +achd +gbe +~~END~~ + +~~START~~ +text +acdh +bge +~~END~~ + + +-- expression as column with multibyte characters +SELECT STRING_AGG(a,'-') FROM string_agg_multibyte_t +GO +~~START~~ +text +?-莫-?-尔-莫 +~~END~~ + + +SELECT STRING_AGG(a,'-') FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +text +?-尔 +莫-?-莫 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +text +?-尔 +莫-?-莫 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +text +?-尔 +莫-?-莫 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +text +尔-? +莫-?-莫 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +text +尔-? +?-莫-莫 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +text +尔-? +莫-?-莫 +~~END~~ + + +-- casting result to NVARCHAR to verify the output +SELECT CAST(STRING_AGG(a,'-') AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t +GO +~~START~~ +nvarchar +😎-莫-😇-尔-莫 +~~END~~ + + +SELECT CAST(STRING_AGG(a,'-') AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +nvarchar +😎-尔 +莫-😇-莫 +~~END~~ + + +SELECT CAST(STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid) AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +nvarchar +😎-尔 +莫-😇-莫 +~~END~~ + + +SELECT CAST(STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid ASC) AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +nvarchar +😎-尔 +莫-😇-莫 +~~END~~ + + +SELECT CAST(STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid DESC) AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +nvarchar +尔-😎 +莫-😇-莫 +~~END~~ + + +SELECT CAST(STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid ASC) AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +nvarchar +尔-😎 +😇-莫-莫 +~~END~~ + + +SELECT CAST(STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid DESC) AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +nvarchar +尔-😎 +莫-😇-莫 +~~END~~ + + +-- expression as column with chinese characters +SELECT STRING_AGG(a,'-') FROM string_agg_chinese_prc_ci_as +GO +~~START~~ +text +莫-尔-拉-比-斯 +~~END~~ + + +SELECT STRING_AGG(a,'-') FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO +~~START~~ +text +莫-比 +尔-拉-斯 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO +~~START~~ +text +比-莫 +斯-拉-尔 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO +~~START~~ +text +比-莫 +斯-拉-尔 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO +~~START~~ +text +莫-比 +尔-拉-斯 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO +~~START~~ +text +莫-比 +拉-尔-斯 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO +~~START~~ +text +莫-比 +尔-拉-斯 +~~END~~ + + +-- expression from a column of a subquery +SELECT STRING_AGG(sbq.b,'-') WITHIN GROUP (ORDER BY g1) FROM (SELECT g1, g2, STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id) as 'b' FROM string_agg_t2 GROUP BY g1, g2) as sbq GROUP BY g2 ORDER BY g2 +GO +~~START~~ +text +b-g-e-d-h +a-c-d-h +~~END~~ + + +SELECT STRING_AGG(sbq.b,'-') WITHIN GROUP (ORDER BY g1 ASC) FROM (SELECT g1, g2, STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id ASC) as 'b' FROM string_agg_t2 GROUP BY g1, g2) as sbq GROUP BY g2 ORDER BY g2 +GO +~~START~~ +text +b-g-e-d-h +a-c-d-h +~~END~~ + + +SELECT STRING_AGG(sbq.b,'-') WITHIN GROUP (ORDER BY g1 DESC) FROM (SELECT g1, g2, STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id DESC) as 'b' FROM string_agg_t2 GROUP BY g1, g2) as sbq GROUP BY g2 ORDER BY g2 +GO +~~START~~ +text +h-d-e-g-b +h-d-c-a +~~END~~ + + +-- Dependent objects +SELECT * FROM string_agg_dep_v1 +GO +~~START~~ +text +c-b-g-a-e-d-h +~~END~~ + + +EXEC string_agg_dep_p1 +GO +~~START~~ +text +c-b-g-a-e-d-h +~~END~~ + + +SELECT dbo.string_agg_dep_f1() +GO +~~START~~ +nvarchar +c-b-g-a-e-d-h +~~END~~ + + +SELECT * FROM string_agg_dep_v2 +GO +~~START~~ +text +b-g-e +c-a-d-h +~~END~~ + + +EXEC string_agg_dep_p2 +GO +~~START~~ +text +b-g-e +c-a-d-h +~~END~~ + + +SELECT * FROM dbo.string_agg_dep_f2() +GO +~~START~~ +text +b-g-e +c-a-d-h +~~END~~ + + +SELECT * FROM string_agg_dep_v3 +GO +~~START~~ +text +h-d-c-a +e-g-b +~~END~~ + + +EXEC string_agg_dep_p3 +GO +~~START~~ +text +h-d-c-a +e-g-b +~~END~~ + + +SELECT * FROM dbo.string_agg_dep_f3() +GO +~~START~~ +text +h-d-c-a +e-g-b +~~END~~ + + +-- dependent object trigger +INSERT INTO string_agg_school_details (classID, rollID, studentName) +VALUES (2, 3, 'StudentF'); +GO +~~START~~ +int#!#text +1#!#StudentA, StudentB, StudentC +2#!#StudentD, StudentE, StudentF +~~END~~ + +~~ROW COUNT: 1~~ + + +UPDATE string_agg_school_details +SET studentName = 'StudentG' +WHERE classID = 2 AND rollID = 3; +GO +~~START~~ +int#!#text +1#!#StudentA, StudentB, StudentC +2#!#StudentD, StudentE, StudentG +~~END~~ + +~~ROW COUNT: 1~~ + + +DELETE FROM string_agg_school_details +WHERE classID = 1 AND rollID = 2; +GO +~~START~~ +int#!#text +1#!#StudentA, StudentC +2#!#StudentD, StudentE, StudentG +~~END~~ + +~~ROW COUNT: 1~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/stuff-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/stuff-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..14bef8f622e --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/stuff-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,2691 @@ +-- NULL +SELECT stuff(NULL, 2, 1, 'ab') +GO +~~START~~ +varchar + +~~END~~ + +SELECT stuff('ab', 2, 1, NULL) +GO +~~START~~ +varchar +a +~~END~~ + +SELECT stuff('ab', NULL, 1, 'bc') +GO +~~START~~ +varchar + +~~END~~ + +SELECT stuff('ab', 2, NULL, 'bc') +GO +~~START~~ +varchar + +~~END~~ + +SELECT stuff('ab', NULL, '1', 'bc') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('ab', '2', NULL, 'bc') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('ab', NULL, NULL, 'bc') +GO +~~START~~ +varchar + +~~END~~ + + +-- Different no. of arguments +SELECT stuff('abc', 1, 2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The stuff function requires 4 arguments)~~ + + +SELECT stuff('abc', 1, 1, 'xy', 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The stuff function requires 4 arguments)~~ + + +-- edge case values for second parameter +SELECT stuff('AbdefGhi', 0, 1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT '|' + stuff('AbdefGhi', -1, 1, 'xy') + '|' +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 1, 1, 'xy') +GO +~~START~~ +varchar +xybdefGhi +~~END~~ + + +SELECT stuff('AbdefGhi', 8, 1, 'xy') +GO +~~START~~ +varchar +AbdefGhxy +~~END~~ + + +SELECT stuff('AbdefGhi', 9, 1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 2147483648, 1, 'xy') +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- edge case values for third parameter +SELECT stuff('AbdefGhi', 1, 0, 'xy') +GO +~~START~~ +varchar +xyAbdefGhi +~~END~~ + + +SELECT stuff('AbdefGhi', 8, 0, 'xy') +GO +~~START~~ +varchar +AbdefGhxyi +~~END~~ + + +SELECT stuff('AbdefGhi', 1, -1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 8, -1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 2, 9, 'xy') +GO +~~START~~ +varchar +Axy +~~END~~ + + +SELECT stuff('AbdefGhi', 2, 2147483648, 'xy') +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +axyz??wuytgdy? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +varchar +比拉·比 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比拉·比 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi🙂🙂 +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +SELECT stuff('abc🙂defghi🙂🙂', 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +axyz??wuytgdy? +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +SELECT stuff('比尔·拉莫斯', 4, 2, '拉·比') +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +varchar +比拉·比 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +SELECT stuff('比尔·拉莫斯', 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比拉·比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CI_AS FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CS_AS FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CS_AS FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CI_AI FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AI FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CI_AS FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CI_AS FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CS_AS FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CS_AS FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CI_AI FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CI_AI FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +axyz🙂🙂wuytgdy🙂 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +nvarchar +比拉·比 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比拉·比 +~~END~~ + + +-- with table column of type nchar +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_t1 +GO +~~START~~ +nvarchar +abcabc🙂defghi🙂🙂 efghi🙂🙂 +比尔·比尔·拉莫斯 斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +axyz🙂🙂wuytgdy🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +nvarchar +比拉·比 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比拉·比 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, 0x6566) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varbinary +616263C0ADA1A4B1C8666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: collations are not supported by type varbinary)~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 0, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 13, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, -1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, 15, 0x6566) +GO +~~START~~ +varbinary +616566 +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, 0x6566) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varbinary +616263C0ADA1A4B1C8666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: collations are not supported by type varbinary)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 0, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 13, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, -1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, 15, 0x6566) +GO +~~START~~ +varbinary +616566 +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4838_stuff_dep_view +GO +~~START~~ +text +abcxyz??wuytgdy?efghi?? +~~END~~ + + +EXEC babel_4838_stuff_dep_proc +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_func() +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4838_stuff_itvf_func() +GO +~~START~~ +text +abcxyz??wuytgdy?efghi?? +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_1 +GO +~~START~~ +text +abcxyz??wuytgdy?efghi?? +比尔·xyz??wuytgdy?斯 +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_2 +GO +~~START~~ +text +abcxyz??wuytgdy?efghi?? +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_3 +GO +~~START~~ +text +abcxyz??wuytgdy?fghi +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_4 +GO +~~START~~ +text +abcxyz??wuytgdy?fghi +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_5 +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: return type mismatch in function declared to return varbinary)~~ + + +-- input type UDT +-- in table babel_4838_stuff_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_UDT +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of stuff function.)~~ + + +SELECT stuff(b, 4, 2, b) FROM babel_4838_stuff_UDT +GO +~~START~~ +varchar +abcabcdeff +~~END~~ + + +-- other different datatypes, should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 4 of stuff function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of stuff function.)~~ + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of stuff function.)~~ + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of stuff function.)~~ + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString decimal = 123456; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString decimal = 123456; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString decimal = 123456; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString decimal = 123456; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString numeric = 12345.12; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString numeric = 12345.12; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString numeric = 12345.12; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString float = 12345.1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString float = 12345.1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString float = 12345.1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString float = 12345.1; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString real = 12345.1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString real = 12345.1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString real = 12345.1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString real = 12345.1; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString bigint = 12345678; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString bigint = 12345678; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString bigint = 12345678; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString bigint = 12345678; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString int = 12345678; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString int = 12345678; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 4 of stuff function.)~~ + +DECLARE @inputString int = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar +abcdysd +~~END~~ + +DECLARE @inputString int = 12345678; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString CHAR(25) = 'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bpchar is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString CHAR(25) = 'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bpchar is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString VARCHAR(25) = 'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString VARCHAR(25) = 'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 3 of stuff function.)~~ + + +DECLARE @inputString smallint = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString smallint = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 4 of stuff function.)~~ + +DECLARE @inputString smallint = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar +abcdysd +~~END~~ + +DECLARE @inputString smallint = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString NCHAR(25) = N'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "nchar" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString NCHAR(25) = N'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "nchar" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString NVARCHAR(25) = N'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type nvarchar is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString NVARCHAR(25) = N'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type nvarchar is invalid for argument 3 of stuff function.)~~ + + +DECLARE @inputString tinyint = 235; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString tinyint = 235; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 4 of stuff function.)~~ + +DECLARE @inputString tinyint = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar +abcdysd +~~END~~ + +DECLARE @inputString tinyint = 235; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 3 of stuff function.)~~ + + +DECLARE @inputString money = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString money = 12356; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString money = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString money = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString smallmoney = 12356; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString smallmoney = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString smallmoney = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString bit = 1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString bit = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString bit = 1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString bit = 1; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 4 of stuff function.)~~ + + +SELECT stuff(a, 4, 2, 'abcd') from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of stuff function.)~~ + +SELECT stuff('abcd', a, 2, 'abcd') from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('abcd', 4, a, 'abcd') from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('abcd', 4, 2, a) from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 4 of stuff function.)~~ + + +-- input datatype text +SELECT stuff(a, 4, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~START~~ +varchar +abcabcdefghi?? +~~END~~ + +SELECT stuff('abcd', a, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('abcd', 4, a, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('abcd', 4, 2, a) FROM babel_4838_stuff_text +GO +~~START~~ +varchar +abcabc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT stuff(b, 4, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~START~~ +nvarchar +abcabcdefghi🙂🙂 +~~END~~ + +SELECT stuff('abcd', b, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type ntext is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('abcd', 4, b, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type ntext is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('abcd', 4, 2, b) FROM babel_4838_stuff_text +GO +~~START~~ +nvarchar +abcabc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +~~START~~ +varchar +6F9abcd19FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +abc6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +abc +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +~~START~~ +varchar +POIabcdT(1 2) +~~END~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +abcPOINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/stuff-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/stuff-vu-verify.out new file mode 100644 index 00000000000..86f90d1b4dd --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/stuff-vu-verify.out @@ -0,0 +1,2692 @@ +-- NULL +SELECT stuff(NULL, 2, 1, 'ab') +GO +~~START~~ +varchar + +~~END~~ + +SELECT stuff('ab', 2, 1, NULL) +GO +~~START~~ +varchar +a +~~END~~ + +SELECT stuff('ab', NULL, 1, 'bc') +GO +~~START~~ +varchar + +~~END~~ + +SELECT stuff('ab', 2, NULL, 'bc') +GO +~~START~~ +varchar + +~~END~~ + +SELECT stuff('ab', NULL, '1', 'bc') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('ab', '2', NULL, 'bc') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('ab', NULL, NULL, 'bc') +GO +~~START~~ +varchar + +~~END~~ + + +-- Different no. of arguments +SELECT stuff('abc', 1, 2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The stuff function requires 4 arguments)~~ + + +SELECT stuff('abc', 1, 1, 'xy', 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The stuff function requires 4 arguments)~~ + + +-- edge case values for second parameter +SELECT stuff('AbdefGhi', 0, 1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT '|' + stuff('AbdefGhi', -1, 1, 'xy') + '|' +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 1, 1, 'xy') +GO +~~START~~ +varchar +xybdefGhi +~~END~~ + + +SELECT stuff('AbdefGhi', 8, 1, 'xy') +GO +~~START~~ +varchar +AbdefGhxy +~~END~~ + + +SELECT stuff('AbdefGhi', 9, 1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 2147483648, 1, 'xy') +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- edge case values for third parameter +SELECT stuff('AbdefGhi', 1, 0, 'xy') +GO +~~START~~ +varchar +xyAbdefGhi +~~END~~ + + +SELECT stuff('AbdefGhi', 8, 0, 'xy') +GO +~~START~~ +varchar +AbdefGhxyi +~~END~~ + + +SELECT stuff('AbdefGhi', 1, -1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 8, -1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 2, 9, 'xy') +GO +~~START~~ +varchar +Axy +~~END~~ + + +SELECT stuff('AbdefGhi', 2, 2147483648, 'xy') +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +axyz??wuytgdy? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +varchar +比拉·比 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比拉·比 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi🙂🙂 +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +SELECT stuff('abc🙂defghi🙂🙂', 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +axyz??wuytgdy? +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +SELECT stuff('比尔·拉莫斯', 4, 2, '拉·比') +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +varchar +比拉·比 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +SELECT stuff('比尔·拉莫斯', 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比拉·比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CI_AS FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CS_AS FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CS_AS FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CI_AI FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AI FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CI_AS FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CI_AS FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CS_AS FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CS_AS FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CI_AI FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CI_AI FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +axyz🙂🙂wuytgdy🙂 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +nvarchar +比拉·比 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比拉·比 +~~END~~ + + +-- with table column of type nchar +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_t1 +GO +~~START~~ +nvarchar +abcabc🙂defghi🙂🙂 efghi🙂🙂 +比尔·比尔·拉莫斯 斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +axyz🙂🙂wuytgdy🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +nvarchar +比拉·比 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比拉·比 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, 0x6566) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varbinary +616263C0ADA1A4B1C8666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: collations are not supported by type varbinary)~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 0, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 13, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, -1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, 15, 0x6566) +GO +~~START~~ +varbinary +616566 +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, 0x6566) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varbinary +616263C0ADA1A4B1C8666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: collations are not supported by type varbinary)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 0, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 13, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, -1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, 15, 0x6566) +GO +~~START~~ +varbinary +616566 +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4838_stuff_dep_view +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +EXEC babel_4838_stuff_dep_proc +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_func() +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4838_stuff_itvf_func() +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_1 +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +比尔·xyz🙂🙂wuytgdy🙂斯 +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_2 +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_3 +GO +~~START~~ +varchar +abcxyz??wuytgdy?fghi +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_4 +GO +~~START~~ +varchar +abcxyz??wuytgdy?fghi +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_5 +GO +~~START~~ +varbinary +2020616566642020 +~~END~~ + + +-- input type UDT +-- in table babel_4838_stuff_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_UDT +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of stuff function.)~~ + + +SELECT stuff(b, 4, 2, b) FROM babel_4838_stuff_UDT +GO +~~START~~ +varchar +abcabcdeff +~~END~~ + + +-- other different datatypes, should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 4 of stuff function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of stuff function.)~~ + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of stuff function.)~~ + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of stuff function.)~~ + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString decimal = 123456; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString decimal = 123456; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString decimal = 123456; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString decimal = 123456; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString numeric = 12345.12; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString numeric = 12345.12; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString numeric = 12345.12; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString float = 12345.1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString float = 12345.1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString float = 12345.1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString float = 12345.1; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString real = 12345.1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString real = 12345.1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString real = 12345.1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString real = 12345.1; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString bigint = 12345678; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString bigint = 12345678; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString bigint = 12345678; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString bigint = 12345678; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString int = 12345678; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString int = 12345678; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 4 of stuff function.)~~ + +DECLARE @inputString int = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar +abcdysd +~~END~~ + +DECLARE @inputString int = 12345678; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString CHAR(25) = 'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bpchar is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString CHAR(25) = 'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bpchar is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString VARCHAR(25) = 'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString VARCHAR(25) = 'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 3 of stuff function.)~~ + + +DECLARE @inputString smallint = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString smallint = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 4 of stuff function.)~~ + +DECLARE @inputString smallint = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar +abcdysd +~~END~~ + +DECLARE @inputString smallint = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString NCHAR(25) = N'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "nchar" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString NCHAR(25) = N'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "nchar" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString NVARCHAR(25) = N'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type nvarchar is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString NVARCHAR(25) = N'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type nvarchar is invalid for argument 3 of stuff function.)~~ + + +DECLARE @inputString tinyint = 235; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString tinyint = 235; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 4 of stuff function.)~~ + +DECLARE @inputString tinyint = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar +abcdysd +~~END~~ + +DECLARE @inputString tinyint = 235; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 3 of stuff function.)~~ + + +DECLARE @inputString money = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString money = 12356; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString money = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString money = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString smallmoney = 12356; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString smallmoney = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString smallmoney = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString bit = 1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString bit = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString bit = 1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString bit = 1; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 4 of stuff function.)~~ + + +SELECT stuff(a, 4, 2, 'abcd') from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of stuff function.)~~ + +SELECT stuff('abcd', a, 2, 'abcd') from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('abcd', 4, a, 'abcd') from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('abcd', 4, 2, a) from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 4 of stuff function.)~~ + + +-- input datatype text +SELECT stuff(a, 4, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~START~~ +varchar +abcabcdefghi?? +~~END~~ + +SELECT stuff('abcd', a, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('abcd', 4, a, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('abcd', 4, 2, a) FROM babel_4838_stuff_text +GO +~~START~~ +varchar +abcabc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT stuff(b, 4, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~START~~ +nvarchar +abcabcdefghi🙂🙂 +~~END~~ + +SELECT stuff('abcd', b, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type ntext is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('abcd', 4, b, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type ntext is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('abcd', 4, 2, b) FROM babel_4838_stuff_text +GO +~~START~~ +nvarchar +abcabc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +~~START~~ +varchar +6F9abcd19FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +abc6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +abc +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +~~START~~ +varchar +POIabcdT(1 2) +~~END~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +abcPOINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/substring-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/substring-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..df00300dd89 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/substring-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,1113 @@ +-- NULL +SELECT substring(NULL, 2, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +SELECT substring(CAST(NULL AS int), 2, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type int is invalid for argument 1 of substring function.)~~ + + +SELECT substring(CAST(NULL AS varbinary), 2, 1) +GO +~~START~~ +varbinary + +~~END~~ + + +SELECT substring(CAST(NULL AS decimal), 2, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type decimal is invalid for argument 1 of substring function.)~~ + + +SELECT substring('abc', NULL, 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', CAST(NULL AS text), 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 2 of substring function.)~~ + + +SELECT substring('abc', CAST(NULL AS varchar), 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', CAST(NULL AS int), 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', 2, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', 2, CAST(NULL AS text)) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 3 of substring function.)~~ + + +SELECT substring('abc', 2, CAST(NULL AS varchar)) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', 2, CAST(NULL AS int)) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring(NULL, 2, NULL) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +SELECT substring('abc', NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring(NULL, NULL, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +SELECT substring(NULL, NULL, NULL) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +-- Different no. of arguments +SELECT substring('abc', 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.substring function requires 3 arguments)~~ + + +SELECT substring('abc', 1, 1, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.substring function requires 3 arguments)~~ + + +-- edge case values for second parameter +SELECT substring('AbdefGhi', 0, 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT '|' + substring('AbdefGhi', -1, 1) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT substring('AbdefGhi', 1, 1) +GO +~~START~~ +varchar +A +~~END~~ + + +SELECT substring('AbdefGhi', 8, 1) +GO +~~START~~ +varchar +i +~~END~~ + + +SELECT substring('AbdefGhi', 9, 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('AbdefGhi', 2147483648, 1) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- edge case values for third parameter +SELECT substring('AbdefGhi', 1, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('AbdefGhi', 8, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('AbdefGhi', 1, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +SELECT substring('AbdefGhi', 8, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +SELECT substring('AbdefGhi', 2, 9) +GO +~~START~~ +varchar +bdefGhi +~~END~~ + + +SELECT substring('AbdefGhi', 2, 2147483648) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +?d +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +拉莫 +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 0, 1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 13, 1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 2, 15) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +拉莫 +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +?d +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +拉莫 +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 0, 1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 13, 1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 2, 15) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +拉莫 +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_ci_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CI_AS FROM babel_3658_substring_chinese_prc_ci_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_cs_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CS_AS FROM babel_3658_substring_chinese_prc_cs_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_ci_ai +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CI_AI FROM babel_3658_substring_chinese_prc_ci_ai +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_ci_as +GO +~~START~~ +varchar +ه +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE ARABIC_CI_AS FROM babel_3658_substring_arabic_ci_as +GO +~~START~~ +varchar +ه +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_cs_as +GO +~~START~~ +varchar +ه +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE ARABIC_CS_AS FROM babel_3658_substring_arabic_cs_as +GO +~~START~~ +varchar +ه +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_ci_ai +GO +~~START~~ +varchar +ه +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE ARABIC_CI_AI FROM babel_3658_substring_arabic_ci_ai +GO +~~START~~ +varchar +ه +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +?d +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +拉莫 +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +-- with table column of type nchar +SELECT substring(a, 4, 2) FROM babel_3658_substring_t1 +GO +~~START~~ +nvarchar +🙂d +拉莫 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +🙂d +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +拉莫 +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varbinary +6465 +~~END~~ + +~~START~~ +varbinary + +~~END~~ + +~~START~~ +varbinary + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varbinary +6465 +~~END~~ + +~~START~~ +varbinary + +~~END~~ + +~~START~~ +varbinary + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +SELECT substring(0x0a0b0c, 1,2), substring(0x0a0b0c,2,1) +GO +~~START~~ +varbinary#!#varbinary +0A0B#!#0B +~~END~~ + + +-- dependent objects +SELECT * FROM babel_3658_substring_dep_view +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +EXEC babel_3658_substring_dep_proc +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_func() +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_itvf_func() +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_1 +GO +~~START~~ +nvarchar +🙂 +拉 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_2 +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_3 +GO +~~START~~ +varchar +d +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_4 +GO +~~START~~ +varchar +d +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_5 +GO +~~START~~ +varchar +0 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_6 +GO +~~START~~ +varchar +? +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_7 +GO +~~START~~ +varchar +? +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_8 +GO +~~START~~ +varchar +0 +~~END~~ + + +-- input type UDT +-- in table babel_3658_substring_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT substring(a, 4, 2) FROM babel_3658_substring_UDT +GO +~~START~~ +varbinary +6465 +~~END~~ + + +SELECT substring(b, 4, 2) FROM babel_3658_substring_UDT +GO +~~START~~ +varchar +de +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of substring function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString decimal = 123456; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type decimal is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString float = 12345.1; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type float is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString real = 12345.1; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString bigint = 12345678; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString int = 12345678; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type int is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString smallint = 12356; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString tinyint = 235; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString money = 12356; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString bit = 1; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bit is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of substring function.)~~ + + +SELECT substring(a, 4, 2) from babel_3658_substring_image; +GO +~~START~~ +varbinary +3631 +~~END~~ + +SELECT substring(a, 0, 1) from babel_3658_substring_image; +GO +~~START~~ +varbinary + +~~END~~ + +SELECT substring(a, 13, 1) from babel_3658_substring_image; +GO +~~START~~ +varbinary +36 +~~END~~ + +SELECT substring(a, 2, -1) from babel_3658_substring_image; +GO +~~START~~ +varbinary +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +SELECT substring(a, 2, 15) from babel_3658_substring_image; +GO +~~START~~ +varbinary +463936313946462D384238362D4430 +~~END~~ + + +-- input datatype text +SELECT substring(a, 4, 2) FROM babel_3658_substring_text +GO +~~START~~ +varchar +?d +~~END~~ + +SELECT substring(a, 0, 1) from babel_3658_substring_text; +GO +~~START~~ +varchar + +~~END~~ + +SELECT substring(a, 13, 1) from babel_3658_substring_text; +GO +~~START~~ +varchar + +~~END~~ + +SELECT substring(a, 2, -1) from babel_3658_substring_text; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +SELECT substring(a, 2, 15) from babel_3658_substring_text; +GO +~~START~~ +varchar +bc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT substring(b, 4, 2) FROM babel_3658_substring_text +GO +~~START~~ +nvarchar +🙂d +~~END~~ + +SELECT substring(b, 0, 1) from babel_3658_substring_text; +GO +~~START~~ +nvarchar + +~~END~~ + +SELECT substring(b, 13, 1) from babel_3658_substring_text; +GO +~~START~~ +nvarchar + +~~END~~ + +SELECT substring(b, 2, -1) from babel_3658_substring_text; +GO +~~START~~ +nvarchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +SELECT substring(b, 2, 15) from babel_3658_substring_text; +GO +~~START~~ +nvarchar +bc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO +~~START~~ +varchar +6 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO +~~START~~ +varchar +d +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO +~~START~~ +varchar +N +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/substring-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/substring-vu-verify.out new file mode 100644 index 00000000000..b3a2766835f --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/substring-vu-verify.out @@ -0,0 +1,1269 @@ +-- NULL +SELECT substring(NULL, 2, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +SELECT substring(CAST(NULL AS int), 2, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type int is invalid for argument 1 of substring function.)~~ + + +SELECT substring(CAST(NULL AS varbinary), 2, 1) +GO +~~START~~ +varbinary + +~~END~~ + + +SELECT substring(CAST(NULL AS decimal), 2, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type decimal is invalid for argument 1 of substring function.)~~ + + +SELECT substring('abc', NULL, 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', CAST(NULL AS text), 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 2 of substring function.)~~ + + +SELECT substring('abc', CAST(NULL AS varchar), 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', CAST(NULL AS int), 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', 2, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', 2, CAST(NULL AS text)) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 3 of substring function.)~~ + + +SELECT substring('abc', 2, CAST(NULL AS varchar)) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', 2, CAST(NULL AS int)) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring(NULL, 2, NULL) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +SELECT substring('abc', NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring(NULL, NULL, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +SELECT substring(NULL, NULL, NULL) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +-- Different no. of arguments +SELECT substring('abc', 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.substring function requires 3 arguments)~~ + + +SELECT substring('abc', 1, 1, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.substring function requires 3 arguments)~~ + + +-- edge case values for second parameter +SELECT substring('AbdefGhi', 0, 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT '|' + substring('AbdefGhi', -1, 1) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT substring('AbdefGhi', 1, 1) +GO +~~START~~ +varchar +A +~~END~~ + + +SELECT substring('AbdefGhi', 8, 1) +GO +~~START~~ +varchar +i +~~END~~ + + +SELECT substring('AbdefGhi', 9, 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('AbdefGhi', 2147483648, 1) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- edge case values for third parameter +SELECT substring('AbdefGhi', 1, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('AbdefGhi', 8, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('AbdefGhi', 1, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +SELECT substring('AbdefGhi', 8, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +SELECT substring('AbdefGhi', 2, 9) +GO +~~START~~ +varchar +bdefGhi +~~END~~ + + +SELECT substring('AbdefGhi', 2, 2147483648) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +varchar +?d +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +bc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +varchar +拉莫 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +尔·拉莫斯 +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +拉莫 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +尔·拉莫斯 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +varchar +?d +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +bc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +varchar +拉莫 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +尔·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +拉莫 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_ci_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CI_AS FROM babel_3658_substring_chinese_prc_ci_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_cs_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CS_AS FROM babel_3658_substring_chinese_prc_cs_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_ci_ai +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CI_AI FROM babel_3658_substring_chinese_prc_ci_ai +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_ci_as +GO +~~START~~ +varchar +ه +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE ARABIC_CI_AS FROM babel_3658_substring_arabic_ci_as +GO +~~START~~ +varchar +ه +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_cs_as +GO +~~START~~ +varchar +ه +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE ARABIC_CS_AS FROM babel_3658_substring_arabic_cs_as +GO +~~START~~ +varchar +ه +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_ci_ai +GO +~~START~~ +varchar +ه +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE ARABIC_CI_AI FROM babel_3658_substring_arabic_ci_ai +GO +~~START~~ +varchar +ه +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +nvarchar +?d +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +bc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +nvarchar +拉莫 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +尔·拉莫斯 +~~END~~ + + +-- with table column of type nchar +SELECT substring(a, 4, 2) FROM babel_3658_substring_t1 +GO +~~START~~ +nvarchar +🙂d +拉莫 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +nvarchar +🙂d +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +bc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +nvarchar +拉莫 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +尔·拉莫斯 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +varbinary +6465 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varbinary +626364656667680000 +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +varbinary +6465 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varbinary +62636465666768 +~~END~~ + + +SELECT substring(0x0a0b0c, 1,2), substring(0x0a0b0c,2,1) +GO +~~START~~ +varbinary#!#varbinary +0A0B#!#0B +~~END~~ + + +-- dependent objects +SELECT * FROM babel_3658_substring_dep_view +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +EXEC babel_3658_substring_dep_proc +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_func() +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_itvf_func() +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_1 +GO +~~START~~ +nvarchar +🙂 +拉 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_2 +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_3 +GO +~~START~~ +varchar +d +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_4 +GO +~~START~~ +varchar +d +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_5 +GO +~~START~~ +varbinary +62 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_6 +GO +~~START~~ +varchar +? +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_7 +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_8 +GO +~~START~~ +varbinary +62 +~~END~~ + + +-- input type UDT +-- in table babel_3658_substring_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT substring(a, 4, 2) FROM babel_3658_substring_UDT +GO +~~START~~ +varbinary +6465 +~~END~~ + + +SELECT substring(b, 4, 2) FROM babel_3658_substring_UDT +GO +~~START~~ +varchar +de +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of substring function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString decimal = 123456; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type decimal is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString float = 12345.1; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type float is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString real = 12345.1; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString bigint = 12345678; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString int = 12345678; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type int is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString smallint = 12356; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString tinyint = 235; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString money = 12356; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString bit = 1; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bit is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of substring function.)~~ + + +SELECT substring(a, 4, 2) from babel_3658_substring_image; +GO +~~START~~ +varbinary +3631 +~~END~~ + +SELECT substring(a, 0, 1) from babel_3658_substring_image; +GO +~~START~~ +varbinary + +~~END~~ + +SELECT substring(a, 13, 1) from babel_3658_substring_image; +GO +~~START~~ +varbinary +36 +~~END~~ + +SELECT substring(a, 2, -1) from babel_3658_substring_image; +GO +~~START~~ +varbinary +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +SELECT substring(a, 2, 15) from babel_3658_substring_image; +GO +~~START~~ +varbinary +463936313946462D384238362D4430 +~~END~~ + + +-- input datatype text +SELECT substring(a, 4, 2) FROM babel_3658_substring_text +GO +~~START~~ +varchar +?d +~~END~~ + +SELECT substring(a, 0, 1) from babel_3658_substring_text; +GO +~~START~~ +varchar + +~~END~~ + +SELECT substring(a, 13, 1) from babel_3658_substring_text; +GO +~~START~~ +varchar + +~~END~~ + +SELECT substring(a, 2, -1) from babel_3658_substring_text; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +SELECT substring(a, 2, 15) from babel_3658_substring_text; +GO +~~START~~ +varchar +bc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT substring(b, 4, 2) FROM babel_3658_substring_text +GO +~~START~~ +nvarchar +🙂d +~~END~~ + +SELECT substring(b, 0, 1) from babel_3658_substring_text; +GO +~~START~~ +nvarchar + +~~END~~ + +SELECT substring(b, 13, 1) from babel_3658_substring_text; +GO +~~START~~ +nvarchar + +~~END~~ + +SELECT substring(b, 2, -1) from babel_3658_substring_text; +GO +~~START~~ +nvarchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +SELECT substring(b, 2, 15) from babel_3658_substring_text; +GO +~~START~~ +nvarchar +bc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO +~~START~~ +varchar +6 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO +~~START~~ +varchar +d +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO +~~START~~ +varchar +N +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/sys-syscolumns.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/sys-syscolumns.out index df158eeafff..65c87169749 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/sys-syscolumns.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/sys-syscolumns.out @@ -217,9 +217,10 @@ int -- Cross-DB system view query is not currently supported in Babelfish. SELECT COUNT(*) FROM db1.DbO.SySCOluMNs where name = '@firstparam' or name = '@secondparam' or name = 'col_a' or name = 'col_b' or name = 'col_c' go -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: Cross-DB system view query is not currently supported in Babelfish.)~~ +~~START~~ +int +6 +~~END~~ -- should not be visible here @@ -233,9 +234,10 @@ int SELECT COUNT(*) FROM db1.dbo.SySCOluMNs where name = '@thirdparam'; GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: Cross-DB system view query is not currently supported in Babelfish.)~~ +~~START~~ +int +0 +~~END~~ -- should not be visible here diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/sys-systypes-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/sys-systypes-vu-verify.out index dccd8906a31..861e924eb9a 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/sys-systypes-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/sys-systypes-vu-verify.out @@ -107,9 +107,10 @@ int SELECT count(*) FROM sys_systypes_db.dbo.systypes WHERE name = 'sys_systypes_type'; GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: Cross-DB system view query is not currently supported in Babelfish.)~~ +~~START~~ +int +1 +~~END~~ CREATE TYPE sys_systypes_type FROM int; @@ -142,9 +143,10 @@ sys_systypes_type#!#0#!#4#!#0#!#1#!##!# SELECT name, status, length, variable, allownulls, printfmt, collation FROM sys_systypes_db.dbo.systypes WHERE name = 'sys_systypes_type'; GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: Cross-DB system view query is not currently supported in Babelfish.)~~ +~~START~~ +varchar#!#tinyint#!#smallint#!#bit#!#bit#!#varchar#!#varchar +sys_systypes_type#!#0#!#4#!#0#!#1#!##!# +~~END~~ DROP TYPE sys_systypes_type; diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/test_search_path.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/test_search_path.out new file mode 100644 index 00000000000..84de501d9a9 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/test_search_path.out @@ -0,0 +1,212 @@ +CREATE TABLE babelfish_migration_mode_table (id_num INT IDENTITY(1,1), mig_mode VARCHAR(10)) +GO +INSERT INTO babelfish_migration_mode_table SELECT current_setting('babelfishpg_tsql.migration_mode') +GO +~~ROW COUNT: 1~~ + + +-- test multi-db mode +SELECT set_config('role', 'jdbc_user', false); +GO +~~START~~ +text +jdbc_user +~~END~~ + +SELECT set_config('babelfishpg_tsql.migration_mode', 'multi-db', false); +GO +~~START~~ +text +multi-db +~~END~~ + + +-- check if correct schema is present in search path +CREATE DATABASE ["BABEL_5111.db"] +GO + +CREATE DATABASE ["龙漫远; 龍漫遠.¢£€¥"] +GO + +use ["BABEL_5111.db"] +GO + +CREATE TABLE t1(a int) +GO + +SELECT current_setting('search_path') +GO +~~START~~ +text +"""babel_5111.db""_dbo", "$user", sys, pg_catalog +~~END~~ + + +CREATE SCHEMA ["BABEL_5111.scm"] +GO + +CREATE TABLE ["BABEL_5111.scm"].t1(a int) +GO + +CREATE VIEW ["BABEL_5111.scm"].v1 AS SELECT 1 +GO + +CREATE PROCEDURE ["BABEL_5111.scm"].p1 AS SELECT 1 +GO + +CREATE TRIGGER ["BABEL_5111.scm"].BABEL_5111_trgger1 on ["BABEL_5111.scm"].t1 AFTER INSERT AS BEGIN END +GO + +ALTER TABLE ["BABEL_5111.scm"].t1 ENABLE TRIGGER BABEL_5111_trgger1 +GO + +USE ["龙漫远; 龍漫遠.¢£€¥"] +GO + +CREATE TABLE t1(a int) +GO + +SELECT current_setting('search_path') +GO +~~START~~ +text +"""龙漫远; 龍漫遠.??€?""_dbo", "$user", sys, pg_catalog +~~END~~ + + +CREATE SCHEMA ["BABEL_5111.😃😄😉😊"] +GO + +CREATE TABLE ["BABEL_5111.😃😄😉😊"].t1(a int) +GO + +CREATE VIEW ["BABEL_5111.😃😄😉😊"].v1 AS SELECT 1 +GO + +CREATE PROCEDURE ["BABEL_5111.😃😄😉😊"].p1 AS SELECT 1 +GO + +CREATE TRIGGER ["BABEL_5111.😃😄😉😊"].BABEL_5111_trgger1 on ["BABEL_5111.😃😄😉😊"].t1 AFTER INSERT AS BEGIN END +GO + +ALTER TABLE ["BABEL_5111.😃😄😉😊"].t1 ENABLE TRIGGER BABEL_5111_trgger1 +GO + +USE master +GO + +EXEC ["BABEL_5111.db"].["BABEL_5111.scm"].p1 +GO +~~START~~ +int +1 +~~END~~ + + +SELECT * from ["BABEL_5111.db"].["BABEL_5111.scm"].t1 +GO +~~START~~ +int +~~END~~ + + +SELECT * from ["BABEL_5111.db"].["BABEL_5111.scm"].v1 +GO +~~START~~ +int +1 +~~END~~ + + +EXEC ["龙漫远; 龍漫遠.¢£€¥"].["BABEL_5111.😃😄😉😊"].p1 +GO +~~START~~ +int +1 +~~END~~ + + +SELECT * from ["龙漫远; 龍漫遠.¢£€¥"].["BABEL_5111.😃😄😉😊"].t1 +GO +~~START~~ +int +~~END~~ + + +SELECT * from ["龙漫远; 龍漫遠.¢£€¥"].["BABEL_5111.😃😄😉😊"].v1 +GO +~~START~~ +int +1 +~~END~~ + + +use ["BABEL_5111.db"] +GO + +DROP PROCEDURE ["BABEL_5111.scm"].p1 +GO + +DROP TRIGGER ["BABEL_5111.scm"].BABEL_5111_trgger1 +GO + +DROP VIEW ["BABEL_5111.scm"].v1 +GO + +DROP TABLE ["BABEL_5111.scm"].t1 +GO + +DROP SCHEMA ["BABEL_5111.scm"] +GO + +DROP TABLE t1 +GO + +USE ["龙漫远; 龍漫遠.¢£€¥"] +GO + +DROP PROCEDURE ["BABEL_5111.😃😄😉😊"].p1 +GO + +DROP TRIGGER ["BABEL_5111.😃😄😉😊"].BABEL_5111_trgger1 +GO + +DROP VIEW ["BABEL_5111.😃😄😉😊"].v1 +GO + +DROP TABLE ["BABEL_5111.😃😄😉😊"].t1 +GO + +DROP SCHEMA ["BABEL_5111.😃😄😉😊"] +GO + +USE master +GO + +DROP DATABASE ["BABEL_5111.db"] +GO + +DROP DATABASE ["龙漫远; 龍漫遠.¢£€¥"] +GO + +SELECT set_config('role', 'jdbc_user', false); +GO +~~START~~ +text +jdbc_user +~~END~~ + + +-- Reset migration mode to default +DECLARE @mig_mode VARCHAR(10) +SET @mig_mode = (SELECT mig_mode FROM babelfish_migration_mode_table WHERE id_num = 1) +SELECT CASE WHEN (SELECT set_config('babelfishpg_tsql.migration_mode', @mig_mode, false)) IS NOT NULL THEN 1 ELSE 0 END +GO +~~START~~ +int +1 +~~END~~ + + +Drop Table IF EXISTS babelfish_migration_mode_table +GO diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/translate-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/translate-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..40b420686e2 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/translate-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,2736 @@ +DECLARE @string1 nvarchar(30) = N'比尔·拉' +DECLARE @characters nvarchar(10) = N'尔', @translation nvarchar(10) = N'莫' +SELECT TRANSLATE(@string1, @characters, @translation) +GO +~~START~~ +nvarchar +比莫·拉 +~~END~~ + + +-- NULL +SELECT TRANSLATE(NULL, 'acs', 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE('scd', NULL, 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE('scd', 'scd', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE(NULL, NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE(NULL, 'aces', 'scdwe') +GO +~~START~~ +varchar + +~~END~~ + + +-- different no. of arguments +SELECT TRANSLATE('aceds', 'aces', 'scdwe', 'acsdes') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.translate function requires 3 arguments)~~ + + +SELECT TRANSLATE('aces', 'scdwe') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.translate function requires 3 arguments)~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(10) = '比拉斯 ', @translations CHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(10) = '比拉斯 ', @translations CHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯 | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(10) = '比拉斯 ', @translations VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(10) = '比拉斯 ', @translations VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(MAX) = '比拉斯 ', @translations VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(MAX) = '比拉斯 ', @translations VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_ci_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4837_translate_chinese_prc_ci_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_cs_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4837_translate_chinese_prc_cs_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4837_translate_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CI_AS + '|' FROM babel_4837_translate_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CS_AS + '|' FROM babel_4837_translate_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CI_AI + '|' FROM babel_4837_translate_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(10) = N'比拉斯 ', @translations NCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(10) = N'比拉斯 ', @translations NCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_t1 +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +| 尔尔··莫比 | +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(10) = N'比拉斯 ', @translations NVARCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(10) = N'比拉斯 ', @translations NVARCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(MAX) = N'比拉斯 ', @translations NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(MAX) = N'比拉斯 ', @translations NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4837_translate_dep_view +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +SELECT * FROM babel_4837_translate_dep_view1 +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +EXEC babel_4837_translate_dep_proc +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +SELECT * FROM babel_4837_translate_dep_func() +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +SELECT * FROM babel_4837_translate_itvf_func() +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +-- different datatypes of inputString and characters/translations +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations)+ '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = N' ABCDEF ', @characters BINARY(4) = 0x414243, @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @characters NCHAR(20) = N'尔·比?', @translations VARBINARY(2) = 0x4144 +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 1 of translate function.)~~ + + +-- input type UDT +-- in table babel_4837_translate_UDT, col 'a' has basetype image and col 'b' and 'c' have basetype varchar +SELECT TRANSLATE(a, b, c) FROM babel_4837_translate_UDT +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE(b, b, c) FROM babel_4837_translate_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT TRANSLATE(@inputString, '12', '06'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString date = '2016-12-21', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters date = '2016-12-21', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters VARCHAR(20) = '2016-12-21', @translations date = '2016-12-21'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of translate function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @date date = '2016-12-21', @translations VARCHAR(10) = '06'; +DECLARE @characters datetime = @date; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters VARCHAR(20) = '2016-12-21', @date date = '2016-12-21'; +DECLARE @translations datetime = @date; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @characters smalldatetime = '2016-12-21 12:43:10', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @characters VARCHAR(30) = '2016-12-21 12:43:10', @translations smalldatetime = '2016-12-21 12:43:10'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @characters time(4) = '12:10:05.1237', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @characters VARCHAR(30) = '12:10:05.1237', @translations time(4) = '12:10:05.1237'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @characters datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @characters VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @translations datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @characters datetime2(4) = '1968-10-23 12:45:37.1237', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @characters VARCHAR(50) = '1968-10-23 12:45:37.1237', @translations datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString decimal = 123456, @characters decimal = 12, @translations decimal = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters decimal = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations decimal = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString numeric = 12345.12, @characters numeric = 12, @translations numeric = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters numeric = 12.12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations numeric = 12.12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString float = 12345.1, @characters float = 12, @translations float = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters float = 12.1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations float = 12.1; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString real = 12345.1, @characters real = 12, @translations real = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters real = 12.1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations real = 12.1; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString bigint = 12345678, @characters bigint = 12, @translations bigint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters bigint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations bigint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString int = 12345678, @characters int = 12, @translations int = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters int = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations int = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smallint = 12356, @characters smallint = 12, @translations smallint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters smallint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations smallint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString tinyint = 235, @characters tinyint = 12, @translations tinyint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters tinyint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations tinyint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString money = 12356, @characters money = 12, @translations money = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters money = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations money = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smallmoney = 12356, @characters smallmoney = 12, @translations smallmoney = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters smallmoney = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations smallmoney = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString bit = 1, @characters bit = 1, @translations bit = 0; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters bit = 1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations bit = 0; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE(a, a, a) FROM babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE('a', a, 'a') FROM babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of translate function.)~~ + + +SELECT TRANSLATE('a', 'a', a) FROM babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of translate function.)~~ + + +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(a, @characters, @translations) from babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE(a, b, c) FROM babel_4837_translate_text +GO +~~START~~ +varchar + sbc?defjhi?? +~~END~~ + +SELECT TRANSLATE('qw', a, 'cd') FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE('qw', 'ab', a) FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE(b, a, c) FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE('qw', c, 'cd') FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE('qw', 'ab', b) FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @characters VARCHAR(20) = 'ab?', @translations VARCHAR(10) = 'x?y'; +SELECT TRANSLATE(a, @characters, @translations) FROM babel_4837_translate_text +GO +~~START~~ +varchar + x?c?defghi?? +~~END~~ + + +DECLARE @characters VARCHAR(20) = 'ab?', @translations VARCHAR(10) = 'x?y'; +SELECT TRANSLATE(b, @characters, @translations) FROM babel_4837_translate_text +GO +~~START~~ +nvarchar + x?c🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @characters xml = CAST ('' AS xml), @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters xml = CAST ('' AS xml), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters geometry = geometry::STGeomFromText('POINT (1 2)', 0), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters geography = geography::STGeomFromText('POINT (1 2)', 4326), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations geography = geography::STGeomFromText('POINT (1 2)', 4326); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), @characters, @translations) +GO +~~START~~ +varchar +5A9519AA-8B85-D011-B42D-00C04AC954AA +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @characters xml = CAST ('' AS xml), @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), CAST (@characters AS VARCHAR(50)), CAST (@translations AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), @characters, @translations) +GO +~~START~~ +varchar +POINT(4 5) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/translate-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/translate-vu-verify.out new file mode 100644 index 00000000000..ef9bbc5a4e1 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/translate-vu-verify.out @@ -0,0 +1,2736 @@ +DECLARE @string1 nvarchar(30) = N'比尔·拉' +DECLARE @characters nvarchar(10) = N'尔', @translation nvarchar(10) = N'莫' +SELECT TRANSLATE(@string1, @characters, @translation) +GO +~~START~~ +nvarchar +比莫·拉 +~~END~~ + + +-- NULL +SELECT TRANSLATE(NULL, 'acs', 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE('scd', NULL, 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE('scd', 'scd', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE(NULL, NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE(NULL, 'aces', 'scdwe') +GO +~~START~~ +varchar + +~~END~~ + + +-- different no. of arguments +SELECT TRANSLATE('aceds', 'aces', 'scdwe', 'acsdes') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.translate function requires 3 arguments)~~ + + +SELECT TRANSLATE('aces', 'scdwe') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.translate function requires 3 arguments)~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(10) = '比拉斯 ', @translations CHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(10) = '比拉斯 ', @translations CHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯 | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(10) = '比拉斯 ', @translations VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(10) = '比拉斯 ', @translations VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(MAX) = '比拉斯 ', @translations VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(MAX) = '比拉斯 ', @translations VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_ci_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4837_translate_chinese_prc_ci_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_cs_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4837_translate_chinese_prc_cs_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4837_translate_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CI_AS + '|' FROM babel_4837_translate_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CS_AS + '|' FROM babel_4837_translate_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CI_AI + '|' FROM babel_4837_translate_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(10) = N'比拉斯 ', @translations NCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(10) = N'比拉斯 ', @translations NCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_t1 +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +| 尔尔··莫比 | +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(10) = N'比拉斯 ', @translations NVARCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(10) = N'比拉斯 ', @translations NVARCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(MAX) = N'比拉斯 ', @translations NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(MAX) = N'比拉斯 ', @translations NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4837_translate_dep_view +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +SELECT * FROM babel_4837_translate_dep_view1 +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +EXEC babel_4837_translate_dep_proc +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +SELECT * FROM babel_4837_translate_dep_func() +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +SELECT * FROM babel_4837_translate_itvf_func() +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +-- different datatypes of inputString and characters/translations +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations)+ '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = N' ABCDEF ', @characters BINARY(4) = 0x414243, @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @characters NCHAR(20) = N'尔·比?', @translations VARBINARY(2) = 0x4144 +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 1 of translate function.)~~ + + +-- input type UDT +-- in table babel_4837_translate_UDT, col 'a' has basetype image and col 'b' and 'c' have basetype varchar +SELECT TRANSLATE(a, b, c) FROM babel_4837_translate_UDT +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE(b, b, c) FROM babel_4837_translate_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT TRANSLATE(@inputString, '12', '06'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString date = '2016-12-21', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters date = '2016-12-21', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters VARCHAR(20) = '2016-12-21', @translations date = '2016-12-21'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of translate function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @date date = '2016-12-21', @translations VARCHAR(10) = '06'; +DECLARE @characters datetime = @date; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters VARCHAR(20) = '2016-12-21', @date date = '2016-12-21'; +DECLARE @translations datetime = @date; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @characters smalldatetime = '2016-12-21 12:43:10', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @characters VARCHAR(30) = '2016-12-21 12:43:10', @translations smalldatetime = '2016-12-21 12:43:10'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @characters time(4) = '12:10:05.1237', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @characters VARCHAR(30) = '12:10:05.1237', @translations time(4) = '12:10:05.1237'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @characters datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @characters VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @translations datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @characters datetime2(4) = '1968-10-23 12:45:37.1237', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @characters VARCHAR(50) = '1968-10-23 12:45:37.1237', @translations datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString decimal = 123456, @characters decimal = 12, @translations decimal = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters decimal = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations decimal = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString numeric = 12345.12, @characters numeric = 12, @translations numeric = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters numeric = 12.12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations numeric = 12.12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString float = 12345.1, @characters float = 12, @translations float = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters float = 12.1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations float = 12.1; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString real = 12345.1, @characters real = 12, @translations real = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters real = 12.1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations real = 12.1; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString bigint = 12345678, @characters bigint = 12, @translations bigint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters bigint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations bigint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString int = 12345678, @characters int = 12, @translations int = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters int = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations int = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smallint = 12356, @characters smallint = 12, @translations smallint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters smallint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations smallint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString tinyint = 235, @characters tinyint = 12, @translations tinyint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters tinyint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations tinyint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString money = 12356, @characters money = 12, @translations money = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters money = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations money = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smallmoney = 12356, @characters smallmoney = 12, @translations smallmoney = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters smallmoney = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations smallmoney = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString bit = 1, @characters bit = 1, @translations bit = 0; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters bit = 1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations bit = 0; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE(a, a, a) FROM babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE('a', a, 'a') FROM babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of translate function.)~~ + + +SELECT TRANSLATE('a', 'a', a) FROM babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of translate function.)~~ + + +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(a, @characters, @translations) from babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE(a, b, c) FROM babel_4837_translate_text +GO +~~START~~ +varchar + sbc?defjhi?? +~~END~~ + +SELECT TRANSLATE('qw', a, 'cd') FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE('qw', 'ab', a) FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE(b, a, c) FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE('qw', c, 'cd') FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE('qw', 'ab', b) FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @characters VARCHAR(20) = 'ab?', @translations VARCHAR(10) = 'x?y'; +SELECT TRANSLATE(a, @characters, @translations) FROM babel_4837_translate_text +GO +~~START~~ +varchar + x?c?defghi?? +~~END~~ + + +DECLARE @characters VARCHAR(20) = 'ab?', @translations VARCHAR(10) = 'x?y'; +SELECT TRANSLATE(b, @characters, @translations) FROM babel_4837_translate_text +GO +~~START~~ +nvarchar + x?c🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @characters xml = CAST ('' AS xml), @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters xml = CAST ('' AS xml), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters geometry = geometry::STGeomFromText('POINT (1 2)', 0), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters geography = geography::STGeomFromText('POINT (1 2)', 4326), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations geography = geography::STGeomFromText('POINT (1 2)', 4326); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), @characters, @translations) +GO +~~START~~ +varchar +5A9519AA-8B85-D011-B42D-00C04AC954AA +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @characters xml = CAST ('' AS xml), @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), CAST (@characters AS VARCHAR(50)), CAST (@translations AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), @characters, @translations) +GO +~~START~~ +varchar +POINT(4 5) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/trim-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/trim-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..15998b983aa --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/trim-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,1364 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(50) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT TRIM(NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRIM(NULL FROM NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRIM('' FROM NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRIM(NULL FROM '') +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab? ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab😎 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab? ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab😎 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_ci_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_trim_chinese_prc_ci_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_cs_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_trim_chinese_prc_cs_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_trim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_trim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_trim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_trim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' ab😎c🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂😎 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|?c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +-- with table column of type nchar +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_t1 +GO +~~START~~ +nvarchar +|c🙂defghi| +|尔·拉莫| +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' ab😎c🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂😎 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_trim_dep_view +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +EXEC babel_4489_trim_dep_proc +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_func() +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_itvf_func() +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_1 +GO +~~START~~ +varchar +|abc?defghi??| +|比尔·拉莫斯| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_2 +GO +~~START~~ +varchar +|abc?defghi??| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_3 +GO +~~START~~ +varchar +|abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_4 +GO +~~START~~ +varchar +|abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_5 +GO +~~START~~ +varchar +|0x61626364| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_6 +GO +~~START~~ +varchar +|cdefgh| +~~END~~ + + +-- different datatypes of inputString and charSet +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' ABCDEF ', @charSet BINARY(4) = 0x414243 +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @charSet VARBINARY(2) = 0x4144 +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 1 of Trim function.)~~ + + +-- input type UDT +-- -- in table babel_4489_trim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT TRIM(a) FROM babel_4489_trim_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of Trim function.)~~ + + +SELECT TRIM(b) FROM babel_4489_trim_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +DECLARE @charSet VARCHAR(10) = 'ab' +SELECT TRIM(@charSet FROM a) FROM babel_4489_trim_UDT +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of Trim function.)~~ + + +DECLARE @charSet VARCHAR(10) = 'ab' +SELECT TRIM(@charSet FROM b) FROM babel_4489_trim_UDT +GO +~~START~~ +varchar +cdef +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT TRIM('12' FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString date = '2016-12-21', @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of Trim function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of Trim function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @charSet VARCHAR(10) = '10'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @charSet VARCHAR(10) = '23'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @charSet VARCHAR(10) = '23'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString decimal = 123456, @charSet decimal = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString numeric = 12345.12, @charSet numeric = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString float = 12345.1, @charSet float = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString real = 12345.1, @charSet real = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString bigint = 12345678, @charSet bigint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString int = 12345678, @charSet int = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString smallint = 12356, @charSet smallint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString tinyint = 235, @charSet tinyint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString money = 12356, @charSet money = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString smallmoney = 12356, @charSet smallmoney = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString bit = 1, @charSet bit = 1; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of Trim function.)~~ + + +SELECT TRIM(a FROM a) FROM babel_4489_trim_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of Trim function.)~~ + + +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM a) from babel_4489_trim_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of Trim function.)~~ + + +SELECT TRIM(a FROM b) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar + +~~END~~ + +SELECT TRIM(b FROM a) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar + +~~END~~ + + +DECLARE @charSet VARCHAR(20) = 'ab? ' +SELECT TRIM(@charSet FROM a) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar +c🙂defghi🙂🙂 +~~END~~ + + +DECLARE @charSet VARCHAR(20) = 'ab? ' +SELECT TRIM(@charSet FROM b) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar +c🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @charSet xml = CAST ('' AS xml); +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @charSet VARCHAR(10) = '(1 2)'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @charSet VARCHAR(10) = '(1 2)'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @charSet VARCHAR(10) = '2'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @charSet VARCHAR(10) = '2'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +9619FF-8B86-D011-B42D-00C04FC964 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @charSet xml = CAST ('' AS xml); +SELECT TRIM(CAST(@charSet AS VARCHAR) FROM CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +body> +~~END~~ + + +SELECT TRIM(NULL FROM NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRIM('' FROM NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRIM(NULL FROM '') +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab? ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab😎 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab? ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab😎 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_ci_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_trim_chinese_prc_ci_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_cs_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_trim_chinese_prc_cs_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_trim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_trim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_trim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_trim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' ab😎c🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂😎 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|?c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +-- with table column of type nchar +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_t1 +GO +~~START~~ +nvarchar +|c🙂defghi| +|尔·拉莫| +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' ab😎c🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂😎 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_trim_dep_view +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +EXEC babel_4489_trim_dep_proc +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_func() +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_itvf_func() +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_1 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂| +|比尔·拉莫斯| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_2 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_3 +GO +~~START~~ +varchar +|abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_4 +GO +~~START~~ +varchar +|abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_5 +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 1 of Trim function.)~~ + + +SELECT * FROM babel_4489_trim_dep_view_6 +GO +~~START~~ +varchar +|cdefgh| +~~END~~ + + +-- different datatypes of inputString and charSet +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' ABCDEF ', @charSet BINARY(4) = 0x414243 +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @charSet VARBINARY(2) = 0x4144 +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 1 of Trim function.)~~ + + +-- input type UDT +-- -- in table babel_4489_trim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT TRIM(a) FROM babel_4489_trim_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of Trim function.)~~ + + +SELECT TRIM(b) FROM babel_4489_trim_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +DECLARE @charSet VARCHAR(10) = 'ab' +SELECT TRIM(@charSet FROM a) FROM babel_4489_trim_UDT +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of Trim function.)~~ + + +DECLARE @charSet VARCHAR(10) = 'ab' +SELECT TRIM(@charSet FROM b) FROM babel_4489_trim_UDT +GO +~~START~~ +varchar +cdef +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT TRIM('12' FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString date = '2016-12-21', @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of Trim function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of Trim function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @charSet VARCHAR(10) = '10'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @charSet VARCHAR(10) = '23'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @charSet VARCHAR(10) = '23'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString decimal = 123456, @charSet decimal = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString numeric = 12345.12, @charSet numeric = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString float = 12345.1, @charSet float = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString real = 12345.1, @charSet real = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString bigint = 12345678, @charSet bigint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString int = 12345678, @charSet int = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString smallint = 12356, @charSet smallint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString tinyint = 235, @charSet tinyint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString money = 12356, @charSet money = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString smallmoney = 12356, @charSet smallmoney = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString bit = 1, @charSet bit = 1; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of Trim function.)~~ + + +SELECT TRIM(a FROM a) FROM babel_4489_trim_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of Trim function.)~~ + + +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM a) from babel_4489_trim_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of Trim function.)~~ + + +SELECT TRIM(a FROM b) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar + +~~END~~ + +SELECT TRIM(b FROM a) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar + +~~END~~ + + +DECLARE @charSet VARCHAR(20) = 'ab? ' +SELECT TRIM(@charSet FROM a) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar +c🙂defghi🙂🙂 +~~END~~ + + +DECLARE @charSet VARCHAR(20) = 'ab? ' +SELECT TRIM(@charSet FROM b) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar +c🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @charSet xml = CAST ('' AS xml); +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @charSet VARCHAR(10) = '(1 2)'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @charSet VARCHAR(10) = '(1 2)'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @charSet VARCHAR(10) = '2'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @charSet VARCHAR(10) = '2'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +9619FF-8B86-D011-B42D-00C04FC964 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @charSet xml = CAST ('' AS xml); +SELECT TRIM(CAST(@charSet AS VARCHAR) FROM CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +body> +~~END~~ + +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString BINARY(30) = 0x4142434445 +SELECT UPPER(@inputString) +SELECT LOWER(@inputString) +SELECT CONVERT(BINARY(50), UPPER(@inputString)); +SELECT CONVERT(BINARY(50), LOWER(@inputString)); +GO +~~START~~ +varchar +ABCDE +~~END~~ + +~~START~~ +varchar +abcde +~~END~~ + +~~START~~ +binary +4142434445000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +~~END~~ + +~~START~~ +binary +6162636465000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +~~END~~ + + +DECLARE @inputString VARBINARY(30) = 0x4142434445 +SELECT UPPER(@inputString) +SELECT LOWER(@inputString) +SELECT CONVERT(VARBINARY(50), UPPER(@inputString)); +SELECT CONVERT(VARBINARY(50), LOWER(@inputString)); +GO +~~START~~ +varchar +ABCDE +~~END~~ + +~~START~~ +varchar +abcde +~~END~~ + +~~START~~ +varbinary +4142434445 +~~END~~ + +~~START~~ +varbinary +6162636465 +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-4803 +declare @string1 nchar(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO +~~START~~ +nvarchar +|比尔·拉 | +~~END~~ + +~~START~~ +nvarchar +|比尔·拉 | +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-1664 +DECLARE @date date = '12-21-16'; +DECLARE @datetime datetime = @date; +SELECT UPPER(@datetime) +SELECT LOWER(@datetime) +GO +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-1664 +DECLARE @smalldatetime smalldatetime = '1955-12-13 12:43:10'; +SELECT UPPER(@smalldatetime) +SELECT LOWER(@smalldatetime) +GO +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + + +DECLARE @date date = '2016-12-21'; +SELECT UPPER(@date) +SELECT LOWER(@date) +GO +~~START~~ +varchar +2016-12-21 +~~END~~ + +~~START~~ +varchar +2016-12-21 +~~END~~ + + +DECLARE @time time(4) = '12:10:05.1237'; +SELECT UPPER(@time) +SELECT LOWER(@time) +GO +~~START~~ +varchar +12:10:05.1237 +~~END~~ + +~~START~~ +varchar +12:10:05.1237 +~~END~~ + + +DECLARE @datetimeoffset datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT UPPER(@datetimeoffset) +SELECT LOWER(@datetimeoffset) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @datetime2 datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT UPPER(@datetime2) +SELECT LOWER(@datetime2) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @decimal decimal = 123; +SELECT UPPER(@decimal) +SELECT LOWER(@decimal) +GO +~~START~~ +varchar +123 +~~END~~ + +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @numeric numeric = 12345.12; +SELECT UPPER(@numeric) +SELECT LOWER(@numeric) +GO +~~START~~ +varchar +12345 +~~END~~ + +~~START~~ +varchar +12345 +~~END~~ + + +DECLARE @float float = 12345.1; +SELECT UPPER(@float) +SELECT LOWER(@float) +GO +~~START~~ +varchar +12345.1 +~~END~~ + +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @real real = 12345.1; +SELECT UPPER(@real) +SELECT LOWER(@real) +GO +~~START~~ +varchar +12345.1 +~~END~~ + +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @bigint bigint = 2; +SELECT UPPER(@bigint) +SELECT LOWER(@bigint) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @int int = 2; +SELECT UPPER(@int) +SELECT LOWER(@int) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @smallint smallint = 2; +SELECT UPPER(@smallint) +SELECT LOWER(@smallint) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @tinyint tinyint = 2; +SELECT UPPER(@tinyint) +SELECT LOWER(@tinyint) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @money money = 2; +SELECT UPPER(@money) +SELECT LOWER(@money) +GO +~~START~~ +varchar +2.0000 +~~END~~ + +~~START~~ +varchar +2.0000 +~~END~~ + + +DECLARE @smallmoney smallmoney = 2; +SELECT UPPER(@smallmoney) +SELECT LOWER(@smallmoney) +GO +~~START~~ +varchar +2.0000 +~~END~~ + +~~START~~ +varchar +2.0000 +~~END~~ + + +DECLARE @bit bit = 1; +SELECT UPPER(@bit) +SELECT LOWER(@bit) +GO +~~START~~ +varchar +1 +~~END~~ + +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @myid uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + +~~START~~ +varchar +6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + + +DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of upper function.)~~ + + +DECLARE @myid xml = CAST ('' AS xml) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of upper function.)~~ + + +DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of upper function.)~~ + + +DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04F +~~END~~ + +~~START~~ +varchar +6f9619ff-8b86-d011-b42d-00c04f +~~END~~ + + +DECLARE @myid xml = CAST ('' AS xml) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + + +DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO +~~START~~ +varchar +POINT(1 2) +~~END~~ + +~~START~~ +varchar +point(1 2) +~~END~~ + + +Select UPPER(a), LOWER(a) from upper_lower_text +GO +~~START~~ +varchar#!#varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +Select UPPER(a), LOWER(a) from upper_lower_ntext +GO +~~START~~ +nvarchar#!#nvarchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +Select UPPER(a), LOWER(a) from upper_lower_image +GO +~~START~~ +varchar#!#varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of upper function.)~~ + + +declare @string1 nvarchar(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO +~~START~~ +nvarchar +|比尔·拉| +~~END~~ + +~~START~~ +nvarchar +|比尔·拉| +~~END~~ + + +declare @string1 char(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO +~~START~~ +varchar +|比尔·拉 | +~~END~~ + +~~START~~ +varchar +|比尔·拉 | +~~END~~ + + +declare @string1 varchar(30) = N'比尔·拉'; +select UPPER(@string1) +select LOWER(@string1) +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + +~~START~~ +varchar +比尔·拉 +~~END~~ + + +SELECT * from upper_lower_dt where UPPER(a) = N'Anikait'; +GO +~~START~~ +varchar#!#nvarchar#!#char#!#nchar +Anikait #!#Agrawal #!#Anikait #!#Agrawal +~~END~~ + +SELECT * from upper_lower_dt where LOWER(c) = N'比尔·拉拉'; +GO +~~START~~ +varchar#!#nvarchar#!#char#!#nchar +~~END~~ + + +SELECT * from dep_view_upper +GO +~~START~~ +text#!#text#!#text#!#text +~~END~~ + +SELECT upper(col), lower(col) FROM tab_arabic_ci_ai; +GO +~~START~~ +varchar#!#varchar +لقد#!#لقد +~~END~~ + +SELECT upper(col), lower(col) FROM tab_arabic_ci_as; +GO +~~START~~ +varchar#!#varchar +لقد#!#لقد +~~END~~ + +SELECT upper(col), lower(col) FROM tab_arabic_cs_as; +GO +~~START~~ +varchar#!#varchar +لقد#!#لقد +~~END~~ + +SELECT upper(col), lower(col) FROM tab_chinese_ci_ai; +GO +~~START~~ +varchar#!#varchar +比尔·拉#!#比尔·拉 +~~END~~ + +SELECT upper(col), lower(col) FROM tab_chinese_ci_as; +GO +~~START~~ +varchar#!#varchar +比尔·拉#!#比尔·拉 +~~END~~ + +SELECT upper(col), lower(col) FROM tab_chinese_cs_as; +GO +~~START~~ +varchar#!#varchar +比尔·拉#!#比尔·拉 +~~END~~ + +EXEC dep_proc_upper +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +ANIKAIT #!#AGRAWAL #!#ANIKAIT #!#AGRAWAL +~~END~~ + +select dbo.dep_func_upper() +GO +~~START~~ +varchar +ANIKAIT +~~END~~ + + +SELECT * from dep_view_lower +GO +~~START~~ +text#!#text#!#text#!#text +~~END~~ + +EXEC dep_proc_lower +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +anikait #!#agrawal #!#anikait #!#agrawal +~~END~~ + +SELECT * from dep_view_upper_lower +GO +~~START~~ +text#!#text +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +EXEC dep_proc_upper_lower +GO +~~START~~ +varchar#!#varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +SELECT * from dep_view_upper_lower1 +GO +~~START~~ +text#!#text +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +EXEC dep_proc_upper_lower1 +GO +~~START~~ +nvarchar#!#nvarchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +select dbo.dep_func_lower() +GO +~~START~~ +varchar +anikait +~~END~~ + +select dbo.tvp_func_upper_lower() +GO +~~START~~ +varchar +("ANIKAIT ","anikait ") +(" ANIKAIT"," anikait") +(" A"," a") +(" "," ") +("","") +(A,a) +(,) +(比尔·拉,比尔·拉) +~~END~~ + +SELECT * from dep_view_lower1 +GO +~~START~~ +text +adjnfjh +~~END~~ + +declare @b dbo.MyUDT = CAST('scsdc' AS dbo.MyUDT) +select upper(@b) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of upper function.)~~ + diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/upper_lower-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/upper_lower-vu-verify.out new file mode 100644 index 00000000000..35d13a4633c --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/upper_lower-vu-verify.out @@ -0,0 +1,845 @@ +DECLARE @class NCHAR(30) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE (@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'ANIKAIT AGRAWAL' +SELECT '[' + @class + ']' WHERE upper(@class) = N'Anikait Agrawal ' +SELECT '[' + @class + ']' WHERE lower(@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE lower(@class) = N'anikait agrawal' +SELECT '[' + @class + ']' WHERE lower(@class) = N'Anikait Agrawal ' +GO +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + + +DECLARE @class CHAR(30) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE (@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'ANIKAIT AGRAWAL' +SELECT '[' + @class + ']' WHERE upper(@class) = N'Anikait Agrawal ' +SELECT '[' + @class + ']' WHERE lower(@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE lower(@class) = N'anikait agrawal' +SELECT '[' + @class + ']' WHERE lower(@class) = N'Anikait Agrawal ' +GO +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + + +DECLARE @class NCHAR = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'ANIKAIT AGRAWAL' +SELECT '[' + @class + ']' WHERE lower(@class) = N'anikait agrawal' +GO +~~START~~ +nvarchar +~~END~~ + +~~START~~ +nvarchar +~~END~~ + + +DECLARE @class CHAR = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'ANIKAIT AGRAWAL' +SELECT '[' + @class + ']' WHERE lower(@class) = N'anikait agrawal' +GO +~~START~~ +varchar +~~END~~ + +~~START~~ +varchar +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-4807 +declare @string1 varchar(30) = N'比尔·拉' COLLATE chinese_prc_ci_as +SELECT UPPER(@string1) +SELECT UPPER(@string1) COLLATE chinese_prc_ci_as +SELECT LOWER(@string1) +SELECT LOWER(@string1) COLLATE chinese_prc_ci_as +go +~~START~~ +varchar +比尔·拉 +~~END~~ + +~~START~~ +varchar +比尔·拉 +~~END~~ + +~~START~~ +varchar +比尔·拉 +~~END~~ + +~~START~~ +varchar +比尔·拉 +~~END~~ + + +declare @string1 char(30) = N'比尔·拉' COLLATE chinese_prc_ci_as +SELECT '|' + UPPER(@string1) + '|' +SELECT '|' + UPPER(@string1) + '|' COLLATE chinese_prc_ci_as +SELECT '|' + LOWER(@string1) + '|' +SELECT '|' + LOWER(@string1) + '|' COLLATE chinese_prc_ci_as +go +~~START~~ +varchar +|比尔·拉 | +~~END~~ + +~~START~~ +varchar +|比尔·拉 | +~~END~~ + +~~START~~ +varchar +|比尔·拉 | +~~END~~ + +~~START~~ +varchar +|比尔·拉 | +~~END~~ + + +SELECT UPPER(NULL) +SELECT LOWER(NULL) +GO +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString BINARY(30) = 0x4142434445 +SELECT UPPER(@inputString) +SELECT LOWER(@inputString) +SELECT CONVERT(BINARY(50), UPPER(@inputString)); +SELECT CONVERT(BINARY(50), LOWER(@inputString)); +GO +~~START~~ +varchar +ABCDE +~~END~~ + +~~START~~ +varchar +abcde +~~END~~ + +~~START~~ +binary +4142434445000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +~~END~~ + +~~START~~ +binary +6162636465000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +~~END~~ + + +DECLARE @inputString VARBINARY(30) = 0x4142434445 +SELECT UPPER(@inputString) +SELECT LOWER(@inputString) +SELECT CONVERT(VARBINARY(50), UPPER(@inputString)); +SELECT CONVERT(VARBINARY(50), LOWER(@inputString)); +GO +~~START~~ +varchar +ABCDE +~~END~~ + +~~START~~ +varchar +abcde +~~END~~ + +~~START~~ +varbinary +4142434445 +~~END~~ + +~~START~~ +varbinary +6162636465 +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-4803 +declare @string1 nchar(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO +~~START~~ +nvarchar +|比尔·拉 | +~~END~~ + +~~START~~ +nvarchar +|比尔·拉 | +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-1664 +DECLARE @date date = '12-21-16'; +DECLARE @datetime datetime = @date; +SELECT UPPER(@datetime) +SELECT LOWER(@datetime) +GO +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-1664 +DECLARE @smalldatetime smalldatetime = '1955-12-13 12:43:10'; +SELECT UPPER(@smalldatetime) +SELECT LOWER(@smalldatetime) +GO +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + + +DECLARE @date date = '2016-12-21'; +SELECT UPPER(@date) +SELECT LOWER(@date) +GO +~~START~~ +varchar +2016-12-21 +~~END~~ + +~~START~~ +varchar +2016-12-21 +~~END~~ + + +DECLARE @time time(4) = '12:10:05.1237'; +SELECT UPPER(@time) +SELECT LOWER(@time) +GO +~~START~~ +varchar +12:10:05.1237 +~~END~~ + +~~START~~ +varchar +12:10:05.1237 +~~END~~ + + +DECLARE @datetimeoffset datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT UPPER(@datetimeoffset) +SELECT LOWER(@datetimeoffset) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @datetime2 datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT UPPER(@datetime2) +SELECT LOWER(@datetime2) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @decimal decimal = 123; +SELECT UPPER(@decimal) +SELECT LOWER(@decimal) +GO +~~START~~ +varchar +123 +~~END~~ + +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @numeric numeric = 12345.12; +SELECT UPPER(@numeric) +SELECT LOWER(@numeric) +GO +~~START~~ +varchar +12345 +~~END~~ + +~~START~~ +varchar +12345 +~~END~~ + + +DECLARE @float float = 12345.1; +SELECT UPPER(@float) +SELECT LOWER(@float) +GO +~~START~~ +varchar +12345.1 +~~END~~ + +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @real real = 12345.1; +SELECT UPPER(@real) +SELECT LOWER(@real) +GO +~~START~~ +varchar +12345.1 +~~END~~ + +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @bigint bigint = 2; +SELECT UPPER(@bigint) +SELECT LOWER(@bigint) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @int int = 2; +SELECT UPPER(@int) +SELECT LOWER(@int) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @smallint smallint = 2; +SELECT UPPER(@smallint) +SELECT LOWER(@smallint) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @tinyint tinyint = 2; +SELECT UPPER(@tinyint) +SELECT LOWER(@tinyint) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @money money = 2; +SELECT UPPER(@money) +SELECT LOWER(@money) +GO +~~START~~ +varchar +2.0000 +~~END~~ + +~~START~~ +varchar +2.0000 +~~END~~ + + +DECLARE @smallmoney smallmoney = 2; +SELECT UPPER(@smallmoney) +SELECT LOWER(@smallmoney) +GO +~~START~~ +varchar +2.0000 +~~END~~ + +~~START~~ +varchar +2.0000 +~~END~~ + + +DECLARE @bit bit = 1; +SELECT UPPER(@bit) +SELECT LOWER(@bit) +GO +~~START~~ +varchar +1 +~~END~~ + +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @myid uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + +~~START~~ +varchar +6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + + +DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of upper function.)~~ + + +DECLARE @myid xml = CAST ('' AS xml) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of upper function.)~~ + + +DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of upper function.)~~ + + +DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04F +~~END~~ + +~~START~~ +varchar +6f9619ff-8b86-d011-b42d-00c04f +~~END~~ + + +DECLARE @myid xml = CAST ('' AS xml) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + + +DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO +~~START~~ +varchar +POINT(1 2) +~~END~~ + +~~START~~ +varchar +point(1 2) +~~END~~ + + +Select UPPER(a), LOWER(a) from upper_lower_text +GO +~~START~~ +varchar#!#varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +Select UPPER(a), LOWER(a) from upper_lower_ntext +GO +~~START~~ +nvarchar#!#nvarchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +Select UPPER(a), LOWER(a) from upper_lower_image +GO +~~START~~ +varchar#!#varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of upper function.)~~ + + +declare @string1 nvarchar(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO +~~START~~ +nvarchar +|比尔·拉| +~~END~~ + +~~START~~ +nvarchar +|比尔·拉| +~~END~~ + + +declare @string1 char(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO +~~START~~ +varchar +|比尔·拉 | +~~END~~ + +~~START~~ +varchar +|比尔·拉 | +~~END~~ + + +declare @string1 varchar(30) = N'比尔·拉'; +select UPPER(@string1) +select LOWER(@string1) +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + +~~START~~ +varchar +比尔·拉 +~~END~~ + + +SELECT upper(a), lower(b), lower(c), upper(d) from upper_lower_dt; +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +ANIKAIT #!#agrawal #!#anikait #!#AGRAWAL + ANIKAIT#!# agrawal#!# anikait #!# AGRAWAL + A#!# 🤣😃#!# a #!# 🤣😃 + #!# #!# #!# +#!##!# #!# +A#!#a#!#a #!#A +#!##!##!# +比尔·拉#!#比尔·拉#!#比尔·拉 #!#比尔·拉 +~~END~~ + +SELECT * from upper_lower_dt where UPPER(a) = N'Anikait'; +GO +~~START~~ +varchar#!#nvarchar#!#char#!#nchar +Anikait #!#Agrawal #!#Anikait #!#Agrawal +~~END~~ + +SELECT * from upper_lower_dt where LOWER(c) = N'比尔·拉'; +GO +~~START~~ +varchar#!#nvarchar#!#char#!#nchar +比尔·拉#!#比尔·拉#!#比尔·拉 #!#比尔·拉 +~~END~~ + +SELECT * from upper_lower_dt where LOWER(d) = N'比尔·拉'; +GO +~~START~~ +varchar#!#nvarchar#!#char#!#nchar +比尔·拉#!#比尔·拉#!#比尔·拉 #!#比尔·拉 +~~END~~ + + +SELECT * from dep_view_upper +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +ANIKAIT #!#AGRAWAL #!#ANIKAIT #!#AGRAWAL +~~END~~ + +SELECT upper(col), lower(col) FROM tab_arabic_ci_ai; +GO +~~START~~ +varchar#!#varchar +لقد#!#لقد +~~END~~ + +SELECT upper(col), lower(col) FROM tab_arabic_ci_as; +GO +~~START~~ +varchar#!#varchar +لقد#!#لقد +~~END~~ + +SELECT upper(col), lower(col) FROM tab_arabic_cs_as; +GO +~~START~~ +varchar#!#varchar +لقد#!#لقد +~~END~~ + +SELECT upper(col), lower(col) FROM tab_chinese_ci_ai; +GO +~~START~~ +varchar#!#varchar +比尔·拉#!#比尔·拉 +~~END~~ + +SELECT upper(col), lower(col) FROM tab_chinese_ci_as; +GO +~~START~~ +varchar#!#varchar +比尔·拉#!#比尔·拉 +~~END~~ + +SELECT upper(col), lower(col) FROM tab_chinese_cs_as; +GO +~~START~~ +varchar#!#varchar +比尔·拉#!#比尔·拉 +~~END~~ + +EXEC dep_proc_upper +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +ANIKAIT #!#AGRAWAL #!#ANIKAIT #!#AGRAWAL +~~END~~ + +select dbo.dep_func_upper() +GO +~~START~~ +varchar +ANIKAIT +~~END~~ + + +SELECT * from dep_view_lower +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +anikait #!#agrawal #!#anikait #!#agrawal +~~END~~ + +EXEC dep_proc_lower +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +anikait #!#agrawal #!#anikait #!#agrawal +~~END~~ + +SELECT * from dep_view_upper_lower +GO +~~START~~ +varchar#!#varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +EXEC dep_proc_upper_lower +GO +~~START~~ +varchar#!#varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +SELECT * from dep_view_upper_lower1 +GO +~~START~~ +nvarchar#!#nvarchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +EXEC dep_proc_upper_lower1 +GO +~~START~~ +nvarchar#!#nvarchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +select dbo.dep_func_lower() +GO +~~START~~ +varchar +anikait +~~END~~ + +select dbo.tvp_func_upper_lower() +GO +~~START~~ +varchar +("ANIKAIT ","anikait ") +(" ANIKAIT"," anikait") +(" A"," a") +(" "," ") +("","") +(A,a) +(,) +(比尔·拉,比尔·拉) +~~END~~ + +SELECT * from dep_view_lower1 +GO +~~START~~ +varchar +adjnfjh +~~END~~ + +declare @b dbo.MyUDT = CAST('scsdc' AS dbo.MyUDT) +select upper(@b) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of upper function.)~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/left-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/left-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..340765aac2c --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/left-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,745 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(25) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT LEFT(NULL, -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the left function.)~~ + + +SELECT LEFT(NULL, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT LEFT(NULL, 2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT LEFT('abc', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT LEFT(NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- edge case values for second parameter +SELECT LEFT('AbdefGhi', -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the left function.)~~ + + +SELECT '|' + LEFT('AbdefGhi', 0) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT LEFT('AbdefGhi', 2) +GO +~~START~~ +varchar +Ab +~~END~~ + + +SELECT LEFT('AbdefGhi', 2147483646) +GO +~~START~~ +varchar +AbdefGhi +~~END~~ + + +SELECT LEFT('AbdefGhi', 2147483650) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- misc tests +DECLARE @procedure_name NVARCHAR(134) = ';1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO +~~START~~ +nvarchar + +~~END~~ + + +DECLARE @procedure_name NVARCHAR(134) = 'procedureName;1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO +~~START~~ +nvarchar +procedureName +~~END~~ + + +-- procedure name with length equal to 134 +DECLARE @procedure_name NVARCHAR(134) = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO +~~START~~ +nvarchar +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 5) + '|' +GO +~~START~~ +varchar +|abc?d| +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) + '|' +GO +~~START~~ +varchar +|比??拉| +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比??拉| +~~END~~ + + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 50) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 5) +GO +~~START~~ +varchar +abc?d +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT LEFT(@inputString, 4) +GO +~~START~~ +varchar +比??拉 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT LEFT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 50) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_4489_left_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_4489_left_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_4489_left_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_ci_as +GO +~~START~~ +varchar +الله +~~END~~ + + +SELECT LEFT(a, 4) COLLATE ARABIC_CI_AS FROM babel_4489_left_arabic_ci_as +GO +~~START~~ +varchar +الله +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_cs_as +GO +~~START~~ +varchar +الله +~~END~~ + + +SELECT LEFT(a, 4) COLLATE ARABIC_CS_AS FROM babel_4489_left_arabic_cs_as +GO +~~START~~ +varchar +الله +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_ci_ai +GO +~~START~~ +varchar +الله +~~END~~ + + +SELECT LEFT(a, 4) COLLATE ARABIC_CI_AI FROM babel_4489_left_arabic_ci_ai +GO +~~START~~ +varchar +الله +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 5) + '|' +GO +~~START~~ +nvarchar +|abc?d| +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) + '|' +GO +~~START~~ +nvarchar +|比??拉| +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 50) + '|' +GO +~~START~~ +nvarchar +|abc?defghi?? | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + LEFT(a, 5) + '|' FROM babel_4489_left_t1 +GO +~~START~~ +nvarchar +|abc🙂d| +|比尔·拉莫| +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 5) +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT LEFT(@inputString, 4) +GO +~~START~~ +nvarchar +比尔·拉 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 50) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT LEFT(@inputString, 4) +GO +~~START~~ +varchar +abcd +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT LEFT(@inputString, 4) +GO +~~START~~ +varchar +abcd +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_left_dep_view +GO +~~START~~ +text +abc?d +~~END~~ + + +EXEC babel_4489_left_dep_proc +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_func() +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +SELECT * FROM babel_4489_left_itvf_func() +GO +~~START~~ +text +abc?d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_1 +GO +~~START~~ +text +abc?d +比??拉莫 +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_2 +GO +~~START~~ +text +abc?d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_3 +GO +~~START~~ +text + abc +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_4 +GO +~~START~~ +text + abc +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_5 +GO +~~START~~ +text +0x202 +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_6 +GO +~~START~~ +text +abc?d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_7 +GO +~~START~~ +text +abc?d +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_left_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT LEFT(a, 3) FROM babel_4489_left_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of left function.)~~ + + +SELECT LEFT(b, 3) FROM babel_4489_left_UDT +GO +~~START~~ +varchar +abc +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +201 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +201 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +195 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +12: +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +196 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +196 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +6F9 +~~END~~ + + +SELECT LEFT(a, 5) from babel_4489_left_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of left function.)~~ + + +-- input datatype text +SELECT LEFT(a, 5) FROM babel_4489_left_text +GO +~~START~~ +varchar +abc?d +~~END~~ + + +-- input datatype ntext +SELECT LEFT(b, 5) FROM babel_4489_left_text +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LEFT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar +6F9 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LEFT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT LEFT(NULL, 2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT LEFT('abc', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT LEFT(NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- edge case values for second parameter +SELECT LEFT('AbdefGhi', -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the left function.)~~ + + +SELECT '|' + LEFT('AbdefGhi', 0) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT LEFT('AbdefGhi', 2) +GO +~~START~~ +varchar +Ab +~~END~~ + + +SELECT LEFT('AbdefGhi', 2147483646) +GO +~~START~~ +varchar +AbdefGhi +~~END~~ + + +SELECT LEFT('AbdefGhi', 2147483650) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- misc tests +DECLARE @procedure_name NVARCHAR(134) = ';1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO +~~START~~ +nvarchar + +~~END~~ + + +DECLARE @procedure_name NVARCHAR(134) = 'procedureName;1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO +~~START~~ +nvarchar +procedureName +~~END~~ + + +-- procedure name with length equal to 134 +DECLARE @procedure_name NVARCHAR(134) = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO +~~START~~ +nvarchar +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 5) + '|' +GO +~~START~~ +varchar +|abc?d| +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) + '|' +GO +~~START~~ +varchar +|比??拉| +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比??拉| +~~END~~ + + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 50) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 5) +GO +~~START~~ +varchar +abc?d +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT LEFT(@inputString, 4) +GO +~~START~~ +varchar +比??拉 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT LEFT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 50) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_4489_left_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_4489_left_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_4489_left_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_ci_as +GO +~~START~~ +varchar +الله +~~END~~ + + +SELECT LEFT(a, 4) COLLATE ARABIC_CI_AS FROM babel_4489_left_arabic_ci_as +GO +~~START~~ +varchar +الله +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_cs_as +GO +~~START~~ +varchar +الله +~~END~~ + + +SELECT LEFT(a, 4) COLLATE ARABIC_CS_AS FROM babel_4489_left_arabic_cs_as +GO +~~START~~ +varchar +الله +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_ci_ai +GO +~~START~~ +varchar +الله +~~END~~ + + +SELECT LEFT(a, 4) COLLATE ARABIC_CI_AI FROM babel_4489_left_arabic_ci_ai +GO +~~START~~ +varchar +الله +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 5) + '|' +GO +~~START~~ +nvarchar +|abc?d| +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) + '|' +GO +~~START~~ +nvarchar +|比??拉| +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 50) + '|' +GO +~~START~~ +nvarchar +|abc?defghi?? | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + LEFT(a, 5) + '|' FROM babel_4489_left_t1 +GO +~~START~~ +nvarchar +|abc🙂d| +|比尔·拉莫| +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 5) +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT LEFT(@inputString, 4) +GO +~~START~~ +nvarchar +比尔·拉 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 50) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT LEFT(@inputString, 4) +GO +~~START~~ +varchar +abcd +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT LEFT(@inputString, 4) +GO +~~START~~ +varchar +abcd +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_left_dep_view +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +EXEC babel_4489_left_dep_proc +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_func() +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +SELECT * FROM babel_4489_left_itvf_func() +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_1 +GO +~~START~~ +nvarchar +abc🙂d +比尔·拉莫 +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_2 +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_3 +GO +~~START~~ +varchar + abc +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_4 +GO +~~START~~ +varchar + abc +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_5 +GO +~~START~~ +varchar + abc +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_6 +GO +~~START~~ +varchar +abc?d +~~END~~ + + +SELECT * FROM babel_4489_left_dep_view_7 +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_left_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT LEFT(a, 3) FROM babel_4489_left_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of left function.)~~ + + +SELECT LEFT(b, 3) FROM babel_4489_left_UDT +GO +~~START~~ +varchar +abc +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +201 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +201 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +195 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +12: +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +196 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +196 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT LEFT(@inputString, 3) +GO +~~START~~ +varchar +6F9 +~~END~~ + + +SELECT LEFT(a, 5) from babel_4489_left_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of left function.)~~ + + +-- input datatype text +SELECT LEFT(a, 5) FROM babel_4489_left_text +GO +~~START~~ +varchar +abc?d +~~END~~ + + +-- input datatype ntext +SELECT LEFT(b, 5) FROM babel_4489_left_text +GO +~~START~~ +nvarchar +abc🙂d +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT LEFT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of left function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LEFT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar +6F9 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LEFT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|比??拉莫斯 | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比??拉莫斯 | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|比??拉莫斯 | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_ci_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_ltrim_chinese_prc_ci_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_cs_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_ltrim_chinese_prc_cs_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_ltrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_ltrim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_ltrim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_ltrim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|比??拉莫斯 | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_t1 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +|比尔·拉莫斯 | +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯 | +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x202061626364656667682020 +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abcdefgh| +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x202061626364656667682020 +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abcdefgh| +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_ltrim_dep_view +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +EXEC babel_4489_ltrim_dep_proc +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_func() +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_itvf_func() +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_1 +GO +~~START~~ +varchar +|abc?defghi?? | +|比??拉莫斯 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_2 +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_3 +GO +~~START~~ +varchar +|abcdefghi | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_4 +GO +~~START~~ +varchar +|abcdefghi | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_5 +GO +~~START~~ +varchar +|0x2020616263642020| +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_6 +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_7 +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_ltrim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT LTRIM(a) FROM babel_4489_ltrim_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of ltrim function.)~~ + + +SELECT LTRIM(b) FROM babel_4489_ltrim_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12:10:05.1237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +123456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +SELECT LTRIM(a) from babel_4489_ltrim_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of ltrim function.)~~ + + +-- input datatype text +SELECT LTRIM(a) FROM babel_4489_ltrim_text +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT LTRIM(b) FROM babel_4489_ltrim_text +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +POINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/ltrim-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/ltrim-vu-verify.out new file mode 100644 index 00000000000..9d48cccb442 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/ltrim-vu-verify.out @@ -0,0 +1,610 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(50) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT LTRIM(NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|比??拉莫斯 | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比??拉莫斯 | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|比??拉莫斯 | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_ci_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_ltrim_chinese_prc_ci_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_cs_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_ltrim_chinese_prc_cs_as +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_ltrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_ltrim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_ltrim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_ltrim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتقين | +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|比??拉莫斯 | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_t1 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +|比尔·拉莫斯 | +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯 | +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x202061626364656667682020 +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abcdefgh| +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x202061626364656667682020 +SELECT '|' + LTRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abcdefgh| +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_ltrim_dep_view +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +EXEC babel_4489_ltrim_dep_proc +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_func() +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_itvf_func() +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_1 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +|比尔·拉莫斯 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_2 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_3 +GO +~~START~~ +varchar +|abcdefghi | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_4 +GO +~~START~~ +varchar +|abcdefghi | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_5 +GO +~~START~~ +varchar +|abcd | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_6 +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +SELECT * FROM babel_4489_ltrim_dep_view_7 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂 | +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_ltrim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT LTRIM(a) FROM babel_4489_ltrim_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of ltrim function.)~~ + + +SELECT LTRIM(b) FROM babel_4489_ltrim_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12:10:05.1237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +123456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT LTRIM(@inputString) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +SELECT LTRIM(a) from babel_4489_ltrim_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of ltrim function.)~~ + + +-- input datatype text +SELECT LTRIM(a) FROM babel_4489_ltrim_text +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT LTRIM(b) FROM babel_4489_ltrim_text +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT LTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of ltrim function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +POINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/replace-before-14_3-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/replace-before-14_3-vu-verify.out new file mode 100644 index 00000000000..5cd634fb00f --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/replace-before-14_3-vu-verify.out @@ -0,0 +1,2853 @@ +declare @string1 nvarchar(30) = N'比尔·拉',@string2 nvarchar(30) = N'斯', @pat nvarchar(10) = N'尔' +select REPLACE(@string1, @pat, @string2) +GO +~~START~~ +nvarchar +比斯·拉 +~~END~~ + + +-- NULL +SELECT replace(NULL, 'acs', 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace('scd', NULL, 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace('scd', 'scd', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace(NULL, NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace(NULL, 'aces', 'scdwe') +GO +~~START~~ +varchar + +~~END~~ + + +-- different no. of arguments +SELECT replace('aceds', 'aces', 'scdwe', 'acsdes') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.replace function requires 3 arguments)~~ + + +SELECT replace('aces', 'scdwe') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.replace function requires 3 arguments)~~ + + +-- input type char +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +varchar +比????比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比??尔·比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比??拉莫斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比??拉莫斯 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +varchar +比????比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比????比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比????比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_ci_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CI_AS FROM babel_4836_replace_chinese_prc_ci_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_cs_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CS_AS FROM babel_4836_replace_chinese_prc_cs_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_ci_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +SELECT replace(a, b, c) COLLATE ARABIC_CI_AS FROM babel_4836_replace_arabic_ci_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_cs_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +SELECT replace(a, b, c) COLLATE ARABIC_CS_AS FROM babel_4836_replace_arabic_cs_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +nvarchar +比??尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比??拉莫斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??拉莫斯 +~~END~~ + + +-- with table column of type nchar +SELECT replace(a, b, c) FROM babel_4836_replace_t1 +GO +~~START~~ +nvarchar + abc🙂defghi🙂🙂 + 比尔·拉莫斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +DECLARE @inputString BINARY(10) = 0x61626364656667, @pattern BINARY(10) = 0x6364, @replacement BINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +-- with table column of type binary +SELECT replace(a, b, c) FROM babel_4836_replace_t4 +GO +~~START~~ +varchar +atuvde +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +DECLARE @inputString VARBINARY(10) = 0x61626364656667, @pattern VARBINARY(10) = 0x6364, @replacement VARBINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +-- with table column of type varbinary +SELECT replace(a, b, c) FROM babel_4836_replace_t5 +GO +~~START~~ +varchar +atuvde +~~END~~ + + + +-- input type text +SELECT replace(a, b, c) FROM babel_4836_replace_text +GO +~~START~~ +varchar + abcjhi?ghi?? +~~END~~ + + +DECLARE @pattern VARCHAR(20) = '?de', @replacement VARCHAR(10) = 'x?y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_text +GO +~~START~~ +varchar + abc?defghi?? +~~END~~ + + +-- input type ntext +SELECT replace(a, b, c) FROM babel_4836_replace_ntext +GO +~~START~~ +varchar + abcjhi?ghi?? +~~END~~ + + +DECLARE @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(10) = N'x🙂y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_ntext +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4836_replace_dep_view +GO +~~START~~ +text + abcx?yfghi?? +~~END~~ + + +SELECT * FROM babel_4836_replace_dep_view1 +GO +~~START~~ +text + abcx?yfghi?? +~~END~~ + + +EXEC babel_4836_replace_dep_proc +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_dep_func() +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_itvf_func() +GO +~~START~~ +text + abcx?yfghi?? +~~END~~ + + +-- different datatypes of inputString and pattern/replacement +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比????比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比??拉莫斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比??尔·比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?ywfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比??拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement)+ '|' +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比??拉莫斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比??尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比??尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'ABCDEF', @pattern BINARY(4) = 0x414243, @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??比 DEF +~~END~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @pattern NCHAR(20) = N'尔·比', @replacement VARBINARY(2) = 0x4144 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +ABCD +~~END~~ + + +-- input type UDT +-- in table babel_4836_replace_image_UDT_t, col 'a', 'b' and 'c' has basetype image +SELECT replace(a, b, c) FROM babel_4836_replace_image_UDT_t +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +-- in table babel_4836_replace_var_UDT_t, col 'a', 'b' and 'c' has basetype varchar +SELECT replace(b, b, c) FROM babel_4836_replace_var_UDT_t +GO +~~START~~ +varchar +gh +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, '12', '06'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString date = '2016-12-21', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern date = '2016-12-21', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @replacement date = '2016-12-21'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @date date = '2016-12-21', @replacement VARCHAR(10) = '06'; +DECLARE @pattern datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @date date = '2016-12-21'; +DECLARE @replacement datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern smalldatetime = '2016-12-21 12:43:10', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern VARCHAR(30) = '2016-12-21 12:43:10', @replacement smalldatetime = '2016-12-21 12:43:10'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern time(4) = '12:10:05.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern VARCHAR(30) = '12:10:05.1237', @replacement time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @replacement datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern datetime2(4) = '1968-10-23 12:45:37.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1237', @replacement datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString decimal = 123456, @pattern decimal = 12, @replacement decimal = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern decimal = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement decimal = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString numeric = 12345.12, @pattern numeric = 12, @replacement numeric = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern numeric = 12.12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement numeric = 12.12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString float = 12345.1, @pattern float = 12, @replacement float = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern float = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement float = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString real = 12345.1, @pattern real = 12, @replacement real = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern real = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement real = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString bigint = 12345678, @pattern bigint = 12, @replacement bigint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bigint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bigint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString int = 12345678, @pattern int = 12, @replacement int = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern int = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement int = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smallint = 12356, @pattern smallint = 12, @replacement smallint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString tinyint = 235, @pattern tinyint = 12, @replacement tinyint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern tinyint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement tinyint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString money = 12356, @pattern money = 12, @replacement money = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern money = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement money = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smallmoney = 12356, @pattern smallmoney = 12, @replacement smallmoney = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallmoney = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallmoney = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString bit = 1, @pattern bit = 1, @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bit = 1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of replace function.)~~ + + +SELECT replace(a, a, a) FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +SELECT replace('a', a, 'a') FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of replace function.)~~ + + +SELECT replace('a', 'a', a) FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of replace function.)~~ + + +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(a, @pattern, @replacement) from babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern xml = CAST ('' AS xml), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geometry = geometry::STGeomFromText('POINT (1 2)', 0), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geography = geography::STGeomFromText('POINT (1 2)', 4326), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geography = geography::STGeomFromText('POINT (1 2)', 4326); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO +~~START~~ +varchar +5A9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(CAST (@inputString AS VARCHAR(50)), CAST (@pattern AS VARCHAR(50)), CAST (@replacement AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO +~~START~~ +varchar +POINT(4 5) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/replace-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/replace-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..5cd634fb00f --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/replace-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,2853 @@ +declare @string1 nvarchar(30) = N'比尔·拉',@string2 nvarchar(30) = N'斯', @pat nvarchar(10) = N'尔' +select REPLACE(@string1, @pat, @string2) +GO +~~START~~ +nvarchar +比斯·拉 +~~END~~ + + +-- NULL +SELECT replace(NULL, 'acs', 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace('scd', NULL, 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace('scd', 'scd', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace(NULL, NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace(NULL, 'aces', 'scdwe') +GO +~~START~~ +varchar + +~~END~~ + + +-- different no. of arguments +SELECT replace('aceds', 'aces', 'scdwe', 'acsdes') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.replace function requires 3 arguments)~~ + + +SELECT replace('aces', 'scdwe') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.replace function requires 3 arguments)~~ + + +-- input type char +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +varchar +比????比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比??尔·比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比??拉莫斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比??拉莫斯 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +varchar +比????比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比????比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比????比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_ci_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CI_AS FROM babel_4836_replace_chinese_prc_ci_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_cs_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CS_AS FROM babel_4836_replace_chinese_prc_cs_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_ci_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +SELECT replace(a, b, c) COLLATE ARABIC_CI_AS FROM babel_4836_replace_arabic_ci_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_cs_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +SELECT replace(a, b, c) COLLATE ARABIC_CS_AS FROM babel_4836_replace_arabic_cs_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +nvarchar +比??尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比??拉莫斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??拉莫斯 +~~END~~ + + +-- with table column of type nchar +SELECT replace(a, b, c) FROM babel_4836_replace_t1 +GO +~~START~~ +nvarchar + abc🙂defghi🙂🙂 + 比尔·拉莫斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +DECLARE @inputString BINARY(10) = 0x61626364656667, @pattern BINARY(10) = 0x6364, @replacement BINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +-- with table column of type binary +SELECT replace(a, b, c) FROM babel_4836_replace_t4 +GO +~~START~~ +varchar +atuvde +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +DECLARE @inputString VARBINARY(10) = 0x61626364656667, @pattern VARBINARY(10) = 0x6364, @replacement VARBINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +-- with table column of type varbinary +SELECT replace(a, b, c) FROM babel_4836_replace_t5 +GO +~~START~~ +varchar +atuvde +~~END~~ + + + +-- input type text +SELECT replace(a, b, c) FROM babel_4836_replace_text +GO +~~START~~ +varchar + abcjhi?ghi?? +~~END~~ + + +DECLARE @pattern VARCHAR(20) = '?de', @replacement VARCHAR(10) = 'x?y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_text +GO +~~START~~ +varchar + abc?defghi?? +~~END~~ + + +-- input type ntext +SELECT replace(a, b, c) FROM babel_4836_replace_ntext +GO +~~START~~ +varchar + abcjhi?ghi?? +~~END~~ + + +DECLARE @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(10) = N'x🙂y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_ntext +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4836_replace_dep_view +GO +~~START~~ +text + abcx?yfghi?? +~~END~~ + + +SELECT * FROM babel_4836_replace_dep_view1 +GO +~~START~~ +text + abcx?yfghi?? +~~END~~ + + +EXEC babel_4836_replace_dep_proc +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_dep_func() +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_itvf_func() +GO +~~START~~ +text + abcx?yfghi?? +~~END~~ + + +-- different datatypes of inputString and pattern/replacement +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比????比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比??拉莫斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比??尔·比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?ywfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比??拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement)+ '|' +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比??拉莫斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比??尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比??尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'ABCDEF', @pattern BINARY(4) = 0x414243, @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??比 DEF +~~END~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @pattern NCHAR(20) = N'尔·比', @replacement VARBINARY(2) = 0x4144 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +ABCD +~~END~~ + + +-- input type UDT +-- in table babel_4836_replace_image_UDT_t, col 'a', 'b' and 'c' has basetype image +SELECT replace(a, b, c) FROM babel_4836_replace_image_UDT_t +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +-- in table babel_4836_replace_var_UDT_t, col 'a', 'b' and 'c' has basetype varchar +SELECT replace(b, b, c) FROM babel_4836_replace_var_UDT_t +GO +~~START~~ +varchar +gh +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, '12', '06'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString date = '2016-12-21', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern date = '2016-12-21', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @replacement date = '2016-12-21'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @date date = '2016-12-21', @replacement VARCHAR(10) = '06'; +DECLARE @pattern datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @date date = '2016-12-21'; +DECLARE @replacement datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern smalldatetime = '2016-12-21 12:43:10', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern VARCHAR(30) = '2016-12-21 12:43:10', @replacement smalldatetime = '2016-12-21 12:43:10'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern time(4) = '12:10:05.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern VARCHAR(30) = '12:10:05.1237', @replacement time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @replacement datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern datetime2(4) = '1968-10-23 12:45:37.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1237', @replacement datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString decimal = 123456, @pattern decimal = 12, @replacement decimal = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern decimal = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement decimal = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString numeric = 12345.12, @pattern numeric = 12, @replacement numeric = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern numeric = 12.12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement numeric = 12.12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString float = 12345.1, @pattern float = 12, @replacement float = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern float = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement float = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString real = 12345.1, @pattern real = 12, @replacement real = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern real = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement real = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString bigint = 12345678, @pattern bigint = 12, @replacement bigint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bigint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bigint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString int = 12345678, @pattern int = 12, @replacement int = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern int = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement int = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smallint = 12356, @pattern smallint = 12, @replacement smallint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString tinyint = 235, @pattern tinyint = 12, @replacement tinyint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern tinyint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement tinyint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString money = 12356, @pattern money = 12, @replacement money = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern money = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement money = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smallmoney = 12356, @pattern smallmoney = 12, @replacement smallmoney = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallmoney = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallmoney = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString bit = 1, @pattern bit = 1, @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bit = 1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of replace function.)~~ + + +SELECT replace(a, a, a) FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +SELECT replace('a', a, 'a') FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of replace function.)~~ + + +SELECT replace('a', 'a', a) FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of replace function.)~~ + + +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(a, @pattern, @replacement) from babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern xml = CAST ('' AS xml), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geometry = geometry::STGeomFromText('POINT (1 2)', 0), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geography = geography::STGeomFromText('POINT (1 2)', 4326), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geography = geography::STGeomFromText('POINT (1 2)', 4326); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO +~~START~~ +varchar +5A9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(CAST (@inputString AS VARCHAR(50)), CAST (@pattern AS VARCHAR(50)), CAST (@replacement AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO +~~START~~ +varchar +POINT(4 5) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/replace-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/replace-vu-verify.out new file mode 100644 index 00000000000..c33713fff18 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/replace-vu-verify.out @@ -0,0 +1,2853 @@ +declare @string1 nvarchar(30) = N'比尔·拉',@string2 nvarchar(30) = N'斯', @pat nvarchar(10) = N'尔' +select REPLACE(@string1, @pat, @string2) +GO +~~START~~ +nvarchar +比斯·拉 +~~END~~ + + +-- NULL +SELECT replace(NULL, 'acs', 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace('scd', NULL, 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace('scd', 'scd', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace(NULL, NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace(NULL, 'aces', 'scdwe') +GO +~~START~~ +varchar + +~~END~~ + + +-- different no. of arguments +SELECT replace('aceds', 'aces', 'scdwe', 'acsdes') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.replace function requires 3 arguments)~~ + + +SELECT replace('aces', 'scdwe') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.replace function requires 3 arguments)~~ + + +-- input type char +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +varchar +比????比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比??尔·比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比??拉莫斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比??拉莫斯 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +varchar +比????比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比????比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比????比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_ci_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CI_AS FROM babel_4836_replace_chinese_prc_ci_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_cs_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CS_AS FROM babel_4836_replace_chinese_prc_cs_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_ci_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +SELECT replace(a, b, c) COLLATE ARABIC_CI_AS FROM babel_4836_replace_arabic_ci_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_cs_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +SELECT replace(a, b, c) COLLATE ARABIC_CS_AS FROM babel_4836_replace_arabic_cs_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +nvarchar +比??尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比??拉莫斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??拉莫斯 +~~END~~ + + +-- with table column of type nchar +SELECT replace(a, b, c) FROM babel_4836_replace_t1 +GO +~~START~~ +nvarchar + abc🙂defghi🙂🙂 + 比尔·拉莫斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +DECLARE @inputString BINARY(10) = 0x61626364656667, @pattern BINARY(10) = 0x6364, @replacement BINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +-- with table column of type binary +SELECT replace(a, b, c) FROM babel_4836_replace_t4 +GO +~~START~~ +varchar +atuvde +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +DECLARE @inputString VARBINARY(10) = 0x61626364656667, @pattern VARBINARY(10) = 0x6364, @replacement VARBINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +-- with table column of type varbinary +SELECT replace(a, b, c) FROM babel_4836_replace_t5 +GO +~~START~~ +varchar +atuvde +~~END~~ + + + +-- input type text +SELECT replace(a, b, c) FROM babel_4836_replace_text +GO +~~START~~ +varchar + abcjhi?ghi?? +~~END~~ + + +DECLARE @pattern VARCHAR(20) = '?de', @replacement VARCHAR(10) = 'x?y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_text +GO +~~START~~ +varchar + abc?defghi?? +~~END~~ + + +-- input type ntext +SELECT replace(a, b, c) FROM babel_4836_replace_ntext +GO +~~START~~ +varchar + abcjhi?ghi?? +~~END~~ + + +DECLARE @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(10) = N'x🙂y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_ntext +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4836_replace_dep_view +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_dep_view1 +GO +~~START~~ +varchar + abcx?yfghi?? +~~END~~ + + +EXEC babel_4836_replace_dep_proc +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_dep_func() +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_itvf_func() +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +-- different datatypes of inputString and pattern/replacement +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比????比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比??拉莫斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比??尔·比斯 +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?ywfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +比??拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement)+ '|' +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比??拉莫斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比??尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比??尔·比斯 +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'ABCDEF', @pattern BINARY(4) = 0x414243, @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??比 DEF +~~END~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @pattern NCHAR(20) = N'尔·比', @replacement VARBINARY(2) = 0x4144 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +ABCD +~~END~~ + + +-- input type UDT +-- in table babel_4836_replace_image_UDT_t, col 'a', 'b' and 'c' has basetype image +SELECT replace(a, b, c) FROM babel_4836_replace_image_UDT_t +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +-- in table babel_4836_replace_var_UDT_t, col 'a', 'b' and 'c' has basetype varchar +SELECT replace(b, b, c) FROM babel_4836_replace_var_UDT_t +GO +~~START~~ +varchar +gh +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, '12', '06'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString date = '2016-12-21', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern date = '2016-12-21', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @replacement date = '2016-12-21'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @date date = '2016-12-21', @replacement VARCHAR(10) = '06'; +DECLARE @pattern datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @date date = '2016-12-21'; +DECLARE @replacement datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern smalldatetime = '2016-12-21 12:43:10', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern VARCHAR(30) = '2016-12-21 12:43:10', @replacement smalldatetime = '2016-12-21 12:43:10'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern time(4) = '12:10:05.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern VARCHAR(30) = '12:10:05.1237', @replacement time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @replacement datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern datetime2(4) = '1968-10-23 12:45:37.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1237', @replacement datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString decimal = 123456, @pattern decimal = 12, @replacement decimal = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern decimal = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement decimal = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString numeric = 12345.12, @pattern numeric = 12, @replacement numeric = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern numeric = 12.12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement numeric = 12.12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString float = 12345.1, @pattern float = 12, @replacement float = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern float = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement float = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString real = 12345.1, @pattern real = 12, @replacement real = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern real = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement real = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString bigint = 12345678, @pattern bigint = 12, @replacement bigint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bigint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bigint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString int = 12345678, @pattern int = 12, @replacement int = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern int = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement int = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smallint = 12356, @pattern smallint = 12, @replacement smallint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString tinyint = 235, @pattern tinyint = 12, @replacement tinyint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern tinyint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement tinyint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString money = 12356, @pattern money = 12, @replacement money = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern money = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement money = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smallmoney = 12356, @pattern smallmoney = 12, @replacement smallmoney = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallmoney = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallmoney = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString bit = 1, @pattern bit = 1, @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bit = 1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of replace function.)~~ + + +SELECT replace(a, a, a) FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +SELECT replace('a', a, 'a') FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of replace function.)~~ + + +SELECT replace('a', 'a', a) FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of replace function.)~~ + + +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(a, @pattern, @replacement) from babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern xml = CAST ('' AS xml), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geometry = geometry::STGeomFromText('POINT (1 2)', 0), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geography = geography::STGeomFromText('POINT (1 2)', 4326), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geography = geography::STGeomFromText('POINT (1 2)', 4326); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO +~~START~~ +varchar +5A9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(CAST (@inputString AS VARCHAR(50)), CAST (@pattern AS VARCHAR(50)), CAST (@replacement AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO +~~START~~ +varchar +POINT(4 5) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/replicate-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/replicate-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..45ddba01591 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/replicate-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,658 @@ +-- NULL +SELECT replicate(NULL, -2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate(NULL, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate(NULL, 2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate('abc', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate(NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- edge case values for second parameter +SELECT replicate('AbdefGhi', -2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT '|' + replicate('AbdefGhi', 0) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT replicate('AbdefGhi', 2) +GO +~~START~~ +varchar +AbdefGhiAbdefGhi +~~END~~ + + +SELECT replicate('AbdefGhi', 1001) +GO +~~START~~ +varchar +AbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhi +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abc?defghi?? abc?defghi?? abc?defghi?? abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +比??拉莫斯 比??拉莫斯 比??拉莫斯 比??拉莫斯 +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比??拉莫斯 比??拉莫斯 比??拉莫斯 比??拉莫斯 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +比??拉莫斯比??拉莫斯比??拉莫斯比??拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_862_replicate_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_862_replicate_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_862_replicate_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_ci_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +SELECT replicate(a, 4) COLLATE ARABIC_CI_AS FROM babel_862_replicate_arabic_ci_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_cs_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +SELECT replicate(a, 4) COLLATE ARABIC_CS_AS FROM babel_862_replicate_arabic_cs_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_ci_ai +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +SELECT replicate(a, 4) COLLATE ARABIC_CI_AI FROM babel_862_replicate_arabic_ci_ai +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +abc?defghi?? abc?defghi?? abc?defghi?? abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +比??拉莫斯 比??拉莫斯 比??拉莫斯 比??拉莫斯 +~~END~~ + + +-- with table column of type nchar +SELECT replicate(a, 4) FROM babel_862_replicate_t1 +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 +比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abcdefghabcdefghabcdefghabcdefgh +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abcdefghabcdefghabcdefghabcdefgh +~~END~~ + + +-- dependent objects +SELECT * FROM babel_862_replicate_dep_view +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +EXEC babel_862_replicate_dep_proc +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_func() +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_862_replicate_itvf_func() +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_1 +GO +~~START~~ +varchar +abc?defghi?? abc?defghi?? abc?defghi?? abc?defghi?? +比??拉莫斯 比??拉莫斯 比??拉莫斯 比??拉莫斯 +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_2 +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_3 +GO +~~START~~ +varchar +abcdefghi abcdefghi abcdefghi abcdefghi +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_4 +GO +~~START~~ +varchar +abcdefghiabcdefghiabcdefghiabcdefghi +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_5 +GO +~~START~~ +varchar +0x20206162636420200x20206162636420200x20206162636420200x2020616263642020 +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_6 +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_7 +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +-- input type UDT +-- -- in table babel_862_replicate_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT replicate(a, 4) FROM babel_862_replicate_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replicate function.)~~ + + +SELECT replicate(b, 4) FROM babel_862_replicate_UDT +GO +~~START~~ +varchar +abcdefabcdefabcdefabcdef +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +2016-12-212016-12-212016-12-212016-12-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +2016-12-21 00:00:002016-12-21 00:00:002016-12-21 00:00:002016-12-21 00:00:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1955-12-13 12:43:001955-12-13 12:43:001955-12-13 12:43:001955-12-13 12:43:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12:10:05.123712:10:05.123712:10:05.123712:10:05.1237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:001968-10-23 12:45:37.1234 +10:001968-10-23 12:45:37.1234 +10:001968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1968-10-23 12:45:37.12371968-10-23 12:45:37.12371968-10-23 12:45:37.12371968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +123456123456123456123456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345123451234512345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345.112345.112345.112345.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345.112345.112345.112345.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345678123456781234567812345678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345678123456781234567812345678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12356123561235612356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +235235235235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12356.000012356.000012356.000012356.0000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12356.000012356.000012356.000012356.0000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1111 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +SELECT replicate(a, 4) from babel_862_replicate_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replicate function.)~~ + + +-- input datatype text +SELECT replicate(a, 4) FROM babel_862_replicate_text +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT replicate(b, 4) FROM babel_862_replicate_text +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO +~~START~~ +varchar +POINT(1 2)POINT(1 2)POINT(1 2)POINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/replicate-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/replicate-vu-verify.out new file mode 100644 index 00000000000..6b996b79653 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/replicate-vu-verify.out @@ -0,0 +1,658 @@ +-- NULL +SELECT replicate(NULL, -2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate(NULL, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate(NULL, 2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate('abc', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate(NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- edge case values for second parameter +SELECT replicate('AbdefGhi', -2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT '|' + replicate('AbdefGhi', 0) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT replicate('AbdefGhi', 2) +GO +~~START~~ +varchar +AbdefGhiAbdefGhi +~~END~~ + + +SELECT replicate('AbdefGhi', 1001) +GO +~~START~~ +varchar +AbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhi +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abc?defghi?? abc?defghi?? abc?defghi?? abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +比??拉莫斯 比??拉莫斯 比??拉莫斯 比??拉莫斯 +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比??拉莫斯 比??拉莫斯 比??拉莫斯 比??拉莫斯 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +比??拉莫斯比??拉莫斯比??拉莫斯比??拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_862_replicate_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_862_replicate_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_862_replicate_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_ci_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +SELECT replicate(a, 4) COLLATE ARABIC_CI_AS FROM babel_862_replicate_arabic_ci_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_cs_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +SELECT replicate(a, 4) COLLATE ARABIC_CS_AS FROM babel_862_replicate_arabic_cs_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_ci_ai +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +SELECT replicate(a, 4) COLLATE ARABIC_CI_AI FROM babel_862_replicate_arabic_ci_ai +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +abc?defghi?? abc?defghi?? abc?defghi?? abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +比??拉莫斯 比??拉莫斯 比??拉莫斯 比??拉莫斯 +~~END~~ + + +-- with table column of type nchar +SELECT replicate(a, 4) FROM babel_862_replicate_t1 +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 +比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abcdefghabcdefghabcdefghabcdefgh +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abcdefghabcdefghabcdefghabcdefgh +~~END~~ + + +-- dependent objects +SELECT * FROM babel_862_replicate_dep_view +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +EXEC babel_862_replicate_dep_proc +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_func() +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_862_replicate_itvf_func() +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_1 +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 +比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_2 +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_3 +GO +~~START~~ +varchar +abcdefghi abcdefghi abcdefghi abcdefghi +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_4 +GO +~~START~~ +varchar +abcdefghiabcdefghiabcdefghiabcdefghi +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_5 +GO +~~START~~ +varchar + abcd abcd abcd abcd +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_6 +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_7 +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +-- input type UDT +-- -- in table babel_862_replicate_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT replicate(a, 4) FROM babel_862_replicate_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replicate function.)~~ + + +SELECT replicate(b, 4) FROM babel_862_replicate_UDT +GO +~~START~~ +varchar +abcdefabcdefabcdefabcdef +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +2016-12-212016-12-212016-12-212016-12-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +2016-12-21 00:00:002016-12-21 00:00:002016-12-21 00:00:002016-12-21 00:00:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1955-12-13 12:43:001955-12-13 12:43:001955-12-13 12:43:001955-12-13 12:43:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12:10:05.123712:10:05.123712:10:05.123712:10:05.1237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:001968-10-23 12:45:37.1234 +10:001968-10-23 12:45:37.1234 +10:001968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1968-10-23 12:45:37.12371968-10-23 12:45:37.12371968-10-23 12:45:37.12371968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +123456123456123456123456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345123451234512345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345.112345.112345.112345.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345.112345.112345.112345.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345678123456781234567812345678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345678123456781234567812345678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12356123561235612356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +235235235235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12356.000012356.000012356.000012356.0000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12356.000012356.000012356.000012356.0000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1111 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +SELECT replicate(a, 4) from babel_862_replicate_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replicate function.)~~ + + +-- input datatype text +SELECT replicate(a, 4) FROM babel_862_replicate_text +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT replicate(b, 4) FROM babel_862_replicate_text +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO +~~START~~ +varchar +POINT(1 2)POINT(1 2)POINT(1 2)POINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/reverse-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/reverse-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..3aba6abbf8c --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/reverse-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,602 @@ +-- NULL +SELECT reverse(NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- empty string +SELECT reverse('') +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +varchar + ??ihgfed?cba +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +varchar + 斯莫拉??比 +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + 斯莫拉??比 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +varchar +??ihgfed?cba +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +varchar +斯莫拉??比 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_ci_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +SELECT reverse(a) COLLATE CHINESE_PRC_CI_AS FROM babel_4839_reverse_chinese_prc_ci_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_cs_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +SELECT reverse(a) COLLATE CHINESE_PRC_CS_AS FROM babel_4839_reverse_chinese_prc_cs_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_ci_ai +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +SELECT reverse(a) COLLATE CHINESE_PRC_CI_AI FROM babel_4839_reverse_chinese_prc_ci_ai +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT reverse(a) FROM babel_4839_reverse_arabic_ci_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +SELECT reverse(a) COLLATE ARABIC_CI_AS FROM babel_4839_reverse_arabic_ci_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT reverse(a) FROM babel_4839_reverse_arabic_cs_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +SELECT reverse(a) COLLATE ARABIC_CS_AS FROM babel_4839_reverse_arabic_cs_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT reverse(a) FROM babel_4839_reverse_arabic_ci_ai +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +SELECT reverse(a) COLLATE ARABIC_CI_AI FROM babel_4839_reverse_arabic_ci_ai +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar + ??ihgfed?cba +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar + 斯莫拉??比 +~~END~~ + + +-- with table column of type nchar +SELECT reverse(a) FROM babel_4839_reverse_t1 +GO +~~START~~ +nvarchar + 🙂🙂ihgfed🙂cba + 斯莫拉·尔比 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar +斯莫拉·尔比 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT reverse(@inputString) +GO +~~START~~ +varchar +hgfedcba +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT reverse(@inputString) +GO +~~START~~ +varchar +hgfedcba +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4839_reverse_dep_view +GO +~~START~~ +text +??ihgfed?cba +~~END~~ + + +EXEC babel_4839_reverse_dep_proc +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_func() +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_itvf_func() +GO +~~START~~ +text +??ihgfed?cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_1 +GO +~~START~~ +text + ??ihgfed?cba + 斯莫拉??比 +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_2 +GO +~~START~~ +text +??ihgfed?cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_3 +GO +~~START~~ +text + ihgfedcba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_4 +GO +~~START~~ +text +ihgfedcba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_5 +GO +~~START~~ +text +0202463626160202x0 +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_6 +GO +~~START~~ +text +??ihgfed?cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_7 +GO +~~START~~ +text +??ihgfed?cba +~~END~~ + + +-- input type UDT +-- -- in table babel_4839_reverse_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT reverse(a) FROM babel_4839_reverse_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of reverse function.)~~ + + +SELECT reverse(b) FROM babel_4839_reverse_UDT +GO +~~START~~ +varchar +fedcba +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +12-21-6102 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +00:00:00 12-21-6102 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +00:34:21 31-21-5591 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +7321.50:01:21 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +00:01+ 4321.73:54:21 32-01-8691 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +7321.73:54:21 32-01-8691 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +654321 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +54321 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +1.54321 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +1.54321 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +87654321 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +87654321 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +65321 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +532 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +0000.65321 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +0000.65321 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT reverse(@inputString) +GO +~~START~~ +varchar +FF469CF40C00-D24B-110D-68B8-FF9169F6 +~~END~~ + + +SELECT reverse(a) from babel_4839_reverse_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of reverse function.)~~ + + +-- input datatype text +SELECT reverse(a) FROM babel_4839_reverse_text +GO +~~START~~ +varchar +??ihgfed?cba +~~END~~ + + +-- input datatype ntext +SELECT reverse(b) FROM babel_4839_reverse_text +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +FF469CF40C00-D24B-110D-68B8-FF9169F6 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +>ydob/<>/tiurf<>ydob< +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +)2 1(TNIOP +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/reverse-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/reverse-vu-verify.out new file mode 100644 index 00000000000..855705d732a --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/reverse-vu-verify.out @@ -0,0 +1,602 @@ +-- NULL +SELECT reverse(NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- empty string +SELECT reverse('') +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +varchar + ??ihgfed?cba +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +varchar + 斯莫拉??比 +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + 斯莫拉??比 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +varchar +??ihgfed?cba +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +varchar +斯莫拉??比 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_ci_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +SELECT reverse(a) COLLATE CHINESE_PRC_CI_AS FROM babel_4839_reverse_chinese_prc_ci_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_cs_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +SELECT reverse(a) COLLATE CHINESE_PRC_CS_AS FROM babel_4839_reverse_chinese_prc_cs_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_ci_ai +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +SELECT reverse(a) COLLATE CHINESE_PRC_CI_AI FROM babel_4839_reverse_chinese_prc_ci_ai +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT reverse(a) FROM babel_4839_reverse_arabic_ci_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +SELECT reverse(a) COLLATE ARABIC_CI_AS FROM babel_4839_reverse_arabic_ci_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT reverse(a) FROM babel_4839_reverse_arabic_cs_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +SELECT reverse(a) COLLATE ARABIC_CS_AS FROM babel_4839_reverse_arabic_cs_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT reverse(a) FROM babel_4839_reverse_arabic_ci_ai +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +SELECT reverse(a) COLLATE ARABIC_CI_AI FROM babel_4839_reverse_arabic_ci_ai +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar + ??ihgfed?cba +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar + 斯莫拉??比 +~~END~~ + + +-- with table column of type nchar +SELECT reverse(a) FROM babel_4839_reverse_t1 +GO +~~START~~ +nvarchar + 🙂🙂ihgfed🙂cba + 斯莫拉·尔比 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar +斯莫拉·尔比 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT reverse(@inputString) +GO +~~START~~ +varchar +hgfedcba +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT reverse(@inputString) +GO +~~START~~ +varchar +hgfedcba +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4839_reverse_dep_view +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +EXEC babel_4839_reverse_dep_proc +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_func() +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_itvf_func() +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_1 +GO +~~START~~ +nvarchar + 🙂🙂ihgfed🙂cba + 斯莫拉·尔比 +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_2 +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_3 +GO +~~START~~ +varchar + ihgfedcba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_4 +GO +~~START~~ +varchar +ihgfedcba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_5 +GO +~~START~~ +varchar + dcba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_6 +GO +~~START~~ +varchar +??ihgfed?cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_7 +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +-- input type UDT +-- -- in table babel_4839_reverse_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT reverse(a) FROM babel_4839_reverse_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of reverse function.)~~ + + +SELECT reverse(b) FROM babel_4839_reverse_UDT +GO +~~START~~ +varchar +fedcba +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +12-21-6102 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +00:00:00 12-21-6102 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +00:34:21 31-21-5591 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +7321.50:01:21 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +00:01+ 4321.73:54:21 32-01-8691 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +7321.73:54:21 32-01-8691 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +654321 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +54321 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +1.54321 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +1.54321 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +87654321 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +87654321 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +65321 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +532 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +0000.65321 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +0000.65321 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT reverse(@inputString) +GO +~~START~~ +varchar +FF469CF40C00-D24B-110D-68B8-FF9169F6 +~~END~~ + + +SELECT reverse(a) from babel_4839_reverse_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of reverse function.)~~ + + +-- input datatype text +SELECT reverse(a) FROM babel_4839_reverse_text +GO +~~START~~ +varchar +??ihgfed?cba +~~END~~ + + +-- input datatype ntext +SELECT reverse(b) FROM babel_4839_reverse_text +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +FF469CF40C00-D24B-110D-68B8-FF9169F6 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +>ydob/<>/tiurf<>ydob< +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +)2 1(TNIOP +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/right-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/right-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..94d955c4bc5 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/right-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,716 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(25) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT RIGHT(NULL, -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the right function.)~~ + + +SELECT RIGHT(NULL, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT RIGHT(NULL, 2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT RIGHT('abc', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT RIGHT(NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- edge case values for second parameter +SELECT RIGHT('AbdefGhi', -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the right function.)~~ + + +SELECT '|' + RIGHT('AbdefGhi', 0) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT RIGHT('AbdefGhi', 2) +GO +~~START~~ +varchar +hi +~~END~~ + + +SELECT RIGHT('AbdefGhi', 2147483646) +GO +~~START~~ +varchar +AbdefGhi +~~END~~ + + +SELECT RIGHT('AbdefGhi', 2147483650) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- input type char +DECLARE @inputString CHAR(15) = 'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 8) + '|' +GO +~~START~~ +varchar +|ghi?? | +~~END~~ + + +DECLARE @inputString CHAR(15) = '比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) + '|' +GO +~~START~~ +varchar +|比??拉莫斯 | +~~END~~ + + +DECLARE @inputString CHAR(15) = '比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比??拉莫斯 | +~~END~~ + + +DECLARE @inputString CHAR(15) = 'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 50) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 5) +GO +~~START~~ +varchar +ghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +varchar +?拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 50) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_ci_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_4489_right_chinese_prc_ci_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_cs_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_4489_right_chinese_prc_cs_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_ci_ai +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_4489_right_chinese_prc_ci_ai +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_ci_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE ARABIC_CI_AS FROM babel_4489_right_arabic_ci_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_cs_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE ARABIC_CS_AS FROM babel_4489_right_arabic_cs_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_ci_ai +GO +~~START~~ +varchar +تقين +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE ARABIC_CI_AI FROM babel_4489_right_arabic_ci_ai +GO +~~START~~ +varchar +تقين +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(15) = N'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 8) + '|' +GO +~~START~~ +nvarchar +|ghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(15) = N'比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) + '|' +GO +~~START~~ +nvarchar +|比??拉莫斯 | +~~END~~ + + +DECLARE @inputString NCHAR(15) = N'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 50) + '|' +GO +~~START~~ +nvarchar +|abc?defghi?? | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + RIGHT(a, 13) + '|' FROM babel_4489_right_t1 +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂 | +|·拉莫斯 | +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 5) +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +nvarchar +·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 50) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +varchar +efgh +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +varchar +efgh +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_right_dep_view +GO +~~START~~ +text +ghi?? +~~END~~ + + +EXEC babel_4489_right_dep_proc +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4489_right_dep_func() +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4489_right_itvf_func() +GO +~~START~~ +text +ghi?? +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_1 +GO +~~START~~ +text +?? + +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_2 +GO +~~START~~ +text +ghi?? +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_3 +GO +~~START~~ +text + +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_4 +GO +~~START~~ +text +i +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_5 +GO +~~START~~ +text +42020 +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_6 +GO +~~START~~ +text +ghi?? +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_7 +GO +~~START~~ +text +ghi?? +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_right_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT RIGHT(a, 3) FROM babel_4489_right_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of right function.)~~ + + +SELECT RIGHT(b, 3) FROM babel_4489_right_UDT +GO +~~START~~ +varchar +def +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +5.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +5.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +4FF +~~END~~ + + +SELECT RIGHT(a, 5) from babel_4489_right_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of right function.)~~ + + +-- input datatype text +SELECT RIGHT(a, 5) FROM babel_4489_right_text +GO +~~START~~ +varchar +ghi?? +~~END~~ + + +-- input datatype ntext +SELECT RIGHT(b, 5) FROM babel_4489_right_text +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar +4FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar +dy> +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar + 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/right-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/right-vu-verify.out new file mode 100644 index 00000000000..0d822e07f01 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/right-vu-verify.out @@ -0,0 +1,716 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(25) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT RIGHT(NULL, -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the right function.)~~ + + +SELECT RIGHT(NULL, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT RIGHT(NULL, 2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT RIGHT('abc', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT RIGHT(NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- edge case values for second parameter +SELECT RIGHT('AbdefGhi', -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the right function.)~~ + + +SELECT '|' + RIGHT('AbdefGhi', 0) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT RIGHT('AbdefGhi', 2) +GO +~~START~~ +varchar +hi +~~END~~ + + +SELECT RIGHT('AbdefGhi', 2147483646) +GO +~~START~~ +varchar +AbdefGhi +~~END~~ + + +SELECT RIGHT('AbdefGhi', 2147483650) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- input type char +DECLARE @inputString CHAR(15) = 'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 8) + '|' +GO +~~START~~ +varchar +|ghi?? | +~~END~~ + + +DECLARE @inputString CHAR(15) = '比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) + '|' +GO +~~START~~ +varchar +|比??拉莫斯 | +~~END~~ + + +DECLARE @inputString CHAR(15) = '比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比??拉莫斯 | +~~END~~ + + +DECLARE @inputString CHAR(15) = 'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 50) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 5) +GO +~~START~~ +varchar +ghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +varchar +?拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 50) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_ci_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_4489_right_chinese_prc_ci_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_cs_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_4489_right_chinese_prc_cs_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_ci_ai +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_4489_right_chinese_prc_ci_ai +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_ci_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE ARABIC_CI_AS FROM babel_4489_right_arabic_ci_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_cs_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE ARABIC_CS_AS FROM babel_4489_right_arabic_cs_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_ci_ai +GO +~~START~~ +varchar +تقين +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE ARABIC_CI_AI FROM babel_4489_right_arabic_ci_ai +GO +~~START~~ +varchar +تقين +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(15) = N'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 8) + '|' +GO +~~START~~ +nvarchar +|ghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(15) = N'比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) + '|' +GO +~~START~~ +nvarchar +|比??拉莫斯 | +~~END~~ + + +DECLARE @inputString NCHAR(15) = N'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 50) + '|' +GO +~~START~~ +nvarchar +|abc?defghi?? | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + RIGHT(a, 13) + '|' FROM babel_4489_right_t1 +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂 | +|·拉莫斯 | +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 5) +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +nvarchar +·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 50) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +varchar +efgh +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +varchar +efgh +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_right_dep_view +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +EXEC babel_4489_right_dep_proc +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4489_right_dep_func() +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4489_right_itvf_func() +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_1 +GO +~~START~~ +nvarchar +🙂🙂 + +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_2 +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_3 +GO +~~START~~ +varchar + +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_4 +GO +~~START~~ +varchar +i +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_5 +GO +~~START~~ +varchar +bcd +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_6 +GO +~~START~~ +varchar +ghi?? +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_7 +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_right_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT RIGHT(a, 3) FROM babel_4489_right_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of right function.)~~ + + +SELECT RIGHT(b, 3) FROM babel_4489_right_UDT +GO +~~START~~ +varchar +def +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +5.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +5.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +4FF +~~END~~ + + +SELECT RIGHT(a, 5) from babel_4489_right_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of right function.)~~ + + +-- input datatype text +SELECT RIGHT(a, 5) FROM babel_4489_right_text +GO +~~START~~ +varchar +ghi?? +~~END~~ + + +-- input datatype ntext +SELECT RIGHT(b, 5) FROM babel_4489_right_text +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar +4FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar +dy> +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar + 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/rtrim-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/rtrim-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..8a7bf0af644 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/rtrim-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,610 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(50) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT RTRIM(NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| 比??拉莫斯| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比??拉莫斯| +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| 比??拉莫斯| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_ci_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_rtrim_chinese_prc_ci_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_cs_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_rtrim_chinese_prc_cs_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_rtrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_rtrim_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_rtrim_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_rtrim_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| abc?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| 比??拉莫斯| +~~END~~ + + +-- with table column of type nchar +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_t1 +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +| 比尔·拉莫斯| +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯| +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x202061626364656667682020 +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abcdefgh| +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x202061626364656667682020 +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abcdefgh| +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_rtrim_dep_view +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +EXEC babel_4489_rtrim_dep_proc +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_func() +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_itvf_func() +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_1 +GO +~~START~~ +varchar +| abc?defghi??| +| 比??拉莫斯| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_2 +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_3 +GO +~~START~~ +varchar +| abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_4 +GO +~~START~~ +varchar +| abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_5 +GO +~~START~~ +varchar +|0x2020616263642020| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_6 +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_7 +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_rtrim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT RTRIM(a) FROM babel_4489_rtrim_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of rtrim function.)~~ + + +SELECT RTRIM(b) FROM babel_4489_rtrim_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12:10:05.1237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +123456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +SELECT RTRIM(a) from babel_4489_rtrim_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of rtrim function.)~~ + + +-- input datatype text +SELECT RTRIM(a) FROM babel_4489_rtrim_text +GO +~~START~~ +varchar + abc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT RTRIM(b) FROM babel_4489_rtrim_text +GO +~~START~~ +nvarchar + abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +POINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/rtrim-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/rtrim-vu-verify.out new file mode 100644 index 00000000000..ca5eeff5d96 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/rtrim-vu-verify.out @@ -0,0 +1,610 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(50) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT RTRIM(NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| 比??拉莫斯| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比??拉莫斯| +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| 比??拉莫斯| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_ci_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_rtrim_chinese_prc_ci_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_cs_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_rtrim_chinese_prc_cs_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_rtrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_rtrim_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_rtrim_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_rtrim_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| abc?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| 比??拉莫斯| +~~END~~ + + +-- with table column of type nchar +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_t1 +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +| 比尔·拉莫斯| +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯| +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x202061626364656667682020 +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abcdefgh| +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x202061626364656667682020 +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abcdefgh| +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_rtrim_dep_view +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +EXEC babel_4489_rtrim_dep_proc +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_func() +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_itvf_func() +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_1 +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +| 比尔·拉莫斯| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_2 +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_3 +GO +~~START~~ +varchar +| abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_4 +GO +~~START~~ +varchar +| abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_5 +GO +~~START~~ +varchar +| abcd| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_6 +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_7 +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_rtrim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT RTRIM(a) FROM babel_4489_rtrim_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of rtrim function.)~~ + + +SELECT RTRIM(b) FROM babel_4489_rtrim_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12:10:05.1237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +123456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +SELECT RTRIM(a) from babel_4489_rtrim_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of rtrim function.)~~ + + +-- input datatype text +SELECT RTRIM(a) FROM babel_4489_rtrim_text +GO +~~START~~ +varchar + abc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT RTRIM(b) FROM babel_4489_rtrim_text +GO +~~START~~ +nvarchar + abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +POINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/string_agg-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/string_agg-vu-verify.out new file mode 100644 index 00000000000..fe20c1e4b6e --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/string_agg-vu-verify.out @@ -0,0 +1,696 @@ +-- expression as column +SELECT STRING_AGG(a,'-') FROM string_agg_t +GO +~~START~~ +text +c-b-g-a-e-d-h +~~END~~ + + +SELECT STRING_AGG(a,'-') FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +c-a-d-h +b-g-e +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +h-d-c-a +e-g-b +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +h-d-c-a +e-g-b +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +a-c-d-h +b-g-e +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +a-c-h-d +g-b-e +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +a-c-d-h +b-g-e +~~END~~ + + +-- expression as expression of multiple columns +SELECT STRING_AGG(a+b,'-') FROM string_agg_t +GO +~~START~~ +text +cx-by-gu-az-ev-dw-ht +~~END~~ + + +SELECT STRING_AGG(a+b,'-') FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +cx-az-dw-ht +by-gu-ev +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +ht-dw-cx-az +ev-gu-by +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +ht-dw-cx-az +ev-gu-by +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-dw-ht +by-gu-ev +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-ht-dw +gu-by-ev +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-dw-ht +by-gu-ev +~~END~~ + + +-- expression as function +SELECT STRING_AGG(concat(a,b),'-') FROM string_agg_t +GO +~~START~~ +text +cx-by-gu-az-ev-dw-ht-s +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +cx-az-dw-ht +by-gu-ev-s +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +ht-dw-cx-az +s-ev-gu-by +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +ht-dw-cx-az +s-ev-gu-by +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-dw-ht +by-gu-ev-s +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-ht-dw +s-gu-by-ev +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-dw-ht +s-by-gu-ev +~~END~~ + + +-- Delimeter as a function +SELECT STRING_AGG(a, char(10)) FROM string_agg_t +GO +~~START~~ +text +cbgaedh +~~END~~ + + +SELECT STRING_AGG(a, char(10)) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +cadh +bge +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +hdca +egb +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +hdca +egb +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +acdh +bge +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +achd +gbe +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +acdh +bge +~~END~~ + + +-- order by clause on string column +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY a ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +a-c-d-h +b-e-g +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY a DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +h-d-c-a +g-e-b +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY a+b ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-dw-ht +by-ev-gu +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY a+b DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +ht-dw-cx-az +gu-ev-by +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY concat(a,b) ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-dw-ht +by-ev-gu-s +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY concat(a,b) DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +ht-dw-cx-az +s-gu-ev-by +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY a ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +acdh +beg +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY a DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +hdca +geb +~~END~~ + + +-- Batch statements +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g ORDER BY g +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +hdca +egb +~~END~~ + +~~START~~ +text +hdca +egb +~~END~~ + +~~START~~ +text +acdh +bge +~~END~~ + +~~START~~ +text +achd +gbe +~~END~~ + +~~START~~ +text +acdh +bge +~~END~~ + + +-- expression as column with multibyte characters +SELECT STRING_AGG(a,'-') FROM string_agg_multibyte_t +GO +~~START~~ +text +?-莫-?-?-莫 +~~END~~ + + +SELECT STRING_AGG(a,'-') FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +text +?-? +莫-?-莫 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +text +?-? +莫-?-莫 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +text +?-? +莫-?-莫 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +text +?-? +莫-?-莫 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +text +?-? +?-莫-莫 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +text +?-? +莫-?-莫 +~~END~~ + + +-- casting result to NVARCHAR to verify the output +SELECT CAST(STRING_AGG(a,'-') AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t +GO +~~START~~ +nvarchar +😎-莫-😇-尔-莫 +~~END~~ + + +SELECT CAST(STRING_AGG(a,'-') AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +nvarchar +😎-尔 +莫-😇-莫 +~~END~~ + + +SELECT CAST(STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid) AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +nvarchar +😎-尔 +莫-😇-莫 +~~END~~ + + +SELECT CAST(STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid ASC) AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +nvarchar +😎-尔 +莫-😇-莫 +~~END~~ + + +SELECT CAST(STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid DESC) AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +nvarchar +尔-😎 +莫-😇-莫 +~~END~~ + + +SELECT CAST(STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid ASC) AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +nvarchar +尔-😎 +😇-莫-莫 +~~END~~ + + +SELECT CAST(STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid DESC) AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +nvarchar +尔-😎 +莫-😇-莫 +~~END~~ + + +-- expression as column with chinese characters +SELECT STRING_AGG(a,'-') FROM string_agg_chinese_prc_ci_as +GO +~~START~~ +text +莫-尔-拉-比-斯 +~~END~~ + + +SELECT STRING_AGG(a,'-') FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO +~~START~~ +text +莫-比 +尔-拉-斯 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO +~~START~~ +text +比-莫 +斯-拉-尔 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO +~~START~~ +text +比-莫 +斯-拉-尔 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO +~~START~~ +text +莫-比 +尔-拉-斯 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO +~~START~~ +text +莫-比 +拉-尔-斯 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO +~~START~~ +text +莫-比 +尔-拉-斯 +~~END~~ + + +-- expression from a column of a subquery +SELECT STRING_AGG(sbq.b,'-') WITHIN GROUP (ORDER BY g1) FROM (SELECT g1, g2, STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id) as 'b' FROM string_agg_t2 GROUP BY g1, g2) as sbq GROUP BY g2 ORDER BY g2 +GO +~~START~~ +text +b-g-e-d-h +a-c-d-h +~~END~~ + + +SELECT STRING_AGG(sbq.b,'-') WITHIN GROUP (ORDER BY g1 ASC) FROM (SELECT g1, g2, STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id ASC) as 'b' FROM string_agg_t2 GROUP BY g1, g2) as sbq GROUP BY g2 ORDER BY g2 +GO +~~START~~ +text +b-g-e-d-h +a-c-d-h +~~END~~ + + +SELECT STRING_AGG(sbq.b,'-') WITHIN GROUP (ORDER BY g1 DESC) FROM (SELECT g1, g2, STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id DESC) as 'b' FROM string_agg_t2 GROUP BY g1, g2) as sbq GROUP BY g2 ORDER BY g2 +GO +~~START~~ +text +h-d-e-g-b +h-d-c-a +~~END~~ + + +-- Dependent objects +SELECT * FROM string_agg_dep_v1 +GO +~~START~~ +text +c-b-g-a-e-d-h +~~END~~ + + +EXEC string_agg_dep_p1 +GO +~~START~~ +text +c-b-g-a-e-d-h +~~END~~ + + +SELECT dbo.string_agg_dep_f1() +GO +~~START~~ +nvarchar +c-b-g-a-e-d-h +~~END~~ + + +SELECT * FROM string_agg_dep_v2 +GO +~~START~~ +text +b-g-e +c-a-d-h +~~END~~ + + +EXEC string_agg_dep_p2 +GO +~~START~~ +text +b-g-e +c-a-d-h +~~END~~ + + +SELECT * FROM dbo.string_agg_dep_f2() +GO +~~START~~ +text +b-g-e +c-a-d-h +~~END~~ + + +SELECT * FROM string_agg_dep_v3 +GO +~~START~~ +text +h-d-c-a +e-g-b +~~END~~ + + +EXEC string_agg_dep_p3 +GO +~~START~~ +text +h-d-c-a +e-g-b +~~END~~ + + +SELECT * FROM dbo.string_agg_dep_f3() +GO +~~START~~ +text +h-d-c-a +e-g-b +~~END~~ + + +-- dependent object trigger +INSERT INTO string_agg_school_details (classID, rollID, studentName) +VALUES (2, 3, 'StudentF'); +GO +~~START~~ +int#!#text +1#!#StudentA, StudentB, StudentC +2#!#StudentD, StudentE, StudentF +~~END~~ + +~~ROW COUNT: 1~~ + + +UPDATE string_agg_school_details +SET studentName = 'StudentG' +WHERE classID = 2 AND rollID = 3; +GO +~~START~~ +int#!#text +1#!#StudentA, StudentB, StudentC +2#!#StudentD, StudentE, StudentG +~~END~~ + +~~ROW COUNT: 1~~ + + +DELETE FROM string_agg_school_details +WHERE classID = 1 AND rollID = 2; +GO +~~START~~ +int#!#text +1#!#StudentA, StudentC +2#!#StudentD, StudentE, StudentG +~~END~~ + +~~ROW COUNT: 1~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/stuff-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/stuff-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..e9ad4873877 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/stuff-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,2691 @@ +-- NULL +SELECT stuff(NULL, 2, 1, 'ab') +GO +~~START~~ +varchar + +~~END~~ + +SELECT stuff('ab', 2, 1, NULL) +GO +~~START~~ +varchar +a +~~END~~ + +SELECT stuff('ab', NULL, 1, 'bc') +GO +~~START~~ +varchar + +~~END~~ + +SELECT stuff('ab', 2, NULL, 'bc') +GO +~~START~~ +varchar + +~~END~~ + +SELECT stuff('ab', NULL, '1', 'bc') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('ab', '2', NULL, 'bc') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('ab', NULL, NULL, 'bc') +GO +~~START~~ +varchar + +~~END~~ + + +-- Different no. of arguments +SELECT stuff('abc', 1, 2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The stuff function requires 4 arguments)~~ + + +SELECT stuff('abc', 1, 1, 'xy', 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The stuff function requires 4 arguments)~~ + + +-- edge case values for second parameter +SELECT stuff('AbdefGhi', 0, 1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT '|' + stuff('AbdefGhi', -1, 1, 'xy') + '|' +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 1, 1, 'xy') +GO +~~START~~ +varchar +xybdefGhi +~~END~~ + + +SELECT stuff('AbdefGhi', 8, 1, 'xy') +GO +~~START~~ +varchar +AbdefGhxy +~~END~~ + + +SELECT stuff('AbdefGhi', 9, 1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 2147483648, 1, 'xy') +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- edge case values for third parameter +SELECT stuff('AbdefGhi', 1, 0, 'xy') +GO +~~START~~ +varchar +xyAbdefGhi +~~END~~ + + +SELECT stuff('AbdefGhi', 8, 0, 'xy') +GO +~~START~~ +varchar +AbdefGhxyi +~~END~~ + + +SELECT stuff('AbdefGhi', 1, -1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 8, -1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 2, 9, 'xy') +GO +~~START~~ +varchar +Axy +~~END~~ + + +SELECT stuff('AbdefGhi', 2, 2147483648, 'xy') +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +axyz??wuytgdy? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比??拉?比 斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比??拉?比 斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比??拉·比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比??拉?比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比??ef斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比??ef斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varchar +比??拉?比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +varchar +比拉?比 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比??拉?比 斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??拉?比 斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??拉·比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比??拉·比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比??ef斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比??ef斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比??拉·比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比拉·比 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi🙂🙂 +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +SELECT stuff('abc🙂defghi🙂🙂', 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +axyz??wuytgdy? +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比??拉?比 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉?比 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比??拉?比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比??ef斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比??ef斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varchar +比??拉?比斯 +~~END~~ + +SELECT stuff('比尔·拉莫斯', 4, 2, '拉·比') +GO +~~START~~ +varchar +比??拉?比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +varchar +比拉?比 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉?比 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉?比 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +SELECT stuff('比尔·拉莫斯', 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比拉·比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CI_AS FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CS_AS FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CS_AS FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CI_AI FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AI FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CI_AS FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CI_AS FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CS_AS FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CS_AS FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CI_AI FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CI_AI FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +axyz🙂🙂wuytgdy🙂 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比??拉?比 斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比??拉?比 斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比??拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比??拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比??ef斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比??ef斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +nvarchar +比??拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +nvarchar +比拉·比 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??拉?比 斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??拉?比 斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??ef斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??ef斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比拉·比 +~~END~~ + + +-- with table column of type nchar +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_t1 +GO +~~START~~ +nvarchar +abcabc🙂defghi🙂🙂 efghi🙂🙂 +比尔·比尔·拉莫斯 斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +axyz🙂🙂wuytgdy🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉?比 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉?比 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +nvarchar +比拉·比 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉?比 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉?比 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比拉·比 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, 0x6566) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varbinary +6162639D663F94E4666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: collations are not supported by type varbinary)~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 0, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 13, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, -1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, 15, 0x6566) +GO +~~START~~ +varbinary +616566 +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, 0x6566) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varbinary +6162639D663F94E4666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: collations are not supported by type varbinary)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 0, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 13, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, -1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, 15, 0x6566) +GO +~~START~~ +varbinary +616566 +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4838_stuff_dep_view +GO +~~START~~ +text +abcxyz??wuytgdy?efghi?? +~~END~~ + + +EXEC babel_4838_stuff_dep_proc +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_func() +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4838_stuff_itvf_func() +GO +~~START~~ +text +abcxyz??wuytgdy?efghi?? +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_1 +GO +~~START~~ +text +abcxyz??wuytgdy?efghi?? +比??xyz??wuytgdy?斯 +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_2 +GO +~~START~~ +text +abcxyz??wuytgdy?efghi?? +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_3 +GO +~~START~~ +text +abcxyz??wuytgdy?fghi +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_4 +GO +~~START~~ +text +abcxyz??wuytgdy?fghi +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_5 +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: return type mismatch in function declared to return varbinary)~~ + + +-- input type UDT +-- in table babel_4838_stuff_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_UDT +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of stuff function.)~~ + + +SELECT stuff(b, 4, 2, b) FROM babel_4838_stuff_UDT +GO +~~START~~ +varchar +abcabcdeff +~~END~~ + + +-- other different datatypes, should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 4 of stuff function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of stuff function.)~~ + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of stuff function.)~~ + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of stuff function.)~~ + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString decimal = 123456; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString decimal = 123456; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString decimal = 123456; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString decimal = 123456; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString numeric = 12345.12; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString numeric = 12345.12; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString numeric = 12345.12; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString float = 12345.1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString float = 12345.1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString float = 12345.1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString float = 12345.1; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString real = 12345.1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString real = 12345.1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString real = 12345.1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString real = 12345.1; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString bigint = 12345678; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString bigint = 12345678; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString bigint = 12345678; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString bigint = 12345678; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString int = 12345678; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString int = 12345678; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 4 of stuff function.)~~ + +DECLARE @inputString int = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar +abcdysd +~~END~~ + +DECLARE @inputString int = 12345678; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString CHAR(25) = 'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bpchar is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString CHAR(25) = 'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bpchar is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString VARCHAR(25) = 'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString VARCHAR(25) = 'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 3 of stuff function.)~~ + + +DECLARE @inputString smallint = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString smallint = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 4 of stuff function.)~~ + +DECLARE @inputString smallint = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar +abcdysd +~~END~~ + +DECLARE @inputString smallint = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString NCHAR(25) = N'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "nchar" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString NCHAR(25) = N'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "nchar" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString NVARCHAR(25) = N'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type nvarchar is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString NVARCHAR(25) = N'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type nvarchar is invalid for argument 3 of stuff function.)~~ + + +DECLARE @inputString tinyint = 235; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString tinyint = 235; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 4 of stuff function.)~~ + +DECLARE @inputString tinyint = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar +abcdysd +~~END~~ + +DECLARE @inputString tinyint = 235; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 3 of stuff function.)~~ + + +DECLARE @inputString money = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString money = 12356; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString money = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString money = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString smallmoney = 12356; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString smallmoney = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString smallmoney = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString bit = 1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString bit = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString bit = 1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString bit = 1; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 4 of stuff function.)~~ + + +SELECT stuff(a, 4, 2, 'abcd') from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of stuff function.)~~ + +SELECT stuff('abcd', a, 2, 'abcd') from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('abcd', 4, a, 'abcd') from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('abcd', 4, 2, a) from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 4 of stuff function.)~~ + + +-- input datatype text +SELECT stuff(a, 4, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~START~~ +varchar +abcabcdefghi?? +~~END~~ + +SELECT stuff('abcd', a, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('abcd', 4, a, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('abcd', 4, 2, a) FROM babel_4838_stuff_text +GO +~~START~~ +varchar +abcabc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT stuff(b, 4, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~START~~ +nvarchar +abcabcdefghi🙂🙂 +~~END~~ + +SELECT stuff('abcd', b, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type ntext is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('abcd', 4, b, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type ntext is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('abcd', 4, 2, b) FROM babel_4838_stuff_text +GO +~~START~~ +nvarchar +abcabc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +~~START~~ +varchar +6F9abcd19FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +abc6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +abc +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +~~START~~ +varchar +POIabcdT(1 2) +~~END~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +abcPOINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/stuff-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/stuff-vu-verify.out new file mode 100644 index 00000000000..ce7ec93466b --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/stuff-vu-verify.out @@ -0,0 +1,2692 @@ +-- NULL +SELECT stuff(NULL, 2, 1, 'ab') +GO +~~START~~ +varchar + +~~END~~ + +SELECT stuff('ab', 2, 1, NULL) +GO +~~START~~ +varchar +a +~~END~~ + +SELECT stuff('ab', NULL, 1, 'bc') +GO +~~START~~ +varchar + +~~END~~ + +SELECT stuff('ab', 2, NULL, 'bc') +GO +~~START~~ +varchar + +~~END~~ + +SELECT stuff('ab', NULL, '1', 'bc') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('ab', '2', NULL, 'bc') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('ab', NULL, NULL, 'bc') +GO +~~START~~ +varchar + +~~END~~ + + +-- Different no. of arguments +SELECT stuff('abc', 1, 2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The stuff function requires 4 arguments)~~ + + +SELECT stuff('abc', 1, 1, 'xy', 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The stuff function requires 4 arguments)~~ + + +-- edge case values for second parameter +SELECT stuff('AbdefGhi', 0, 1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT '|' + stuff('AbdefGhi', -1, 1, 'xy') + '|' +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 1, 1, 'xy') +GO +~~START~~ +varchar +xybdefGhi +~~END~~ + + +SELECT stuff('AbdefGhi', 8, 1, 'xy') +GO +~~START~~ +varchar +AbdefGhxy +~~END~~ + + +SELECT stuff('AbdefGhi', 9, 1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 2147483648, 1, 'xy') +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- edge case values for third parameter +SELECT stuff('AbdefGhi', 1, 0, 'xy') +GO +~~START~~ +varchar +xyAbdefGhi +~~END~~ + + +SELECT stuff('AbdefGhi', 8, 0, 'xy') +GO +~~START~~ +varchar +AbdefGhxyi +~~END~~ + + +SELECT stuff('AbdefGhi', 1, -1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 8, -1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 2, 9, 'xy') +GO +~~START~~ +varchar +Axy +~~END~~ + + +SELECT stuff('AbdefGhi', 2, 2147483648, 'xy') +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +axyz??wuytgdy? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比??拉?比 斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比??拉?比 斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比??拉·比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比??拉?比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比??ef斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比??ef斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varchar +比??拉?比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +varchar +比拉?比 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比??拉?比 斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??拉?比 斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??拉·比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比??拉·比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比??ef斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比??ef斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比??拉·比斯 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比拉·比 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi🙂🙂 +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +SELECT stuff('abc🙂defghi🙂🙂', 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +axyz??wuytgdy? +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比??拉?比 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉?比 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比??拉?比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比??ef斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +比??ef斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varchar +比??拉?比斯 +~~END~~ + +SELECT stuff('比尔·拉莫斯', 4, 2, '拉·比') +GO +~~START~~ +varchar +比??拉?比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +varchar +比拉?比 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉?比 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉?比 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +SELECT stuff('比尔·拉莫斯', 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比拉·比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CI_AS FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CS_AS FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CS_AS FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CI_AI FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AI FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CI_AS FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CI_AS FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CS_AS FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CS_AS FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CI_AI FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CI_AI FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +axyz🙂🙂wuytgdy🙂 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比??拉?比 斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比??拉?比 斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比??拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比??拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比??ef斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比??ef斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +nvarchar +比??拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +nvarchar +比拉·比 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??拉?比 斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??拉?比 斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??ef斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??ef斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比??拉·比斯 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比拉·比 +~~END~~ + + +-- with table column of type nchar +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_t1 +GO +~~START~~ +nvarchar +abcabc🙂defghi🙂🙂 efghi🙂🙂 +比尔·比尔·拉莫斯 斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +axyz🙂🙂wuytgdy🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉?比 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉?比 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +nvarchar +比拉·比 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉?比 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉?比 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比拉·比 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, 0x6566) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varbinary +6162639D663F94E4666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: collations are not supported by type varbinary)~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 0, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 13, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, -1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, 15, 0x6566) +GO +~~START~~ +varbinary +616566 +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, 0x6566) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varbinary +6162639D663F94E4666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: collations are not supported by type varbinary)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 0, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 13, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, -1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, 15, 0x6566) +GO +~~START~~ +varbinary +616566 +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4838_stuff_dep_view +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +EXEC babel_4838_stuff_dep_proc +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_func() +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4838_stuff_itvf_func() +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_1 +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +比尔·xyz🙂🙂wuytgdy🙂斯 +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_2 +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_3 +GO +~~START~~ +varchar +abcxyz??wuytgdy?fghi +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_4 +GO +~~START~~ +varchar +abcxyz??wuytgdy?fghi +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_5 +GO +~~START~~ +varbinary +2020616566642020 +~~END~~ + + +-- input type UDT +-- in table babel_4838_stuff_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_UDT +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of stuff function.)~~ + + +SELECT stuff(b, 4, 2, b) FROM babel_4838_stuff_UDT +GO +~~START~~ +varchar +abcabcdeff +~~END~~ + + +-- other different datatypes, should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 4 of stuff function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of stuff function.)~~ + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of stuff function.)~~ + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of stuff function.)~~ + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString decimal = 123456; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString decimal = 123456; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString decimal = 123456; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString decimal = 123456; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString numeric = 12345.12; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString numeric = 12345.12; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString numeric = 12345.12; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString float = 12345.1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString float = 12345.1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString float = 12345.1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString float = 12345.1; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString real = 12345.1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString real = 12345.1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString real = 12345.1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString real = 12345.1; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString bigint = 12345678; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString bigint = 12345678; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString bigint = 12345678; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString bigint = 12345678; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString int = 12345678; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString int = 12345678; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 4 of stuff function.)~~ + +DECLARE @inputString int = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar +abcdysd +~~END~~ + +DECLARE @inputString int = 12345678; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString CHAR(25) = 'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bpchar is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString CHAR(25) = 'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bpchar is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString VARCHAR(25) = 'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString VARCHAR(25) = 'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 3 of stuff function.)~~ + + +DECLARE @inputString smallint = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString smallint = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 4 of stuff function.)~~ + +DECLARE @inputString smallint = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar +abcdysd +~~END~~ + +DECLARE @inputString smallint = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString NCHAR(25) = N'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "nchar" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString NCHAR(25) = N'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "nchar" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString NVARCHAR(25) = N'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type nvarchar is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString NVARCHAR(25) = N'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type nvarchar is invalid for argument 3 of stuff function.)~~ + + +DECLARE @inputString tinyint = 235; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString tinyint = 235; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 4 of stuff function.)~~ + +DECLARE @inputString tinyint = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar +abcdysd +~~END~~ + +DECLARE @inputString tinyint = 235; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 3 of stuff function.)~~ + + +DECLARE @inputString money = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString money = 12356; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString money = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString money = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString smallmoney = 12356; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString smallmoney = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString smallmoney = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString bit = 1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString bit = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString bit = 1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString bit = 1; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 4 of stuff function.)~~ + + +SELECT stuff(a, 4, 2, 'abcd') from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of stuff function.)~~ + +SELECT stuff('abcd', a, 2, 'abcd') from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('abcd', 4, a, 'abcd') from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('abcd', 4, 2, a) from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 4 of stuff function.)~~ + + +-- input datatype text +SELECT stuff(a, 4, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~START~~ +varchar +abcabcdefghi?? +~~END~~ + +SELECT stuff('abcd', a, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('abcd', 4, a, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('abcd', 4, 2, a) FROM babel_4838_stuff_text +GO +~~START~~ +varchar +abcabc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT stuff(b, 4, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~START~~ +nvarchar +abcabcdefghi🙂🙂 +~~END~~ + +SELECT stuff('abcd', b, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type ntext is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('abcd', 4, b, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type ntext is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('abcd', 4, 2, b) FROM babel_4838_stuff_text +GO +~~START~~ +nvarchar +abcabc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +~~START~~ +varchar +6F9abcd19FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +abc6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +abc +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +~~START~~ +varchar +POIabcdT(1 2) +~~END~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +abcPOINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/substring-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/substring-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..df00300dd89 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/substring-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,1113 @@ +-- NULL +SELECT substring(NULL, 2, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +SELECT substring(CAST(NULL AS int), 2, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type int is invalid for argument 1 of substring function.)~~ + + +SELECT substring(CAST(NULL AS varbinary), 2, 1) +GO +~~START~~ +varbinary + +~~END~~ + + +SELECT substring(CAST(NULL AS decimal), 2, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type decimal is invalid for argument 1 of substring function.)~~ + + +SELECT substring('abc', NULL, 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', CAST(NULL AS text), 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 2 of substring function.)~~ + + +SELECT substring('abc', CAST(NULL AS varchar), 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', CAST(NULL AS int), 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', 2, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', 2, CAST(NULL AS text)) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 3 of substring function.)~~ + + +SELECT substring('abc', 2, CAST(NULL AS varchar)) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', 2, CAST(NULL AS int)) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring(NULL, 2, NULL) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +SELECT substring('abc', NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring(NULL, NULL, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +SELECT substring(NULL, NULL, NULL) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +-- Different no. of arguments +SELECT substring('abc', 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.substring function requires 3 arguments)~~ + + +SELECT substring('abc', 1, 1, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.substring function requires 3 arguments)~~ + + +-- edge case values for second parameter +SELECT substring('AbdefGhi', 0, 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT '|' + substring('AbdefGhi', -1, 1) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT substring('AbdefGhi', 1, 1) +GO +~~START~~ +varchar +A +~~END~~ + + +SELECT substring('AbdefGhi', 8, 1) +GO +~~START~~ +varchar +i +~~END~~ + + +SELECT substring('AbdefGhi', 9, 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('AbdefGhi', 2147483648, 1) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- edge case values for third parameter +SELECT substring('AbdefGhi', 1, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('AbdefGhi', 8, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('AbdefGhi', 1, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +SELECT substring('AbdefGhi', 8, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +SELECT substring('AbdefGhi', 2, 9) +GO +~~START~~ +varchar +bdefGhi +~~END~~ + + +SELECT substring('AbdefGhi', 2, 2147483648) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +?d +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +拉莫 +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 0, 1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 13, 1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 2, 15) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +拉莫 +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +?d +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +拉莫 +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 0, 1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 13, 1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 2, 15) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +拉莫 +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_ci_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CI_AS FROM babel_3658_substring_chinese_prc_ci_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_cs_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CS_AS FROM babel_3658_substring_chinese_prc_cs_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_ci_ai +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CI_AI FROM babel_3658_substring_chinese_prc_ci_ai +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_ci_as +GO +~~START~~ +varchar +ه +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE ARABIC_CI_AS FROM babel_3658_substring_arabic_ci_as +GO +~~START~~ +varchar +ه +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_cs_as +GO +~~START~~ +varchar +ه +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE ARABIC_CS_AS FROM babel_3658_substring_arabic_cs_as +GO +~~START~~ +varchar +ه +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_ci_ai +GO +~~START~~ +varchar +ه +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE ARABIC_CI_AI FROM babel_3658_substring_arabic_ci_ai +GO +~~START~~ +varchar +ه +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +?d +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +拉莫 +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +-- with table column of type nchar +SELECT substring(a, 4, 2) FROM babel_3658_substring_t1 +GO +~~START~~ +nvarchar +🙂d +拉莫 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +🙂d +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +拉莫 +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varbinary +6465 +~~END~~ + +~~START~~ +varbinary + +~~END~~ + +~~START~~ +varbinary + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varbinary +6465 +~~END~~ + +~~START~~ +varbinary + +~~END~~ + +~~START~~ +varbinary + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +SELECT substring(0x0a0b0c, 1,2), substring(0x0a0b0c,2,1) +GO +~~START~~ +varbinary#!#varbinary +0A0B#!#0B +~~END~~ + + +-- dependent objects +SELECT * FROM babel_3658_substring_dep_view +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +EXEC babel_3658_substring_dep_proc +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_func() +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_itvf_func() +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_1 +GO +~~START~~ +nvarchar +🙂 +拉 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_2 +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_3 +GO +~~START~~ +varchar +d +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_4 +GO +~~START~~ +varchar +d +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_5 +GO +~~START~~ +varchar +0 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_6 +GO +~~START~~ +varchar +? +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_7 +GO +~~START~~ +varchar +? +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_8 +GO +~~START~~ +varchar +0 +~~END~~ + + +-- input type UDT +-- in table babel_3658_substring_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT substring(a, 4, 2) FROM babel_3658_substring_UDT +GO +~~START~~ +varbinary +6465 +~~END~~ + + +SELECT substring(b, 4, 2) FROM babel_3658_substring_UDT +GO +~~START~~ +varchar +de +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of substring function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString decimal = 123456; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type decimal is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString float = 12345.1; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type float is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString real = 12345.1; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString bigint = 12345678; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString int = 12345678; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type int is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString smallint = 12356; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString tinyint = 235; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString money = 12356; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString bit = 1; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bit is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of substring function.)~~ + + +SELECT substring(a, 4, 2) from babel_3658_substring_image; +GO +~~START~~ +varbinary +3631 +~~END~~ + +SELECT substring(a, 0, 1) from babel_3658_substring_image; +GO +~~START~~ +varbinary + +~~END~~ + +SELECT substring(a, 13, 1) from babel_3658_substring_image; +GO +~~START~~ +varbinary +36 +~~END~~ + +SELECT substring(a, 2, -1) from babel_3658_substring_image; +GO +~~START~~ +varbinary +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +SELECT substring(a, 2, 15) from babel_3658_substring_image; +GO +~~START~~ +varbinary +463936313946462D384238362D4430 +~~END~~ + + +-- input datatype text +SELECT substring(a, 4, 2) FROM babel_3658_substring_text +GO +~~START~~ +varchar +?d +~~END~~ + +SELECT substring(a, 0, 1) from babel_3658_substring_text; +GO +~~START~~ +varchar + +~~END~~ + +SELECT substring(a, 13, 1) from babel_3658_substring_text; +GO +~~START~~ +varchar + +~~END~~ + +SELECT substring(a, 2, -1) from babel_3658_substring_text; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +SELECT substring(a, 2, 15) from babel_3658_substring_text; +GO +~~START~~ +varchar +bc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT substring(b, 4, 2) FROM babel_3658_substring_text +GO +~~START~~ +nvarchar +🙂d +~~END~~ + +SELECT substring(b, 0, 1) from babel_3658_substring_text; +GO +~~START~~ +nvarchar + +~~END~~ + +SELECT substring(b, 13, 1) from babel_3658_substring_text; +GO +~~START~~ +nvarchar + +~~END~~ + +SELECT substring(b, 2, -1) from babel_3658_substring_text; +GO +~~START~~ +nvarchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +SELECT substring(b, 2, 15) from babel_3658_substring_text; +GO +~~START~~ +nvarchar +bc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO +~~START~~ +varchar +6 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO +~~START~~ +varchar +d +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO +~~START~~ +varchar +N +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/substring-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/substring-vu-verify.out new file mode 100644 index 00000000000..63af8f789bb --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/substring-vu-verify.out @@ -0,0 +1,1269 @@ +-- NULL +SELECT substring(NULL, 2, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +SELECT substring(CAST(NULL AS int), 2, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type int is invalid for argument 1 of substring function.)~~ + + +SELECT substring(CAST(NULL AS varbinary), 2, 1) +GO +~~START~~ +varbinary + +~~END~~ + + +SELECT substring(CAST(NULL AS decimal), 2, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type decimal is invalid for argument 1 of substring function.)~~ + + +SELECT substring('abc', NULL, 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', CAST(NULL AS text), 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 2 of substring function.)~~ + + +SELECT substring('abc', CAST(NULL AS varchar), 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', CAST(NULL AS int), 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', 2, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', 2, CAST(NULL AS text)) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 3 of substring function.)~~ + + +SELECT substring('abc', 2, CAST(NULL AS varchar)) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', 2, CAST(NULL AS int)) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring(NULL, 2, NULL) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +SELECT substring('abc', NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring(NULL, NULL, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +SELECT substring(NULL, NULL, NULL) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +-- Different no. of arguments +SELECT substring('abc', 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.substring function requires 3 arguments)~~ + + +SELECT substring('abc', 1, 1, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.substring function requires 3 arguments)~~ + + +-- edge case values for second parameter +SELECT substring('AbdefGhi', 0, 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT '|' + substring('AbdefGhi', -1, 1) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT substring('AbdefGhi', 1, 1) +GO +~~START~~ +varchar +A +~~END~~ + + +SELECT substring('AbdefGhi', 8, 1) +GO +~~START~~ +varchar +i +~~END~~ + + +SELECT substring('AbdefGhi', 9, 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('AbdefGhi', 2147483648, 1) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- edge case values for third parameter +SELECT substring('AbdefGhi', 1, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('AbdefGhi', 8, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('AbdefGhi', 1, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +SELECT substring('AbdefGhi', 8, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +SELECT substring('AbdefGhi', 2, 9) +GO +~~START~~ +varchar +bdefGhi +~~END~~ + + +SELECT substring('AbdefGhi', 2, 2147483648) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +varchar +?d +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +bc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +varchar +拉莫 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +??拉莫斯 +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +拉莫 +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +??拉莫斯 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +varchar +?d +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +bc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +varchar +拉莫 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +??拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +拉莫 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_ci_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CI_AS FROM babel_3658_substring_chinese_prc_ci_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_cs_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CS_AS FROM babel_3658_substring_chinese_prc_cs_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_ci_ai +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CI_AI FROM babel_3658_substring_chinese_prc_ci_ai +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_ci_as +GO +~~START~~ +varchar +ه +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE ARABIC_CI_AS FROM babel_3658_substring_arabic_ci_as +GO +~~START~~ +varchar +ه +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_cs_as +GO +~~START~~ +varchar +ه +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE ARABIC_CS_AS FROM babel_3658_substring_arabic_cs_as +GO +~~START~~ +varchar +ه +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_ci_ai +GO +~~START~~ +varchar +ه +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE ARABIC_CI_AI FROM babel_3658_substring_arabic_ci_ai +GO +~~START~~ +varchar +ه +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +nvarchar +?d +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +bc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +nvarchar +拉莫 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +??拉莫斯 +~~END~~ + + +-- with table column of type nchar +SELECT substring(a, 4, 2) FROM babel_3658_substring_t1 +GO +~~START~~ +nvarchar +🙂d +拉莫 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +nvarchar +🙂d +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +bc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +nvarchar +拉莫 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +尔·拉莫斯 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +varbinary +6465 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varbinary +626364656667680000 +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +varbinary +6465 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varbinary +62636465666768 +~~END~~ + + +SELECT substring(0x0a0b0c, 1,2), substring(0x0a0b0c,2,1) +GO +~~START~~ +varbinary#!#varbinary +0A0B#!#0B +~~END~~ + + +-- dependent objects +SELECT * FROM babel_3658_substring_dep_view +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +EXEC babel_3658_substring_dep_proc +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_func() +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_itvf_func() +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_1 +GO +~~START~~ +nvarchar +🙂 +拉 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_2 +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_3 +GO +~~START~~ +varchar +d +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_4 +GO +~~START~~ +varchar +d +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_5 +GO +~~START~~ +varbinary +62 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_6 +GO +~~START~~ +varchar +? +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_7 +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_8 +GO +~~START~~ +varbinary +62 +~~END~~ + + +-- input type UDT +-- in table babel_3658_substring_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT substring(a, 4, 2) FROM babel_3658_substring_UDT +GO +~~START~~ +varbinary +6465 +~~END~~ + + +SELECT substring(b, 4, 2) FROM babel_3658_substring_UDT +GO +~~START~~ +varchar +de +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of substring function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString decimal = 123456; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type decimal is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString float = 12345.1; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type float is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString real = 12345.1; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString bigint = 12345678; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString int = 12345678; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type int is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString smallint = 12356; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString tinyint = 235; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString money = 12356; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString bit = 1; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bit is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of substring function.)~~ + + +SELECT substring(a, 4, 2) from babel_3658_substring_image; +GO +~~START~~ +varbinary +3631 +~~END~~ + +SELECT substring(a, 0, 1) from babel_3658_substring_image; +GO +~~START~~ +varbinary + +~~END~~ + +SELECT substring(a, 13, 1) from babel_3658_substring_image; +GO +~~START~~ +varbinary +36 +~~END~~ + +SELECT substring(a, 2, -1) from babel_3658_substring_image; +GO +~~START~~ +varbinary +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +SELECT substring(a, 2, 15) from babel_3658_substring_image; +GO +~~START~~ +varbinary +463936313946462D384238362D4430 +~~END~~ + + +-- input datatype text +SELECT substring(a, 4, 2) FROM babel_3658_substring_text +GO +~~START~~ +varchar +?d +~~END~~ + +SELECT substring(a, 0, 1) from babel_3658_substring_text; +GO +~~START~~ +varchar + +~~END~~ + +SELECT substring(a, 13, 1) from babel_3658_substring_text; +GO +~~START~~ +varchar + +~~END~~ + +SELECT substring(a, 2, -1) from babel_3658_substring_text; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +SELECT substring(a, 2, 15) from babel_3658_substring_text; +GO +~~START~~ +varchar +bc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT substring(b, 4, 2) FROM babel_3658_substring_text +GO +~~START~~ +nvarchar +🙂d +~~END~~ + +SELECT substring(b, 0, 1) from babel_3658_substring_text; +GO +~~START~~ +nvarchar + +~~END~~ + +SELECT substring(b, 13, 1) from babel_3658_substring_text; +GO +~~START~~ +nvarchar + +~~END~~ + +SELECT substring(b, 2, -1) from babel_3658_substring_text; +GO +~~START~~ +nvarchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +SELECT substring(b, 2, 15) from babel_3658_substring_text; +GO +~~START~~ +nvarchar +bc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO +~~START~~ +varchar +6 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO +~~START~~ +varchar +d +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO +~~START~~ +varchar +N +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/sys-systypes-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/sys-systypes-vu-verify.out index 27f874fea29..f1fb10d6c06 100644 --- a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/sys-systypes-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/sys-systypes-vu-verify.out @@ -107,9 +107,10 @@ int SELECT count(*) FROM sys_systypes_db.dbo.systypes WHERE name = 'sys_systypes_type'; GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: Cross-DB system view query is not currently supported in Babelfish.)~~ +~~START~~ +int +1 +~~END~~ CREATE TYPE sys_systypes_type FROM int; @@ -142,9 +143,10 @@ sys_systypes_type#!#0#!#4#!#0#!#1#!##!# SELECT name, status, length, variable, allownulls, printfmt, collation FROM sys_systypes_db.dbo.systypes WHERE name = 'sys_systypes_type'; GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: Cross-DB system view query is not currently supported in Babelfish.)~~ +~~START~~ +varchar#!#tinyint#!#smallint#!#bit#!#bit#!#varchar#!#varchar +sys_systypes_type#!#0#!#4#!#0#!#1#!##!# +~~END~~ DROP TYPE sys_systypes_type; diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/test_like_for_AI-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/test_like_for_AI-vu-verify.out index 1641a5443a1..aae03a813d3 100644 --- a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/test_like_for_AI-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/test_like_for_AI-vu-verify.out @@ -1746,7 +1746,7 @@ Hi café SELECT UPPER((SELECT col FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%oNo')); GO ~~START~~ -text +nvarchar TELÉFONO ~~END~~ @@ -4356,7 +4356,7 @@ Hi café SELECT UPPER((SELECT col FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%no')); GO ~~START~~ -text +nvarchar JALAPEÑO ~~END~~ diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/test_search_path.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/test_search_path.out new file mode 100644 index 00000000000..84de501d9a9 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/test_search_path.out @@ -0,0 +1,212 @@ +CREATE TABLE babelfish_migration_mode_table (id_num INT IDENTITY(1,1), mig_mode VARCHAR(10)) +GO +INSERT INTO babelfish_migration_mode_table SELECT current_setting('babelfishpg_tsql.migration_mode') +GO +~~ROW COUNT: 1~~ + + +-- test multi-db mode +SELECT set_config('role', 'jdbc_user', false); +GO +~~START~~ +text +jdbc_user +~~END~~ + +SELECT set_config('babelfishpg_tsql.migration_mode', 'multi-db', false); +GO +~~START~~ +text +multi-db +~~END~~ + + +-- check if correct schema is present in search path +CREATE DATABASE ["BABEL_5111.db"] +GO + +CREATE DATABASE ["龙漫远; 龍漫遠.¢£€¥"] +GO + +use ["BABEL_5111.db"] +GO + +CREATE TABLE t1(a int) +GO + +SELECT current_setting('search_path') +GO +~~START~~ +text +"""babel_5111.db""_dbo", "$user", sys, pg_catalog +~~END~~ + + +CREATE SCHEMA ["BABEL_5111.scm"] +GO + +CREATE TABLE ["BABEL_5111.scm"].t1(a int) +GO + +CREATE VIEW ["BABEL_5111.scm"].v1 AS SELECT 1 +GO + +CREATE PROCEDURE ["BABEL_5111.scm"].p1 AS SELECT 1 +GO + +CREATE TRIGGER ["BABEL_5111.scm"].BABEL_5111_trgger1 on ["BABEL_5111.scm"].t1 AFTER INSERT AS BEGIN END +GO + +ALTER TABLE ["BABEL_5111.scm"].t1 ENABLE TRIGGER BABEL_5111_trgger1 +GO + +USE ["龙漫远; 龍漫遠.¢£€¥"] +GO + +CREATE TABLE t1(a int) +GO + +SELECT current_setting('search_path') +GO +~~START~~ +text +"""龙漫远; 龍漫遠.??€?""_dbo", "$user", sys, pg_catalog +~~END~~ + + +CREATE SCHEMA ["BABEL_5111.😃😄😉😊"] +GO + +CREATE TABLE ["BABEL_5111.😃😄😉😊"].t1(a int) +GO + +CREATE VIEW ["BABEL_5111.😃😄😉😊"].v1 AS SELECT 1 +GO + +CREATE PROCEDURE ["BABEL_5111.😃😄😉😊"].p1 AS SELECT 1 +GO + +CREATE TRIGGER ["BABEL_5111.😃😄😉😊"].BABEL_5111_trgger1 on ["BABEL_5111.😃😄😉😊"].t1 AFTER INSERT AS BEGIN END +GO + +ALTER TABLE ["BABEL_5111.😃😄😉😊"].t1 ENABLE TRIGGER BABEL_5111_trgger1 +GO + +USE master +GO + +EXEC ["BABEL_5111.db"].["BABEL_5111.scm"].p1 +GO +~~START~~ +int +1 +~~END~~ + + +SELECT * from ["BABEL_5111.db"].["BABEL_5111.scm"].t1 +GO +~~START~~ +int +~~END~~ + + +SELECT * from ["BABEL_5111.db"].["BABEL_5111.scm"].v1 +GO +~~START~~ +int +1 +~~END~~ + + +EXEC ["龙漫远; 龍漫遠.¢£€¥"].["BABEL_5111.😃😄😉😊"].p1 +GO +~~START~~ +int +1 +~~END~~ + + +SELECT * from ["龙漫远; 龍漫遠.¢£€¥"].["BABEL_5111.😃😄😉😊"].t1 +GO +~~START~~ +int +~~END~~ + + +SELECT * from ["龙漫远; 龍漫遠.¢£€¥"].["BABEL_5111.😃😄😉😊"].v1 +GO +~~START~~ +int +1 +~~END~~ + + +use ["BABEL_5111.db"] +GO + +DROP PROCEDURE ["BABEL_5111.scm"].p1 +GO + +DROP TRIGGER ["BABEL_5111.scm"].BABEL_5111_trgger1 +GO + +DROP VIEW ["BABEL_5111.scm"].v1 +GO + +DROP TABLE ["BABEL_5111.scm"].t1 +GO + +DROP SCHEMA ["BABEL_5111.scm"] +GO + +DROP TABLE t1 +GO + +USE ["龙漫远; 龍漫遠.¢£€¥"] +GO + +DROP PROCEDURE ["BABEL_5111.😃😄😉😊"].p1 +GO + +DROP TRIGGER ["BABEL_5111.😃😄😉😊"].BABEL_5111_trgger1 +GO + +DROP VIEW ["BABEL_5111.😃😄😉😊"].v1 +GO + +DROP TABLE ["BABEL_5111.😃😄😉😊"].t1 +GO + +DROP SCHEMA ["BABEL_5111.😃😄😉😊"] +GO + +USE master +GO + +DROP DATABASE ["BABEL_5111.db"] +GO + +DROP DATABASE ["龙漫远; 龍漫遠.¢£€¥"] +GO + +SELECT set_config('role', 'jdbc_user', false); +GO +~~START~~ +text +jdbc_user +~~END~~ + + +-- Reset migration mode to default +DECLARE @mig_mode VARCHAR(10) +SET @mig_mode = (SELECT mig_mode FROM babelfish_migration_mode_table WHERE id_num = 1) +SELECT CASE WHEN (SELECT set_config('babelfishpg_tsql.migration_mode', @mig_mode, false)) IS NOT NULL THEN 1 ELSE 0 END +GO +~~START~~ +int +1 +~~END~~ + + +Drop Table IF EXISTS babelfish_migration_mode_table +GO diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/translate-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/translate-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..4adf2669414 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/translate-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,2730 @@ +DECLARE @string1 nvarchar(30) = N'比尔·拉' +DECLARE @characters nvarchar(10) = N'尔', @translation nvarchar(10) = N'莫' +SELECT TRANSLATE(@string1, @characters, @translation) +GO +~~START~~ +nvarchar +比莫·拉 +~~END~~ + + +-- NULL +SELECT TRANSLATE(NULL, 'acs', 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE('scd', NULL, 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE('scd', 'scd', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE(NULL, NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE(NULL, 'aces', 'scdwe') +GO +~~START~~ +varchar + +~~END~~ + + +-- different no. of arguments +SELECT TRANSLATE('aceds', 'aces', 'scdwe', 'acsdes') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.translate function requires 3 arguments)~~ + + +SELECT TRANSLATE('aces', 'scdwe') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.translate function requires 3 arguments)~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +varchar +|??????莫比??????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??尔??·莫比??????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(10) = '比拉斯 ', @translations CHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| 比??拉莫斯 | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(10) = '比拉斯 ', @translations CHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比??拉莫斯 | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +varchar +|??????莫比????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(10) = '比拉斯 ', @translations VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| 比??拉莫斯 | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(10) = '比拉斯 ', @translations VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(MAX) = '比拉斯 ', @translations VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| 比??拉莫斯 | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(MAX) = '比拉斯 ', @translations VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_ci_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4837_translate_chinese_prc_ci_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_cs_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4837_translate_chinese_prc_cs_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4837_translate_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CI_AS + '|' FROM babel_4837_translate_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CS_AS + '|' FROM babel_4837_translate_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CI_AI + '|' FROM babel_4837_translate_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +nvarchar +|??尔??·莫比??????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +|??尔??·莫比??????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(10) = N'比拉斯 ', @translations NCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| 比??拉莫斯 | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(10) = N'比拉斯 ', @translations NCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +| 比??拉莫斯 | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_t1 +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +| 尔尔··莫比 | +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(10) = N'比拉斯 ', @translations NVARCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(10) = N'比拉斯 ', @translations NVARCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(MAX) = N'比拉斯 ', @translations NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(MAX) = N'比拉斯 ', @translations NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4837_translate_dep_view +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +SELECT * FROM babel_4837_translate_dep_view1 +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +EXEC babel_4837_translate_dep_proc +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +SELECT * FROM babel_4837_translate_dep_func() +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +SELECT * FROM babel_4837_translate_itvf_func() +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +-- different datatypes of inputString and characters/translations +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|??????莫比??????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|??????莫比??????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations)+ '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|??????莫比????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??尔??·莫比??????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??尔??·莫比??????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = N' ABCDEF ', @characters BINARY(4) = 0x414243, @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @characters NCHAR(20) = N'尔·比?', @translations VARBINARY(2) = 0x4144 +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 1 of translate function.)~~ + + +-- input type UDT +-- in table babel_4837_translate_UDT, col 'a' has basetype image and col 'b' and 'c' have basetype varchar +SELECT TRANSLATE(a, b, c) FROM babel_4837_translate_UDT +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE(b, b, c) FROM babel_4837_translate_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT TRANSLATE(@inputString, '12', '06'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString date = '2016-12-21', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters date = '2016-12-21', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters VARCHAR(20) = '2016-12-21', @translations date = '2016-12-21'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of translate function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @date date = '2016-12-21', @translations VARCHAR(10) = '06'; +DECLARE @characters datetime = @date; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters VARCHAR(20) = '2016-12-21', @date date = '2016-12-21'; +DECLARE @translations datetime = @date; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @characters smalldatetime = '2016-12-21 12:43:10', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @characters VARCHAR(30) = '2016-12-21 12:43:10', @translations smalldatetime = '2016-12-21 12:43:10'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @characters time(4) = '12:10:05.1237', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @characters VARCHAR(30) = '12:10:05.1237', @translations time(4) = '12:10:05.1237'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @characters datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @characters VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @translations datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @characters datetime2(4) = '1968-10-23 12:45:37.1237', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @characters VARCHAR(50) = '1968-10-23 12:45:37.1237', @translations datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString decimal = 123456, @characters decimal = 12, @translations decimal = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters decimal = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations decimal = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString numeric = 12345.12, @characters numeric = 12, @translations numeric = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters numeric = 12.12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations numeric = 12.12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString float = 12345.1, @characters float = 12, @translations float = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters float = 12.1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations float = 12.1; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString real = 12345.1, @characters real = 12, @translations real = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters real = 12.1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations real = 12.1; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString bigint = 12345678, @characters bigint = 12, @translations bigint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters bigint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations bigint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString int = 12345678, @characters int = 12, @translations int = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters int = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations int = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smallint = 12356, @characters smallint = 12, @translations smallint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters smallint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations smallint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString tinyint = 235, @characters tinyint = 12, @translations tinyint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters tinyint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations tinyint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString money = 12356, @characters money = 12, @translations money = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters money = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations money = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smallmoney = 12356, @characters smallmoney = 12, @translations smallmoney = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters smallmoney = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations smallmoney = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString bit = 1, @characters bit = 1, @translations bit = 0; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters bit = 1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations bit = 0; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE(a, a, a) FROM babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE('a', a, 'a') FROM babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of translate function.)~~ + + +SELECT TRANSLATE('a', 'a', a) FROM babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of translate function.)~~ + + +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(a, @characters, @translations) from babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE(a, b, c) FROM babel_4837_translate_text +GO +~~START~~ +varchar + sbc?defjhi?? +~~END~~ + +SELECT TRANSLATE('qw', a, 'cd') FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE('qw', 'ab', a) FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE(b, a, c) FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE('qw', c, 'cd') FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE('qw', 'ab', b) FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @characters VARCHAR(20) = 'ab?', @translations VARCHAR(10) = 'x?y'; +SELECT TRANSLATE(a, @characters, @translations) FROM babel_4837_translate_text +GO +~~START~~ +varchar + x?c?defghi?? +~~END~~ + + +DECLARE @characters VARCHAR(20) = 'ab?', @translations VARCHAR(10) = 'x?y'; +SELECT TRANSLATE(b, @characters, @translations) FROM babel_4837_translate_text +GO +~~START~~ +nvarchar + x?c🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @characters xml = CAST ('' AS xml), @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters xml = CAST ('' AS xml), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters geometry = geometry::STGeomFromText('POINT (1 2)', 0), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters geography = geography::STGeomFromText('POINT (1 2)', 4326), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations geography = geography::STGeomFromText('POINT (1 2)', 4326); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), @characters, @translations) +GO +~~START~~ +varchar +5A9519AA-8B85-D011-B42D-00C04AC954AA +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @characters xml = CAST ('' AS xml), @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), CAST (@characters AS VARCHAR(50)), CAST (@translations AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), @characters, @translations) +GO +~~START~~ +varchar +POINT(4 5) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/translate-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/translate-vu-verify.out new file mode 100644 index 00000000000..258cee2c7f6 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/translate-vu-verify.out @@ -0,0 +1,2730 @@ +DECLARE @string1 nvarchar(30) = N'比尔·拉' +DECLARE @characters nvarchar(10) = N'尔', @translation nvarchar(10) = N'莫' +SELECT TRANSLATE(@string1, @characters, @translation) +GO +~~START~~ +nvarchar +比莫·拉 +~~END~~ + + +-- NULL +SELECT TRANSLATE(NULL, 'acs', 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE('scd', NULL, 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE('scd', 'scd', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE(NULL, NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE(NULL, 'aces', 'scdwe') +GO +~~START~~ +varchar + +~~END~~ + + +-- different no. of arguments +SELECT TRANSLATE('aceds', 'aces', 'scdwe', 'acsdes') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.translate function requires 3 arguments)~~ + + +SELECT TRANSLATE('aces', 'scdwe') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.translate function requires 3 arguments)~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +varchar +|??????莫比??????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??尔??·莫比??????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(10) = '比拉斯 ', @translations CHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| 比??拉莫斯 | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(10) = '比拉斯 ', @translations CHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比??拉莫斯 | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +varchar +|??????莫比????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(10) = '比拉斯 ', @translations VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| 比??拉莫斯 | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(10) = '比拉斯 ', @translations VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(MAX) = '比拉斯 ', @translations VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| 比??拉莫斯 | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(MAX) = '比拉斯 ', @translations VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_ci_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4837_translate_chinese_prc_ci_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_cs_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4837_translate_chinese_prc_cs_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4837_translate_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CI_AS + '|' FROM babel_4837_translate_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CS_AS + '|' FROM babel_4837_translate_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CI_AI + '|' FROM babel_4837_translate_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +nvarchar +|??尔??·莫比??????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +|??尔??·莫比??????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(10) = N'比拉斯 ', @translations NCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| 比??拉莫斯 | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(10) = N'比拉斯 ', @translations NCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +| 比??拉莫斯 | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_t1 +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +| 尔尔··莫比 | +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(10) = N'比拉斯 ', @translations NVARCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(10) = N'比拉斯 ', @translations NVARCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(MAX) = N'比拉斯 ', @translations NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(MAX) = N'比拉斯 ', @translations NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4837_translate_dep_view +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +SELECT * FROM babel_4837_translate_dep_view1 +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +EXEC babel_4837_translate_dep_proc +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +SELECT * FROM babel_4837_translate_dep_func() +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +SELECT * FROM babel_4837_translate_itvf_func() +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +-- different datatypes of inputString and characters/translations +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|??????莫比??????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|??????莫比??????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations)+ '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|??????莫比????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??尔??·莫比??????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??尔??·莫比??????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = N' ABCDEF ', @characters BINARY(4) = 0x414243, @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @characters NCHAR(20) = N'尔·比?', @translations VARBINARY(2) = 0x4144 +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 1 of translate function.)~~ + + +-- input type UDT +-- in table babel_4837_translate_UDT, col 'a' has basetype image and col 'b' and 'c' have basetype varchar +SELECT TRANSLATE(a, b, c) FROM babel_4837_translate_UDT +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE(b, b, c) FROM babel_4837_translate_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT TRANSLATE(@inputString, '12', '06'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString date = '2016-12-21', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters date = '2016-12-21', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters VARCHAR(20) = '2016-12-21', @translations date = '2016-12-21'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of translate function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @date date = '2016-12-21', @translations VARCHAR(10) = '06'; +DECLARE @characters datetime = @date; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters VARCHAR(20) = '2016-12-21', @date date = '2016-12-21'; +DECLARE @translations datetime = @date; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @characters smalldatetime = '2016-12-21 12:43:10', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @characters VARCHAR(30) = '2016-12-21 12:43:10', @translations smalldatetime = '2016-12-21 12:43:10'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @characters time(4) = '12:10:05.1237', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @characters VARCHAR(30) = '12:10:05.1237', @translations time(4) = '12:10:05.1237'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @characters datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @characters VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @translations datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @characters datetime2(4) = '1968-10-23 12:45:37.1237', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @characters VARCHAR(50) = '1968-10-23 12:45:37.1237', @translations datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString decimal = 123456, @characters decimal = 12, @translations decimal = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters decimal = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations decimal = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString numeric = 12345.12, @characters numeric = 12, @translations numeric = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters numeric = 12.12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations numeric = 12.12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString float = 12345.1, @characters float = 12, @translations float = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters float = 12.1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations float = 12.1; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString real = 12345.1, @characters real = 12, @translations real = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters real = 12.1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations real = 12.1; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString bigint = 12345678, @characters bigint = 12, @translations bigint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters bigint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations bigint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString int = 12345678, @characters int = 12, @translations int = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters int = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations int = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smallint = 12356, @characters smallint = 12, @translations smallint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters smallint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations smallint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString tinyint = 235, @characters tinyint = 12, @translations tinyint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters tinyint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations tinyint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString money = 12356, @characters money = 12, @translations money = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters money = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations money = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smallmoney = 12356, @characters smallmoney = 12, @translations smallmoney = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters smallmoney = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations smallmoney = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString bit = 1, @characters bit = 1, @translations bit = 0; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters bit = 1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations bit = 0; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE(a, a, a) FROM babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE('a', a, 'a') FROM babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of translate function.)~~ + + +SELECT TRANSLATE('a', 'a', a) FROM babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of translate function.)~~ + + +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(a, @characters, @translations) from babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE(a, b, c) FROM babel_4837_translate_text +GO +~~START~~ +varchar + sbc?defjhi?? +~~END~~ + +SELECT TRANSLATE('qw', a, 'cd') FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE('qw', 'ab', a) FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE(b, a, c) FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE('qw', c, 'cd') FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE('qw', 'ab', b) FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @characters VARCHAR(20) = 'ab?', @translations VARCHAR(10) = 'x?y'; +SELECT TRANSLATE(a, @characters, @translations) FROM babel_4837_translate_text +GO +~~START~~ +varchar + x?c?defghi?? +~~END~~ + + +DECLARE @characters VARCHAR(20) = 'ab?', @translations VARCHAR(10) = 'x?y'; +SELECT TRANSLATE(b, @characters, @translations) FROM babel_4837_translate_text +GO +~~START~~ +nvarchar + x?c🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @characters xml = CAST ('' AS xml), @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters xml = CAST ('' AS xml), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters geometry = geometry::STGeomFromText('POINT (1 2)', 0), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters geography = geography::STGeomFromText('POINT (1 2)', 4326), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations geography = geography::STGeomFromText('POINT (1 2)', 4326); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), @characters, @translations) +GO +~~START~~ +varchar +5A9519AA-8B85-D011-B42D-00C04AC954AA +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @characters xml = CAST ('' AS xml), @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), CAST (@characters AS VARCHAR(50)), CAST (@translations AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), @characters, @translations) +GO +~~START~~ +varchar +POINT(4 5) +~~END~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/trim-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/trim-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..0731b7cc2c3 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/trim-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,1364 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(50) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT TRIM(NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRIM(NULL FROM NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRIM('' FROM NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRIM(NULL FROM '') +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|比??拉莫斯| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比??拉莫斯| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab? ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab😎 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|比??拉莫斯| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab? ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab😎 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_ci_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_trim_chinese_prc_ci_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_cs_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_trim_chinese_prc_cs_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_trim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_trim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_trim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_trim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|比??拉莫斯| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' ab😎c🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂😎 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|?c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|??拉莫| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|??拉莫| +~~END~~ + + +-- with table column of type nchar +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_t1 +GO +~~START~~ +nvarchar +|c🙂defghi| +|尔·拉莫| +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' ab😎c🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂😎 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_trim_dep_view +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +EXEC babel_4489_trim_dep_proc +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_func() +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_itvf_func() +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_1 +GO +~~START~~ +varchar +|abc?defghi??| +|比??拉莫斯| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_2 +GO +~~START~~ +varchar +|abc?defghi??| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_3 +GO +~~START~~ +varchar +|abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_4 +GO +~~START~~ +varchar +|abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_5 +GO +~~START~~ +varchar +|0x61626364| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_6 +GO +~~START~~ +varchar +|cdefgh| +~~END~~ + + +-- different datatypes of inputString and charSet +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|??拉莫| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|??拉莫| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|??拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' ABCDEF ', @charSet BINARY(4) = 0x414243 +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @charSet VARBINARY(2) = 0x4144 +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 1 of Trim function.)~~ + + +-- input type UDT +-- -- in table babel_4489_trim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT TRIM(a) FROM babel_4489_trim_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of Trim function.)~~ + + +SELECT TRIM(b) FROM babel_4489_trim_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +DECLARE @charSet VARCHAR(10) = 'ab' +SELECT TRIM(@charSet FROM a) FROM babel_4489_trim_UDT +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of Trim function.)~~ + + +DECLARE @charSet VARCHAR(10) = 'ab' +SELECT TRIM(@charSet FROM b) FROM babel_4489_trim_UDT +GO +~~START~~ +varchar +cdef +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT TRIM('12' FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString date = '2016-12-21', @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of Trim function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of Trim function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @charSet VARCHAR(10) = '10'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @charSet VARCHAR(10) = '23'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @charSet VARCHAR(10) = '23'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString decimal = 123456, @charSet decimal = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString numeric = 12345.12, @charSet numeric = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString float = 12345.1, @charSet float = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString real = 12345.1, @charSet real = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString bigint = 12345678, @charSet bigint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString int = 12345678, @charSet int = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString smallint = 12356, @charSet smallint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString tinyint = 235, @charSet tinyint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString money = 12356, @charSet money = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString smallmoney = 12356, @charSet smallmoney = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString bit = 1, @charSet bit = 1; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of Trim function.)~~ + + +SELECT TRIM(a FROM a) FROM babel_4489_trim_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of Trim function.)~~ + + +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM a) from babel_4489_trim_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of Trim function.)~~ + + +SELECT TRIM(a FROM b) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar + +~~END~~ + +SELECT TRIM(b FROM a) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar + +~~END~~ + + +DECLARE @charSet VARCHAR(20) = 'ab? ' +SELECT TRIM(@charSet FROM a) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar +c🙂defghi🙂🙂 +~~END~~ + + +DECLARE @charSet VARCHAR(20) = 'ab? ' +SELECT TRIM(@charSet FROM b) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar +c🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @charSet xml = CAST ('' AS xml); +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @charSet VARCHAR(10) = '(1 2)'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @charSet VARCHAR(10) = '(1 2)'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @charSet VARCHAR(10) = '2'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @charSet VARCHAR(10) = '2'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +9619FF-8B86-D011-B42D-00C04FC964 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @charSet xml = CAST ('' AS xml); +SELECT TRIM(CAST(@charSet AS VARCHAR) FROM CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +body> +~~END~~ + + +SELECT TRIM(NULL FROM NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRIM('' FROM NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRIM(NULL FROM '') +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|比??拉莫斯| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比??拉莫斯| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab? ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab😎 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|比??拉莫斯| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab? ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab😎 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_ci_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_trim_chinese_prc_ci_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_cs_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_trim_chinese_prc_cs_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_trim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_trim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_trim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_trim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|比??拉莫斯| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' ab😎c🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂😎 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|?c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|??拉莫| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|??拉莫| +~~END~~ + + +-- with table column of type nchar +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_t1 +GO +~~START~~ +nvarchar +|c🙂defghi| +|尔·拉莫| +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' ab😎c🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂😎 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_trim_dep_view +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +EXEC babel_4489_trim_dep_proc +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_func() +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_itvf_func() +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_1 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂| +|比尔·拉莫斯| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_2 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_3 +GO +~~START~~ +varchar +|abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_4 +GO +~~START~~ +varchar +|abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_5 +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 1 of Trim function.)~~ + + +SELECT * FROM babel_4489_trim_dep_view_6 +GO +~~START~~ +varchar +|cdefgh| +~~END~~ + + +-- different datatypes of inputString and charSet +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??拉莫| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|??拉莫| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|??拉莫| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|??拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' ABCDEF ', @charSet BINARY(4) = 0x414243 +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @charSet VARBINARY(2) = 0x4144 +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 1 of Trim function.)~~ + + +-- input type UDT +-- -- in table babel_4489_trim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT TRIM(a) FROM babel_4489_trim_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of Trim function.)~~ + + +SELECT TRIM(b) FROM babel_4489_trim_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +DECLARE @charSet VARCHAR(10) = 'ab' +SELECT TRIM(@charSet FROM a) FROM babel_4489_trim_UDT +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of Trim function.)~~ + + +DECLARE @charSet VARCHAR(10) = 'ab' +SELECT TRIM(@charSet FROM b) FROM babel_4489_trim_UDT +GO +~~START~~ +varchar +cdef +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT TRIM('12' FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString date = '2016-12-21', @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of Trim function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of Trim function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @charSet VARCHAR(10) = '10'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @charSet VARCHAR(10) = '23'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @charSet VARCHAR(10) = '23'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString decimal = 123456, @charSet decimal = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString numeric = 12345.12, @charSet numeric = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString float = 12345.1, @charSet float = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString real = 12345.1, @charSet real = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString bigint = 12345678, @charSet bigint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString int = 12345678, @charSet int = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString smallint = 12356, @charSet smallint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString tinyint = 235, @charSet tinyint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString money = 12356, @charSet money = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString smallmoney = 12356, @charSet smallmoney = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString bit = 1, @charSet bit = 1; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of Trim function.)~~ + + +SELECT TRIM(a FROM a) FROM babel_4489_trim_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of Trim function.)~~ + + +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM a) from babel_4489_trim_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of Trim function.)~~ + + +SELECT TRIM(a FROM b) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar + +~~END~~ + +SELECT TRIM(b FROM a) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar + +~~END~~ + + +DECLARE @charSet VARCHAR(20) = 'ab? ' +SELECT TRIM(@charSet FROM a) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar +c🙂defghi🙂🙂 +~~END~~ + + +DECLARE @charSet VARCHAR(20) = 'ab? ' +SELECT TRIM(@charSet FROM b) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar +c🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @charSet xml = CAST ('' AS xml); +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @charSet VARCHAR(10) = '(1 2)'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @charSet VARCHAR(10) = '(1 2)'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @charSet VARCHAR(10) = '2'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @charSet VARCHAR(10) = '2'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +9619FF-8B86-D011-B42D-00C04FC964 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @charSet xml = CAST ('' AS xml); +SELECT TRIM(CAST(@charSet AS VARCHAR) FROM CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +body> +~~END~~ + +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString BINARY(30) = 0x4142434445 +SELECT UPPER(@inputString) +SELECT LOWER(@inputString) +SELECT CONVERT(BINARY(50), UPPER(@inputString)); +SELECT CONVERT(BINARY(50), LOWER(@inputString)); +GO +~~START~~ +varchar +ABCDE +~~END~~ + +~~START~~ +varchar +abcde +~~END~~ + +~~START~~ +binary +4142434445000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +~~END~~ + +~~START~~ +binary +6162636465000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +~~END~~ + + +DECLARE @inputString VARBINARY(30) = 0x4142434445 +SELECT UPPER(@inputString) +SELECT LOWER(@inputString) +SELECT CONVERT(VARBINARY(50), UPPER(@inputString)); +SELECT CONVERT(VARBINARY(50), LOWER(@inputString)); +GO +~~START~~ +varchar +ABCDE +~~END~~ + +~~START~~ +varchar +abcde +~~END~~ + +~~START~~ +varbinary +4142434445 +~~END~~ + +~~START~~ +varbinary +6162636465 +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-4803 +declare @string1 nchar(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO +~~START~~ +nvarchar +|比??拉 | +~~END~~ + +~~START~~ +nvarchar +|比??拉 | +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-1664 +DECLARE @date date = '12-21-16'; +DECLARE @datetime datetime = @date; +SELECT UPPER(@datetime) +SELECT LOWER(@datetime) +GO +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-1664 +DECLARE @smalldatetime smalldatetime = '1955-12-13 12:43:10'; +SELECT UPPER(@smalldatetime) +SELECT LOWER(@smalldatetime) +GO +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + + +DECLARE @date date = '2016-12-21'; +SELECT UPPER(@date) +SELECT LOWER(@date) +GO +~~START~~ +varchar +2016-12-21 +~~END~~ + +~~START~~ +varchar +2016-12-21 +~~END~~ + + +DECLARE @time time(4) = '12:10:05.1237'; +SELECT UPPER(@time) +SELECT LOWER(@time) +GO +~~START~~ +varchar +12:10:05.1237 +~~END~~ + +~~START~~ +varchar +12:10:05.1237 +~~END~~ + + +DECLARE @datetimeoffset datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT UPPER(@datetimeoffset) +SELECT LOWER(@datetimeoffset) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @datetime2 datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT UPPER(@datetime2) +SELECT LOWER(@datetime2) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @decimal decimal = 123; +SELECT UPPER(@decimal) +SELECT LOWER(@decimal) +GO +~~START~~ +varchar +123 +~~END~~ + +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @numeric numeric = 12345.12; +SELECT UPPER(@numeric) +SELECT LOWER(@numeric) +GO +~~START~~ +varchar +12345 +~~END~~ + +~~START~~ +varchar +12345 +~~END~~ + + +DECLARE @float float = 12345.1; +SELECT UPPER(@float) +SELECT LOWER(@float) +GO +~~START~~ +varchar +12345.1 +~~END~~ + +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @real real = 12345.1; +SELECT UPPER(@real) +SELECT LOWER(@real) +GO +~~START~~ +varchar +12345.1 +~~END~~ + +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @bigint bigint = 2; +SELECT UPPER(@bigint) +SELECT LOWER(@bigint) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @int int = 2; +SELECT UPPER(@int) +SELECT LOWER(@int) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @smallint smallint = 2; +SELECT UPPER(@smallint) +SELECT LOWER(@smallint) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @tinyint tinyint = 2; +SELECT UPPER(@tinyint) +SELECT LOWER(@tinyint) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @money money = 2; +SELECT UPPER(@money) +SELECT LOWER(@money) +GO +~~START~~ +varchar +2.0000 +~~END~~ + +~~START~~ +varchar +2.0000 +~~END~~ + + +DECLARE @smallmoney smallmoney = 2; +SELECT UPPER(@smallmoney) +SELECT LOWER(@smallmoney) +GO +~~START~~ +varchar +2.0000 +~~END~~ + +~~START~~ +varchar +2.0000 +~~END~~ + + +DECLARE @bit bit = 1; +SELECT UPPER(@bit) +SELECT LOWER(@bit) +GO +~~START~~ +varchar +1 +~~END~~ + +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @myid uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + +~~START~~ +varchar +6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + + +DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of upper function.)~~ + + +DECLARE @myid xml = CAST ('' AS xml) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of upper function.)~~ + + +DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of upper function.)~~ + + +DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04F +~~END~~ + +~~START~~ +varchar +6f9619ff-8b86-d011-b42d-00c04f +~~END~~ + + +DECLARE @myid xml = CAST ('' AS xml) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + + +DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO +~~START~~ +varchar +POINT(1 2) +~~END~~ + +~~START~~ +varchar +point(1 2) +~~END~~ + + +Select UPPER(a), LOWER(a) from upper_lower_text +GO +~~START~~ +varchar#!#varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +Select UPPER(a), LOWER(a) from upper_lower_ntext +GO +~~START~~ +nvarchar#!#nvarchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +Select UPPER(a), LOWER(a) from upper_lower_image +GO +~~START~~ +varchar#!#varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of upper function.)~~ + + +declare @string1 nvarchar(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO +~~START~~ +nvarchar +|比尔·拉| +~~END~~ + +~~START~~ +nvarchar +|比尔·拉| +~~END~~ + + +declare @string1 char(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO +~~START~~ +varchar +|比??拉 | +~~END~~ + +~~START~~ +varchar +|比??拉 | +~~END~~ + + +declare @string1 varchar(30) = N'比尔·拉'; +select UPPER(@string1) +select LOWER(@string1) +GO +~~START~~ +varchar +比??拉 +~~END~~ + +~~START~~ +varchar +比??拉 +~~END~~ + + +SELECT * from upper_lower_dt where UPPER(a) = N'Anikait'; +GO +~~START~~ +varchar#!#nvarchar#!#char#!#nchar +Anikait #!#Agrawal #!#Anikait #!#Agrawal +~~END~~ + +SELECT * from upper_lower_dt where LOWER(c) = N'比尔·拉拉'; +GO +~~START~~ +varchar#!#nvarchar#!#char#!#nchar +~~END~~ + + +SELECT * from dep_view_upper +GO +~~START~~ +text#!#text#!#text#!#text +~~END~~ + +SELECT upper(col), lower(col) FROM tab_arabic_ci_ai; +GO +~~START~~ +varchar#!#varchar +لقد#!#لقد +~~END~~ + +SELECT upper(col), lower(col) FROM tab_arabic_ci_as; +GO +~~START~~ +varchar#!#varchar +لقد#!#لقد +~~END~~ + +SELECT upper(col), lower(col) FROM tab_arabic_cs_as; +GO +~~START~~ +varchar#!#varchar +لقد#!#لقد +~~END~~ + +SELECT upper(col), lower(col) FROM tab_chinese_ci_ai; +GO +~~START~~ +varchar#!#varchar +比尔·拉#!#比尔·拉 +~~END~~ + +SELECT upper(col), lower(col) FROM tab_chinese_ci_as; +GO +~~START~~ +varchar#!#varchar +比尔·拉#!#比尔·拉 +~~END~~ + +SELECT upper(col), lower(col) FROM tab_chinese_cs_as; +GO +~~START~~ +varchar#!#varchar +比尔·拉#!#比尔·拉 +~~END~~ + +EXEC dep_proc_upper +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +ANIKAIT #!#AGRAWAL #!#ANIKAIT #!#AGRAWAL +~~END~~ + +select dbo.dep_func_upper() +GO +~~START~~ +varchar +ANIKAIT +~~END~~ + + +SELECT * from dep_view_lower +GO +~~START~~ +text#!#text#!#text#!#text +~~END~~ + +EXEC dep_proc_lower +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +anikait #!#agrawal #!#anikait #!#agrawal +~~END~~ + +SELECT * from dep_view_upper_lower +GO +~~START~~ +text#!#text +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +EXEC dep_proc_upper_lower +GO +~~START~~ +varchar#!#varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +SELECT * from dep_view_upper_lower1 +GO +~~START~~ +text#!#text +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +EXEC dep_proc_upper_lower1 +GO +~~START~~ +nvarchar#!#nvarchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +select dbo.dep_func_lower() +GO +~~START~~ +varchar +anikait +~~END~~ + +select dbo.tvp_func_upper_lower() +GO +~~START~~ +varchar +("ANIKAIT ","anikait ") +(" ANIKAIT"," anikait") +(" A"," a") +(" "," ") +("","") +(A,a) +(,) +(比??拉,比??拉) +~~END~~ + +SELECT * from dep_view_lower1 +GO +~~START~~ +text +adjnfjh +~~END~~ + +declare @b dbo.MyUDT = CAST('scsdc' AS dbo.MyUDT) +select upper(@b) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of upper function.)~~ + diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/upper_lower-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/upper_lower-vu-verify.out new file mode 100644 index 00000000000..26adc8e18f0 --- /dev/null +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/upper_lower-vu-verify.out @@ -0,0 +1,844 @@ +DECLARE @class NCHAR(30) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE (@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'ANIKAIT AGRAWAL' +SELECT '[' + @class + ']' WHERE upper(@class) = N'Anikait Agrawal ' +SELECT '[' + @class + ']' WHERE lower(@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE lower(@class) = N'anikait agrawal' +SELECT '[' + @class + ']' WHERE lower(@class) = N'Anikait Agrawal ' +GO +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + + +DECLARE @class CHAR(30) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE (@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'ANIKAIT AGRAWAL' +SELECT '[' + @class + ']' WHERE upper(@class) = N'Anikait Agrawal ' +SELECT '[' + @class + ']' WHERE lower(@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE lower(@class) = N'anikait agrawal' +SELECT '[' + @class + ']' WHERE lower(@class) = N'Anikait Agrawal ' +GO +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + + +DECLARE @class NCHAR = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'ANIKAIT AGRAWAL' +SELECT '[' + @class + ']' WHERE lower(@class) = N'anikait agrawal' +GO +~~START~~ +nvarchar +~~END~~ + +~~START~~ +nvarchar +~~END~~ + + +DECLARE @class CHAR = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'ANIKAIT AGRAWAL' +SELECT '[' + @class + ']' WHERE lower(@class) = N'anikait agrawal' +GO +~~START~~ +varchar +~~END~~ + +~~START~~ +varchar +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-4807 +declare @string1 varchar(30) = N'比尔·拉' COLLATE chinese_prc_ci_as +SELECT UPPER(@string1) +SELECT UPPER(@string1) COLLATE chinese_prc_ci_as +SELECT LOWER(@string1) +SELECT LOWER(@string1) COLLATE chinese_prc_ci_as +go +~~START~~ +varchar +比??拉 +~~END~~ + +~~START~~ +varchar +比尔·拉 +~~END~~ + +~~START~~ +varchar +比??拉 +~~END~~ + +~~START~~ +varchar +比尔·拉 +~~END~~ + + +declare @string1 char(30) = N'比尔·拉' COLLATE chinese_prc_ci_as +SELECT '|' + UPPER(@string1) + '|' +SELECT '|' + UPPER(@string1) + '|' COLLATE chinese_prc_ci_as +SELECT '|' + LOWER(@string1) + '|' +SELECT '|' + LOWER(@string1) + '|' COLLATE chinese_prc_ci_as +go +~~START~~ +varchar +|比??拉 | +~~END~~ + +~~START~~ +varchar +|比??拉 | +~~END~~ + +~~START~~ +varchar +|比??拉 | +~~END~~ + +~~START~~ +varchar +|比??拉 | +~~END~~ + + +SELECT UPPER(NULL) +SELECT LOWER(NULL) +GO +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString BINARY(30) = 0x4142434445 +SELECT UPPER(@inputString) +SELECT LOWER(@inputString) +SELECT CONVERT(BINARY(50), UPPER(@inputString)); +SELECT CONVERT(BINARY(50), LOWER(@inputString)); +GO +~~START~~ +varchar +ABCDE +~~END~~ + +~~START~~ +varchar +abcde +~~END~~ + +~~START~~ +binary +4142434445000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +~~END~~ + +~~START~~ +binary +6162636465000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +~~END~~ + + +DECLARE @inputString VARBINARY(30) = 0x4142434445 +SELECT UPPER(@inputString) +SELECT LOWER(@inputString) +SELECT CONVERT(VARBINARY(50), UPPER(@inputString)); +SELECT CONVERT(VARBINARY(50), LOWER(@inputString)); +GO +~~START~~ +varchar +ABCDE +~~END~~ + +~~START~~ +varchar +abcde +~~END~~ + +~~START~~ +varbinary +4142434445 +~~END~~ + +~~START~~ +varbinary +6162636465 +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-4803 +declare @string1 nchar(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO +~~START~~ +nvarchar +|比??拉 | +~~END~~ + +~~START~~ +nvarchar +|比??拉 | +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-1664 +DECLARE @date date = '12-21-16'; +DECLARE @datetime datetime = @date; +SELECT UPPER(@datetime) +SELECT LOWER(@datetime) +GO +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-1664 +DECLARE @smalldatetime smalldatetime = '1955-12-13 12:43:10'; +SELECT UPPER(@smalldatetime) +SELECT LOWER(@smalldatetime) +GO +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + + +DECLARE @date date = '2016-12-21'; +SELECT UPPER(@date) +SELECT LOWER(@date) +GO +~~START~~ +varchar +2016-12-21 +~~END~~ + +~~START~~ +varchar +2016-12-21 +~~END~~ + + +DECLARE @time time(4) = '12:10:05.1237'; +SELECT UPPER(@time) +SELECT LOWER(@time) +GO +~~START~~ +varchar +12:10:05.1237 +~~END~~ + +~~START~~ +varchar +12:10:05.1237 +~~END~~ + + +DECLARE @datetimeoffset datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT UPPER(@datetimeoffset) +SELECT LOWER(@datetimeoffset) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @datetime2 datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT UPPER(@datetime2) +SELECT LOWER(@datetime2) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @decimal decimal = 123; +SELECT UPPER(@decimal) +SELECT LOWER(@decimal) +GO +~~START~~ +varchar +123 +~~END~~ + +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @numeric numeric = 12345.12; +SELECT UPPER(@numeric) +SELECT LOWER(@numeric) +GO +~~START~~ +varchar +12345 +~~END~~ + +~~START~~ +varchar +12345 +~~END~~ + + +DECLARE @float float = 12345.1; +SELECT UPPER(@float) +SELECT LOWER(@float) +GO +~~START~~ +varchar +12345.1 +~~END~~ + +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @real real = 12345.1; +SELECT UPPER(@real) +SELECT LOWER(@real) +GO +~~START~~ +varchar +12345.1 +~~END~~ + +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @bigint bigint = 2; +SELECT UPPER(@bigint) +SELECT LOWER(@bigint) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @int int = 2; +SELECT UPPER(@int) +SELECT LOWER(@int) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @smallint smallint = 2; +SELECT UPPER(@smallint) +SELECT LOWER(@smallint) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @tinyint tinyint = 2; +SELECT UPPER(@tinyint) +SELECT LOWER(@tinyint) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @money money = 2; +SELECT UPPER(@money) +SELECT LOWER(@money) +GO +~~START~~ +varchar +2.0000 +~~END~~ + +~~START~~ +varchar +2.0000 +~~END~~ + + +DECLARE @smallmoney smallmoney = 2; +SELECT UPPER(@smallmoney) +SELECT LOWER(@smallmoney) +GO +~~START~~ +varchar +2.0000 +~~END~~ + +~~START~~ +varchar +2.0000 +~~END~~ + + +DECLARE @bit bit = 1; +SELECT UPPER(@bit) +SELECT LOWER(@bit) +GO +~~START~~ +varchar +1 +~~END~~ + +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @myid uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + +~~START~~ +varchar +6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + + +DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of upper function.)~~ + + +DECLARE @myid xml = CAST ('' AS xml) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of upper function.)~~ + + +DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of upper function.)~~ + + +DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04F +~~END~~ + +~~START~~ +varchar +6f9619ff-8b86-d011-b42d-00c04f +~~END~~ + + +DECLARE @myid xml = CAST ('' AS xml) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + + +DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO +~~START~~ +varchar +POINT(1 2) +~~END~~ + +~~START~~ +varchar +point(1 2) +~~END~~ + + +Select UPPER(a), LOWER(a) from upper_lower_text +GO +~~START~~ +varchar#!#varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +Select UPPER(a), LOWER(a) from upper_lower_ntext +GO +~~START~~ +nvarchar#!#nvarchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +Select UPPER(a), LOWER(a) from upper_lower_image +GO +~~START~~ +varchar#!#varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of upper function.)~~ + + +declare @string1 nvarchar(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO +~~START~~ +nvarchar +|比尔·拉| +~~END~~ + +~~START~~ +nvarchar +|比尔·拉| +~~END~~ + + +declare @string1 char(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO +~~START~~ +varchar +|比??拉 | +~~END~~ + +~~START~~ +varchar +|比??拉 | +~~END~~ + + +declare @string1 varchar(30) = N'比尔·拉'; +select UPPER(@string1) +select LOWER(@string1) +GO +~~START~~ +varchar +比??拉 +~~END~~ + +~~START~~ +varchar +比??拉 +~~END~~ + + +SELECT upper(a), lower(b), lower(c), upper(d) from upper_lower_dt; +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +ANIKAIT #!#agrawal #!#anikait #!#AGRAWAL + ANIKAIT#!# agrawal#!# anikait #!# AGRAWAL + A#!# 🤣😃#!# a #!# 🤣😃 + #!# #!# #!# +#!##!# #!# +A#!#a#!#a #!#A +#!##!##!# +比??拉#!#比尔·拉#!#比??拉 #!#比尔·拉 +~~END~~ + +SELECT * from upper_lower_dt where UPPER(a) = N'Anikait'; +GO +~~START~~ +varchar#!#nvarchar#!#char#!#nchar +Anikait #!#Agrawal #!#Anikait #!#Agrawal +~~END~~ + +SELECT * from upper_lower_dt where LOWER(c) = N'比尔·拉'; +GO +~~START~~ +varchar#!#nvarchar#!#char#!#nchar +~~END~~ + +SELECT * from upper_lower_dt where LOWER(d) = N'比尔·拉'; +GO +~~START~~ +varchar#!#nvarchar#!#char#!#nchar +比??拉#!#比尔·拉#!#比??拉 #!#比尔·拉 +~~END~~ + + +SELECT * from dep_view_upper +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +ANIKAIT #!#AGRAWAL #!#ANIKAIT #!#AGRAWAL +~~END~~ + +SELECT upper(col), lower(col) FROM tab_arabic_ci_ai; +GO +~~START~~ +varchar#!#varchar +لقد#!#لقد +~~END~~ + +SELECT upper(col), lower(col) FROM tab_arabic_ci_as; +GO +~~START~~ +varchar#!#varchar +لقد#!#لقد +~~END~~ + +SELECT upper(col), lower(col) FROM tab_arabic_cs_as; +GO +~~START~~ +varchar#!#varchar +لقد#!#لقد +~~END~~ + +SELECT upper(col), lower(col) FROM tab_chinese_ci_ai; +GO +~~START~~ +varchar#!#varchar +比尔·拉#!#比尔·拉 +~~END~~ + +SELECT upper(col), lower(col) FROM tab_chinese_ci_as; +GO +~~START~~ +varchar#!#varchar +比尔·拉#!#比尔·拉 +~~END~~ + +SELECT upper(col), lower(col) FROM tab_chinese_cs_as; +GO +~~START~~ +varchar#!#varchar +比尔·拉#!#比尔·拉 +~~END~~ + +EXEC dep_proc_upper +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +ANIKAIT #!#AGRAWAL #!#ANIKAIT #!#AGRAWAL +~~END~~ + +select dbo.dep_func_upper() +GO +~~START~~ +varchar +ANIKAIT +~~END~~ + + +SELECT * from dep_view_lower +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +anikait #!#agrawal #!#anikait #!#agrawal +~~END~~ + +EXEC dep_proc_lower +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +anikait #!#agrawal #!#anikait #!#agrawal +~~END~~ + +SELECT * from dep_view_upper_lower +GO +~~START~~ +varchar#!#varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +EXEC dep_proc_upper_lower +GO +~~START~~ +varchar#!#varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +SELECT * from dep_view_upper_lower1 +GO +~~START~~ +nvarchar#!#nvarchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +EXEC dep_proc_upper_lower1 +GO +~~START~~ +nvarchar#!#nvarchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +select dbo.dep_func_lower() +GO +~~START~~ +varchar +anikait +~~END~~ + +select dbo.tvp_func_upper_lower() +GO +~~START~~ +varchar +("ANIKAIT ","anikait ") +(" ANIKAIT"," anikait") +(" A"," a") +(" "," ") +("","") +(A,a) +(,) +(比??拉,比??拉) +~~END~~ + +SELECT * from dep_view_lower1 +GO +~~START~~ +varchar +adjnfjh +~~END~~ + +declare @b dbo.MyUDT = CAST('scsdc' AS dbo.MyUDT) +select upper(@b) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of upper function.)~~ + diff --git a/test/JDBC/expected/output_into_fires_trigger.out b/test/JDBC/expected/output_into_fires_trigger.out new file mode 100644 index 00000000000..d3700778b02 --- /dev/null +++ b/test/JDBC/expected/output_into_fires_trigger.out @@ -0,0 +1,418 @@ + + + + + +-- Below statements will fire an after trigger +-- INSERT non local table OUTPUT ... INTO local table +-- UPDATE non local table OUTPUT ... INTO local table +-- DELETE non local table OUTPUT ... INTO local table +-- REPEAT THE ABOVE INSIDE + -- PROCEDURE + -- TRIGGER + -- FUNCTION (functions should not be allowed to create for output to client or non local object) +-- SOME MORE CASES OF OUTPUT CLAUSE WHICH SHOULD NOT BE ALLOWED INSIDE PLTSQL FUNCTIONS +-- OUTPUT TO CLIENT & OUTPUT INTO NON LOCAL OBJECT +CREATE TABLE babel_4859_t (id INT) +GO + + +-- INSERT table OUTPUT ... INTO table variable +CREATE TRIGGER [dbo].[babel_4859_trigger_insert] + ON [dbo].[babel_4859_t] +AFTER INSERT +AS +SET NOCOUNT ON +SELECT 1; +GO + +DECLARE @babel_4859_tabvar TABLE (id INT); +INSERT INTO babel_4859_t OUTPUT INSERTED.id INTO @babel_4859_tabvar VALUES (4859), (9584), (2), (3) +GO +~~START~~ +int +1 +~~END~~ + +~~ROW COUNT: 4~~ + + +-- UPDATE table OUTPUT ... INTO table variable +CREATE TRIGGER [dbo].[babel_4859_trigger_update] + ON [dbo].[babel_4859_t] +AFTER UPDATE +AS +SET NOCOUNT ON +SELECT 1; +GO + +DECLARE @babel_4859_tabvar TABLE (id INT, id_old INT); +UPDATE babel_4859_t SET id = 77 OUTPUT INSERTED.id, DELETED.id INTO @babel_4859_tabvar +GO +~~START~~ +int +1 +~~END~~ + +~~ROW COUNT: 4~~ + + +-- DELETE table OUTPUT ... INTO table variable +CREATE TRIGGER [dbo].[babel_4859_trigger_delete] + ON [dbo].[babel_4859_t] +AFTER delete +AS +SET NOCOUNT ON +SELECT 1; +GO + +DECLARE @babel_4859_tabvar TABLE (id_old INT); +DELETE babel_4859_t OUTPUT DELETED.id INTO @babel_4859_tabvar +GO +~~START~~ +int +1 +~~END~~ + +~~ROW COUNT: 4~~ + + +-- INSERT table OUTPUT ... INTO table variable INSIDE PROCEDURE +CREATE PROCEDURE babel_4859_p +AS +DECLARE @babel_4859_tabvar TABLE (id INT); +INSERT INTO babel_4859_t OUTPUT INSERTED.id INTO @babel_4859_tabvar VALUES (4859), (9584), (2), (3) +GO + +EXEC babel_4859_p +GO +~~START~~ +int +1 +~~END~~ + +~~ROW COUNT: 4~~ + + +DROP PROC babel_4859_p +GO + +-- UPDATE table OUTPUT ... INTO table variable INSIDE PROCEDURE +CREATE PROCEDURE babel_4859_p +AS +DECLARE @babel_4859_tabvar TABLE (id INT, id_old INT); +UPDATE babel_4859_t SET id = 77 OUTPUT INSERTED.id, DELETED.id INTO @babel_4859_tabvar +GO + +EXEC babel_4859_p +GO +~~START~~ +int +1 +~~END~~ + +~~ROW COUNT: 4~~ + + +DROP PROC babel_4859_p +GO + +-- DELETE table OUTPUT ... INTO table variable INSIDE PROCEDURE +CREATE PROCEDURE babel_4859_p +AS +DECLARE @babel_4859_tabvar TABLE (id_old INT); +DELETE babel_4859_t OUTPUT DELETED.id INTO @babel_4859_tabvar +GO + +EXEC babel_4859_p +GO +~~START~~ +int +1 +~~END~~ + +~~ROW COUNT: 4~~ + + +DROP PROC babel_4859_p +GO + +CREATE TABLE babel_4859_t2 (id INT) +GO + +-- INSERT table OUTPUT ... INTO table variable INSIDE TRIGGER which will in turn fire another trigger +CREATE TRIGGER [dbo].[babel_4859_t2_trigger_insert] + ON [dbo].[babel_4859_t2] +AFTER INSERT +AS +SET NOCOUNT ON +DECLARE @babel_4859_tabvar TABLE (id INT); +INSERT INTO babel_4859_t OUTPUT INSERTED.id INTO @babel_4859_tabvar VALUES (4859), (9584), (2), (3) +SELECT * FROM @babel_4859_tabvar +GO + +INSERT INTO babel_4859_t2 VALUES (1) +GO +~~START~~ +int +1 +~~END~~ + +~~START~~ +int +4859 +9584 +2 +3 +~~END~~ + +~~ROW COUNT: 1~~ + + +DROP TRIGGER [dbo].[babel_4859_t2_trigger_insert] +GO + +-- UPDATE table OUTPUT ... INTO table variable INSIDE TRIGGER which will in turn fire another trigger +CREATE TRIGGER [dbo].[babel_4859_t2_trigger_insert] + ON [dbo].[babel_4859_t2] +AFTER INSERT +AS +SET NOCOUNT ON +DECLARE @babel_4859_tabvar TABLE (id INT, id_old INT); +UPDATE babel_4859_t SET id = 77 OUTPUT INSERTED.id, DELETED.id INTO @babel_4859_tabvar +SELECT * FROM @babel_4859_tabvar +GO + +INSERT INTO babel_4859_t2 VALUES (1) +GO +~~START~~ +int +1 +~~END~~ + +~~START~~ +int#!#int +77#!#4859 +77#!#9584 +77#!#2 +77#!#3 +~~END~~ + +~~ROW COUNT: 1~~ + + +DROP TRIGGER [dbo].[babel_4859_t2_trigger_insert] +GO + +-- DELETE table OUTPUT ... INTO table variable INSIDE TRIGGER which will in turn fire another trigger +CREATE TRIGGER [dbo].[babel_4859_t2_trigger_insert] + ON [dbo].[babel_4859_t2] +AFTER INSERT +AS +SET NOCOUNT ON +DECLARE @babel_4859_tabvar TABLE (id_old INT); +DELETE babel_4859_t OUTPUT DELETED.id INTO @babel_4859_tabvar +SELECT * FROM @babel_4859_tabvar +GO + +INSERT INTO babel_4859_t2 VALUES (1) +GO +~~START~~ +int +1 +~~END~~ + +~~START~~ +int +77 +77 +77 +77 +~~END~~ + +~~ROW COUNT: 1~~ + + +DROP TRIGGER [dbo].[babel_4859_t2_trigger_insert] +GO + + +-- INSERT table OUTPUT ... INTO table variable INSIDE FUNCTION +-- Should fail because inserting into non local object +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT); + INSERT INTO babel_4859_t OUTPUT INSERTED.id INTO @babel_4859_tabvar VALUES (4859), (9584), (2), (3) + RETURN 1 +END +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'INSERT' cannot be used within a function)~~ + + +-- UPDATE table OUTPUT ... INTO table variable INSIDE FUNCTION +-- Should fail because updating non local object +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT, id_old INT); + UPDATE babel_4859_t SET id = 77 OUTPUT INSERTED.id, DELETED.id INTO @babel_4859_tabvar + RETURN 1 +END +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'UPDATE' cannot be used within a function)~~ + + +-- DELETE table OUTPUT ... INTO table variable INSIDE FUNCTION +-- Should fail because deleting from non local object +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id_old INT); + DELETE babel_4859_t OUTPUT DELETED.id INTO @babel_4859_tabvar + RETURN 1 +END +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'DELETE' cannot be used within a function)~~ + + + + +-- OUTPUT TO CLIENT SHOUD BE BLOCKED INSIDE FUNCTIONS +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT); + INSERT INTO @babel_4859_tabvar OUTPUT INSERTED.id VALUES (4859), (9584), (2), (3) + RETURN 1 +END +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid use of a side-effecting operator 'INSERT' within a function.)~~ + + +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT); + UPDATE @babel_4859_tabvar SET id = 77 OUTPUT INSERTED.id, DELETED.id + RETURN 1 +END +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid use of a side-effecting operator 'UPDATE' within a function.)~~ + + +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT); + DELETE @babel_4859_tabvar OUTPUT DELETED.id + RETURN 1 +END +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid use of a side-effecting operator 'DELETE' within a function.)~~ + + + +-- OUTPUT INTO NON LOCAL OBJECTS SHOULD NOT BE ALLOWED INSIDE FUNCTIONS +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT); + INSERT INTO @babel_4859_tabvar OUTPUT INSERTED.id INTO babel_4859_t2 VALUES (4859), (9584), (2), (3) + RETURN 1 +END +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid use of a side-effecting operator 'INSERT' within a function.)~~ + + +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT); + UPDATE @babel_4859_tabvar SET id = 77 OUTPUT INSERTED.id INTO babel_4859_t2 + RETURN 1 +END +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid use of a side-effecting operator 'UPDATE' within a function.)~~ + + +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT); + DELETE @babel_4859_tabvar OUTPUT DELETED.id INTO babel_4859_t2 + RETURN 1 +END +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid use of a side-effecting operator 'DELETE' within a function.)~~ + + +-- OUTPUT INTO LOCAL OBJECTS SHOULD BE ALLOWED INSIDE FUNCTIONS +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT); + DECLARE @babel_4859_tabvar_2 TABLE (id INT); + INSERT INTO @babel_4859_tabvar OUTPUT INSERTED.id INTO @babel_4859_tabvar_2 VALUES (4859), (9584), (2), (3) + RETURN 1 +END +GO +DROP FUNCTION babel_4859_f1 +GO + +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT); + DECLARE @babel_4859_tabvar_2 TABLE (id INT); + UPDATE @babel_4859_tabvar SET id = 77 OUTPUT INSERTED.id INTO @babel_4859_tabvar_2 + RETURN 1 +END +GO +DROP FUNCTION babel_4859_f1 +GO + +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT); + DECLARE @babel_4859_tabvar_2 TABLE (id INT); + DELETE @babel_4859_tabvar OUTPUT DELETED.id INTO @babel_4859_tabvar_2 + RETURN 1 +END +GO +DROP FUNCTION babel_4859_f1 +GO + +DROP TABLE babel_4859_t, babel_4859_t2 +GO diff --git a/test/JDBC/expected/parallel_query/PARTITION-vu-verify.out b/test/JDBC/expected/parallel_query/PARTITION-vu-verify.out new file mode 100644 index 00000000000..402dd5e9d92 --- /dev/null +++ b/test/JDBC/expected/parallel_query/PARTITION-vu-verify.out @@ -0,0 +1,3855 @@ +--------------------------------------------------- +--- Check for inconsistent metadata after upgrade +---------------------------------------------------- +SELECT COUNT(*) FROM sys.babelfish_inconsistent_metadata(); +GO +~~START~~ +int +0 +~~END~~ + + +-------------------------------------------------- +--- CREATE PARTITION FUNCTION/SCHEME/TABLE using procedure +-------------------------------------------------- +EXEC PartitionProcedureCreatePartitionFunction +GO + +EXEC PartitionProcedureCreatePartitionScheme +GO + +EXEC PartitionProcedureCreatePartitionTable +GO + +EXEC PartitionProcedureCreatePartitionFunctionSchemeAndTable +GO + +-------------------------------------------------- +--- CREATE PARTITION FUNCTION/SCHEME/TABLE inside Function +-------------------------------------------------- +CREATE FUNCTION TestFunctionCreatePartitionFunction() +RETURNS INT +AS +BEGIN + CREATE PARTITION FUNCTION TestPartitionFunction (int) + AS RANGE RIGHT FOR VALUES (500, 1000, 10000); + RETURN 1; +END; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid use of a side-effecting operator 'CREATE PARTITION FUNCTION' within a function.)~~ + + +CREATE FUNCTION TestFunctionDropPartitionFunction() +RETURNS INT +AS +BEGIN + DROP PARTITION FUNCTION IntPartitionFunction; + RETURN 1; +END; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid use of a side-effecting operator 'DROP PARTITION FUNCTION' within a function.)~~ + + +CREATE FUNCTION TestFunctionCreatePartitionScheme() +RETURNS INT +AS +BEGIN + CREATE PARTITION SCHEME TestPartitionScheme AS + PARTITION IntPartitionFunction + ALL TO ([PRIMARY]); + RETURN 1; +END; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid use of a side-effecting operator 'CREATE PARTITION SCHEME' within a function.)~~ + + +CREATE FUNCTION TestFunctionDropPartitionScheme() +RETURNS INT +AS +BEGIN + DROP PARTITION SCHEME IntPartitionScheme; + RETURN 1; +END; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid use of a side-effecting operator 'DROP PARTITION SCHEME' within a function.)~~ + + +CREATE FUNCTION TestFunctionCreatePartitionTable() +RETURNS INT +AS +BEGIN + CREATE TABLE TestPartitionTable ( + Id INT, + Value sys.varchar(20) + ) ON IntPartitionScheme(Id); +END; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: DDL cannot be used within a function)~~ + + +CREATE FUNCTION TestFunctionDropPartitionTable() +RETURNS INT +AS +BEGIN + DROP TABLE partition_vu_prepare_int_table; + RETURN 1; +END; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: DDL cannot be used within a function)~~ + + + +--------------------------------------------------------- +--- CREATE PARTITION FUNCTION/SCHEME using 2-part name +--------------------------------------------------------- +CREATE PARTITION FUNCTION [TestDb].[TwoPartParitionFunction](DATE) +AS RANGE RIGHT FOR VALUES ('20230101', '20230201', '20230301', '20230401'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '.' at line 4 and character position 34)~~ + + +CREATE PARTITION SCHEME [TestDb].[TwoPartParitionScheme] +AS PARTITION [TestDb].[TwoPartPF] +TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '.' at line 1 and character position 32)~~ + + +-------------------------------------------------- +--- Unsupported Datatypes for Partition Function +-------------------------------------------------- +CREATE PARTITION FUNCTION VarcharMaxPartitionFunction (VARCHAR(MAX)) +AS RANGE RIGHT FOR VALUES ('A', 'B', 'C', 'D'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'varchar(max)' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION NVarcharMaxPartitionFunction (NVARCHAR(MAX)) +AS RANGE RIGHT FOR VALUES (N'A', N'B', N'C', N'D'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'nvarchar(max)' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION VarbinaryMaxPartitionFunction (VARBINARY(MAX)) +AS RANGE RIGHT FOR VALUES (0x000, 0x800, 0x400, 0xC000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'varbinary(max)' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION BinaryMaxPartitionFunction (BINARY(MAX)) +AS RANGE RIGHT FOR VALUES (0x000, 0x800, 0x400, 0xC000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Incorrect syntax near the keyword 'binary'.)~~ + + +CREATE PARTITION FUNCTION TextPartitionFunction (text) +AS RANGE RIGHT FOR VALUES ('a', 'b', 'c'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'text' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION NTextPartitionFunction (ntext) +AS RANGE RIGHT FOR VALUES (N'a', N'b', N'c'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'ntext' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION ImagePartitionFunction (image) +AS RANGE RIGHT FOR VALUES (0x123456, 0x789ABC, 0xDEF012); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'image' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION XmlPartitionFunction (xml) +AS RANGE RIGHT FOR VALUES ('1', '2', '3'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'xml' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION GeometryPartitionFunction (GEOMETRY) +AS RANGE RIGHT FOR VALUES (GEOMETRY::STGeomFromText('POINT(1 1)', 0)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'geometry' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION GeometryPartitionFunction (GEOGRAPHY) +AS RANGE RIGHT FOR VALUES (GEOMETRY::STGeomFromText('POINT(1 1)', 0)); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'geography' is not valid for this operation.)~~ + + +-- to test rowversion and timestamp +SELECT SET_CONFIG('babelfishpg_tsql.escape_hatch_rowversion', 'ignore', 'false') +go +~~START~~ +text +ignore +~~END~~ + + +CREATE PARTITION FUNCTION RowVersionPartitionFunction (ROWVERSION) +AS RANGE RIGHT FOR VALUES (0x0000000000000000, 0x0000000000000001, 0x0000000000000002); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'rowversion' is not valid for this operation.)~~ + + +CREATE PARTITION FUNCTION TimestampPartitionFunction (TIMESTAMP) +AS RANGE RIGHT FOR VALUES (0x0000000000000000, 0x0000000000000001, 0x0000000000000002); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'timestamp' is not valid for this operation.)~~ + + +-- reset back the escape hatch +SELECT SET_CONFIG('babelfishpg_tsql.escape_hatch_rowversion', 'strict', 'true') +go +~~START~~ +text +strict +~~END~~ + + +-- user defined type +CREATE TYPE PartitionUserDefinedType FROM VARCHAR(10); +GO + +CREATE PARTITION FUNCTION UdtPartitionFunction (PartitionUserDefinedType) +AS RANGE RIGHT FOR VALUES ('a', 'b', 'c'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'partitionuserdefinedtype' is not valid for this operation.)~~ + + +DROP type PartitionUserDefinedType +GO + +------------------------------------------------------------------------------ +--- Duplicate range values for all supported datatypes in Partition Function +------------------------------------------------------------------------------ +CREATE PARTITION FUNCTION IntPartitionFunctionContainsDuplicateValue (int) +AS RANGE RIGHT FOR VALUES (0, 100, 1000, 100); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION BigIntPartitionFunctionContainsDuplicateValue (bigint) +AS RANGE RIGHT FOR VALUES (0, 500, 100, 500, 1000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION SmallIntPartitionFunctionContainsDuplicateValue (smallint) +AS RANGE RIGHT FOR VALUES (32767, 10, -32768, 0, 10); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION TinyIntPartitionFunctionContainsDuplicateValue (tinyint) +AS RANGE RIGHT FOR VALUES (0, 255, 128, 255); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION DecimalPartitionFunctionContainsDuplicateValue (decimal(10, 5)) +AS RANGE RIGHT FOR VALUES (0.0, 300.0, 200.0, 100.0, 300.0); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION NumericPartitionFunctionContainsDuplicateValue (numeric(5, 2)) +AS RANGE RIGHT FOR VALUES (0.0, 30.0, 10.0, 20.0, 30.0); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION DatePartitionFunctionContainsDuplicateValue (date) +AS RANGE RIGHT FOR VALUES ('2022-07-01', '2022-01-01','2023-01-01','2022-01-01'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION DateTimePartitionFunctionContainsDuplicateValue (datetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01 00:00:00', '2019-01-01 00:00:00', '2022-01-01'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION DateTime2PartitionFunctionContainsDuplicateValue (datetime2(3)) +AS RANGE RIGHT FOR VALUES ('2022-01-01 00:00:00.000', '2022-07-01 00:00:00.000', '2019-01-01 00:00:00.000', '2022-07-01 00:00:00.000'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION SmallDateTimePartitionFunctionContainsDuplicateValue (smalldatetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01', '2019-01-01', '2022-07-01'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION CharPartitionFunctionContainsDuplicateValue (char(5)) +AS RANGE RIGHT FOR VALUES ('A', 'F', 'K', 'P', 'U', 'Z', 'D', 'K'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION VarCharPartitionFunctionContainsDuplicateValue (varchar(10)) +AS RANGE RIGHT FOR VALUES ('Apple', 'Banana', 'Mango', 'Cherry', 'Date', 'Banana'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION NVarCharPartitionFunctionContainsDuplicateValue (nvarchar(10)) +AS RANGE RIGHT FOR VALUES (N'Apple', N'Banana', N'Mango', N'Cherry', N'Date', N'Banana'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION NCharPartitionFunctionContainsDuplicateValue (nchar(5)) +AS RANGE RIGHT FOR VALUES (N'A', N'F', N'K', N'P', N'U', N'Z', N'B', N'K'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION BinaryPartitionFunctionContainsDuplicateValue (binary(4)) +AS RANGE RIGHT FOR VALUES (0x000, 0x800, 0x400, 0xC000, 0x800); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION VarBinaryPartitionFunctionContainsDuplicateValue (varbinary(8)) +AS RANGE RIGHT FOR VALUES (0x0000000000000000, 0x8000000000000000, 0x4000000000000000, 0xC000000000000000, 0x8000000000000000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION UniqueIdentifierPartitionFunctionContainsDuplicateValue (uniqueidentifier) +AS RANGE RIGHT FOR VALUES ('00000000-0000-0000-0000-000000000000', '6F9619FF-8B86-D011-B42D-00C04FC964FF', 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF', '6F9619FF-8B86-D011-B42D-00C04FC964FF'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Duplicate values are not allowed in partition function boundary values list.)~~ + + +-------------------------------------------------- +--- Unsupported Options with Partition Function +-------------------------------------------------- +-- LEFT option is not supported in Babelfish +CREATE PARTITION FUNCTION PartitionFunctionWithLeft (int) +AS RANGE LEFT FOR VALUES (10, 1000, 10000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'PARTIION FUNCTION with LEFT option' is not currently supported in Babelfish)~~ + + +-- sql_variant is not yet supported in Babelfish +CREATE PARTITION FUNCTION SqlVariantPartitionFunction (sql_variant) +AS RANGE RIGHT +FOR VALUES ( + CAST('abc' AS char(5)), + CAST(N'xyz' AS nchar(5)), + CAST('Apple' AS VARCHAR(10)), + CAST(N'Banana' AS NVARCHAR(10)), + CAST('Some text' AS SQL_VARIANT) +); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The type 'sql_variant' is not yet supported for partition function in Babelfish.)~~ + + +-- by default it is LEFT and it should throw error +CREATE PARTITION FUNCTION PartitionFunctionWithLeft (int) +AS RANGE FOR VALUES (10, 1000, 10000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'PARTIION FUNCTION with LEFT option' is not currently supported in Babelfish)~~ + + +-- NULL value is not supported in range values +CREATE PARTITION FUNCTION PartitionFunctionWithNULL (int) +AS RANGE RIGHT FOR VALUES (10, 1000, NULL); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: NULL values are not allowed in partition function boundary values list.)~~ + + +CREATE PARTITION FUNCTION PartitionFunctionWithNULL (int) +AS RANGE RIGHT FOR VALUES (10, 1000, NULL, NULL); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: NULL values are not allowed in partition function boundary values list.)~~ + + +-------------------------------------------------- +--- Duplicate Create of Partition Function/Scheme +-------------------------------------------------- +CREATE PARTITION FUNCTION IntPartitionFunction (int) +AS RANGE RIGHT FOR VALUES (500, 1000, 10000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: There is already an object named 'IntPartitionFunction' in the database.)~~ + + +-- duplicate partition function with invalid args +CREATE PARTITION FUNCTION IntPartitionFunction (int) +AS RANGE RIGHT FOR VALUES ('xyz', CONVERT(DATETIME, '2023-05-01'), 0x789ABC); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: There is already an object named 'IntPartitionFunction' in the database.)~~ + + +CREATE PARTITION SCHEME IntPartitionScheme AS +PARTITION IntPartitionFunction +ALL TO ([PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: There is already an object named 'IntPartitionScheme' in the database.)~~ + + +-- duplicate partition scheme with invalid Partition function +CREATE PARTITION SCHEME IntPartitionScheme AS +PARTITION PartitionFunctionDoesNotExists +ALL TO ([PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid object name 'PartitionFunctionDoesNotExists'.)~~ + + +----------------------------------------------------------------------------------- +--- Drop of of Partition Function/Scheme when it does not exists +----------------------------------------------------------------------------------- +DROP PARTITION FUNCTION PartitionFunctionDoesNotExists +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the partition function 'PartitionFunctionDoesNotExists', because it does not exist or you do not have permission.)~~ + + +DROP PARTITION SCHEME PartitionSchemeDoesNotExists +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the partition scheme 'PartitionSchemeDoesNotExists', because it does not exist or you do not have permission.)~~ + + +----------------------------------------------------------------------------------- +--- Create of Partition Scheme when provided partition function doesn't exists +----------------------------------------------------------------------------------- +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION PartitionFunctionDoesNotExists +ALL TO ([PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid object name 'PartitionFunctionDoesNotExists'.)~~ + + +----------------------------------------------------------------------------------- +--- Drop of of Partition Function when there is dependent Partition Scheme +----------------------------------------------------------------------------------- +DROP PARTITION FUNCTION IntPartitionFunction +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition function 'IntPartitionFunction' is being used by one or more partition schemes.)~~ + + +----------------------------------------------------------------------------------- +--- Drop of of Partition Scheme when there is dependent Table on it +----------------------------------------------------------------------------------- +DROP PARTITION SCHEME IntPartitionScheme +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The partition scheme "IntPartitionScheme" is currently being used to partition one or more tables.)~~ + + + + +----------------------------------------------- +--- Filegroup behaviour with Partition Scheme +----------------------------------------------- +-- by default user filegroup will be treated as PRIMARY filegroup +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION IntPartitionFunction +ALL TO (user_filegroup); +GO + +DROP PARTITION SCHEME TestPartitionScheme +GO + +-- User can configure the "escape_hatch_storage_options" to STRICT to disallow user filegroups +SELECT SET_CONFIG('babelfishpg_tsql.escape_hatch_storage_options', 'strict', 'false') +GO +~~START~~ +text +strict +~~END~~ + + +-- should throw error +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION IntPartitionFunction +ALL TO (user_filegroup); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'user filegroup' is not currently supported in Babelfish. please use babelfishpg_tsql.escape_hatch_storage_options to ignore)~~ + + +-- reset it back +SELECT SET_CONFIG('babelfishpg_tsql.escape_hatch_storage_options', 'ignore', 'false') +GO +~~START~~ +text +ignore +~~END~~ + + +-- when more than one filegroup are specified with ALL option +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION IntPartitionFunction +ALL TO ([PRIMARY], [PRIMARY], [PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Only a single filegroup can be specified while creating partition scheme using option ALL to specify all the filegroups.)~~ + + +-- when partition function generates more partition than specified filegroups +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION IntPartitionFunction +TO ([PRIMARY], [PRIMARY], [PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The associated partition function 'IntPartitionFunction' generates more partitions than there are file groups mentioned in the scheme 'TestPartitionScheme'.)~~ + + + +--------------------------------- +--- Metadata Related Tests +--------------------------------- +SELECT * FROM GetPartitionFunctionMetadataView +GO +~~START~~ +nvarchar#!#char#!#nvarchar#!#int#!#bit#!#bit +BigIntPartitionFunction#!#R #!#RANGE#!#5#!#1#!#0 +BinaryPartitionFunction#!#R #!#RANGE#!#5#!#1#!#0 +CharPartitionFunction#!#R #!#RANGE#!#8#!#1#!#0 +DatePartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +DateTime2PartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +DateTimePartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +DecimalPartitionFunction#!#R #!#RANGE#!#5#!#1#!#0 +IntPartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +MoneyPartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +NCharPartitionFunction#!#R #!#RANGE#!#8#!#1#!#0 +NumericPartitionFunction#!#R #!#RANGE#!#5#!#1#!#0 +NVarCharPartitionFunction#!#R #!#RANGE#!#6#!#1#!#0 +PARTITION_FUNCTION 유니코드스키마👻 #!#R #!#RANGE#!#4#!#1#!#0 +PARTITION_FUNCTION 😎$@ #123 🌍rder #!#R #!#RANGE#!#4#!#1#!#0 +PARTITION_FUNCTIONログインαιώνια#!#R #!#RANGE#!#4#!#1#!#0 +PartitionFunctionHavingDifferentCollationInput#!#R #!#RANGE#!#5#!#1#!#0 +PartitionFunctionInsideProc1#!#R #!#RANGE#!#4#!#1#!#0 +PartitionFunctionInsideProc2#!#R #!#RANGE#!#4#!#1#!#0 +PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#R #!#RANGE#!#5#!#1#!#0 +PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#R #!#RANGE#!#5#!#1#!#0 +SmallDateTimePartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +SmallIntPartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +SmallMoneyPartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +TinyIntPartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +UniqueIdentifierPartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +VarBinaryPartitionFunction#!#R #!#RANGE#!#5#!#1#!#0 +VarCharPartitionFunction#!#R #!#RANGE#!#6#!#1#!#0 +~~END~~ + + +SELECT * FROM GetRangeMetadataView +GO +~~START~~ +nvarchar#!#int#!#int#!#sql_variant +BigIntPartitionFunction#!#1#!#1#!#0 +BigIntPartitionFunction#!#1#!#2#!#100 +BigIntPartitionFunction#!#1#!#3#!#1000 +BigIntPartitionFunction#!#1#!#4#!#10000 +CharPartitionFunction#!#1#!#1#!#A +CharPartitionFunction#!#1#!#2#!#D +CharPartitionFunction#!#1#!#3#!#F +CharPartitionFunction#!#1#!#4#!#K +CharPartitionFunction#!#1#!#5#!#P +CharPartitionFunction#!#1#!#6#!#U +CharPartitionFunction#!#1#!#7#!#Z +DatePartitionFunction#!#1#!#1#!#2022-01-01 +DatePartitionFunction#!#1#!#2#!#2022-07-01 +DatePartitionFunction#!#1#!#3#!#2023-01-01 +DateTime2PartitionFunction#!#1#!#1#!#2019-01-01 00:00:00.0 +DateTime2PartitionFunction#!#1#!#2#!#2022-01-01 00:00:00.0 +DateTime2PartitionFunction#!#1#!#3#!#2022-07-01 00:00:00.0 +DateTimePartitionFunction#!#1#!#1#!#2019-01-01 00:00:00.0 +DateTimePartitionFunction#!#1#!#2#!#2022-01-01 00:00:00.0 +DateTimePartitionFunction#!#1#!#3#!#2022-07-01 00:00:00.0 +DecimalPartitionFunction#!#1#!#1#!#0.00000 +DecimalPartitionFunction#!#1#!#2#!#100.00000 +DecimalPartitionFunction#!#1#!#3#!#200.00000 +DecimalPartitionFunction#!#1#!#4#!#300.00000 +IntPartitionFunction#!#1#!#1#!#0 +IntPartitionFunction#!#1#!#2#!#500 +IntPartitionFunction#!#1#!#3#!#1000 +MoneyPartitionFunction#!#1#!#1#!#2.5679 +MoneyPartitionFunction#!#1#!#2#!#3.5679 +MoneyPartitionFunction#!#1#!#3#!#4.9100 +NCharPartitionFunction#!#1#!#1#!#A +NCharPartitionFunction#!#1#!#2#!#B +NCharPartitionFunction#!#1#!#3#!#F +NCharPartitionFunction#!#1#!#4#!#K +NCharPartitionFunction#!#1#!#5#!#P +NCharPartitionFunction#!#1#!#6#!#U +NCharPartitionFunction#!#1#!#7#!#Z +NumericPartitionFunction#!#1#!#1#!#0.00 +NumericPartitionFunction#!#1#!#2#!#10.00 +NumericPartitionFunction#!#1#!#3#!#20.00 +NumericPartitionFunction#!#1#!#4#!#30.00 +NVarCharPartitionFunction#!#1#!#1#!#Apple +NVarCharPartitionFunction#!#1#!#2#!#Banana +NVarCharPartitionFunction#!#1#!#3#!#Cherry +NVarCharPartitionFunction#!#1#!#4#!#Date +NVarCharPartitionFunction#!#1#!#5#!#Mango +PARTITION_FUNCTION 유니코드스키마👻 #!#1#!#1#!#0 +PARTITION_FUNCTION 유니코드스키마👻 #!#1#!#2#!#500 +PARTITION_FUNCTION 유니코드스키마👻 #!#1#!#3#!#1000 +PARTITION_FUNCTION 😎$@ #123 🌍rder #!#1#!#1#!#0 +PARTITION_FUNCTION 😎$@ #123 🌍rder #!#1#!#2#!#500 +PARTITION_FUNCTION 😎$@ #123 🌍rder #!#1#!#3#!#1000 +PARTITION_FUNCTIONログインαιώνια#!#1#!#1#!#0 +PARTITION_FUNCTIONログインαιώνια#!#1#!#2#!#500 +PARTITION_FUNCTIONログインαιώνια#!#1#!#3#!#1000 +PartitionFunctionHavingDifferentCollationInput#!#1#!#1#!#châu phố +PartitionFunctionHavingDifferentCollationInput#!#1#!#2#!#Jane Smith +PartitionFunctionHavingDifferentCollationInput#!#1#!#3#!#John Doe +PartitionFunctionHavingDifferentCollationInput#!#1#!#4#!#Müller GmbH +PartitionFunctionInsideProc1#!#1#!#1#!#500 +PartitionFunctionInsideProc1#!#1#!#2#!#1000 +PartitionFunctionInsideProc1#!#1#!#3#!#10000 +PartitionFunctionInsideProc2#!#1#!#1#!#500 +PartitionFunctionInsideProc2#!#1#!#2#!#1000 +PartitionFunctionInsideProc2#!#1#!#3#!#10000 +PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#1#!#1#!#0 +PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#1#!#2#!#100 +PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#1#!#3#!#1000 +PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#1#!#4#!#10000 +PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#1#!#1#!#0 +PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#1#!#2#!#100 +PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#1#!#3#!#1000 +PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#1#!#4#!#10000 +SmallDateTimePartitionFunction#!#1#!#1#!#2019-01-01 00:00:00.0 +SmallDateTimePartitionFunction#!#1#!#2#!#2022-01-01 00:00:00.0 +SmallDateTimePartitionFunction#!#1#!#3#!#2022-07-01 00:00:00.0 +SmallIntPartitionFunction#!#1#!#1#!#-32768 +SmallIntPartitionFunction#!#1#!#2#!#0 +SmallIntPartitionFunction#!#1#!#3#!#32767 +SmallMoneyPartitionFunction#!#1#!#1#!#2.5679 +SmallMoneyPartitionFunction#!#1#!#2#!#3.5679 +SmallMoneyPartitionFunction#!#1#!#3#!#4.9100 +TinyIntPartitionFunction#!#1#!#1#!#0 +TinyIntPartitionFunction#!#1#!#2#!#128 +TinyIntPartitionFunction#!#1#!#3#!#255 +UniqueIdentifierPartitionFunction#!#1#!#1#!#00000000-0000-0000-0000-000000000000 +UniqueIdentifierPartitionFunction#!#1#!#2#!#6F9619FF-8B86-D011-B42D-00C04FC964FF +UniqueIdentifierPartitionFunction#!#1#!#3#!#FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF +VarCharPartitionFunction#!#1#!#1#!#Apple +VarCharPartitionFunction#!#1#!#2#!#Banana +VarCharPartitionFunction#!#1#!#3#!#Cherry +VarCharPartitionFunction#!#1#!#4#!#Date +VarCharPartitionFunction#!#1#!#5#!#Mango +~~END~~ + + +SELECT * FROM GetRangeMetadataVarBinaryFunctionView +GO +~~START~~ +nvarchar#!#int#!#int#!#varbinary +BinaryPartitionFunction#!#1#!#1#!#00000000 +BinaryPartitionFunction#!#1#!#2#!#04000000 +BinaryPartitionFunction#!#1#!#3#!#08000000 +BinaryPartitionFunction#!#1#!#4#!#C0000000 +VarBinaryPartitionFunction#!#1#!#1#!#0000000000000000 +VarBinaryPartitionFunction#!#1#!#2#!#4000000000000000 +VarBinaryPartitionFunction#!#1#!#3#!#8000000000000000 +VarBinaryPartitionFunction#!#1#!#4#!#C000000000000000 +~~END~~ + + +SELECT * FROM GetParameterMetadataView +GO +~~START~~ +nvarchar#!#varchar#!#int#!#smallint#!#tinyint#!#tinyint#!#varchar +BigIntPartitionFunction#!#bigint#!#1#!#8#!#19#!#0#!# +BinaryPartitionFunction#!#binary#!#1#!#8000#!#0#!#0#!# +CharPartitionFunction#!#char#!#1#!#8000#!#0#!#0#!#bbf_unicode_cp1_ci_as +DatePartitionFunction#!#date#!#1#!#3#!#10#!#0#!# +DateTime2PartitionFunction#!#datetime2#!#1#!#8#!#26#!#6#!# +DateTimePartitionFunction#!#datetime#!#1#!#8#!#23#!#3#!# +DecimalPartitionFunction#!#decimal#!#1#!#17#!#38#!#38#!# +IntPartitionFunction#!#int#!#1#!#4#!#10#!#0#!# +MoneyPartitionFunction#!#money#!#1#!#8#!#19#!#4#!# +NCharPartitionFunction#!#nchar#!#1#!#8000#!#0#!#0#!#bbf_unicode_cp1_ci_as +NumericPartitionFunction#!#numeric#!#1#!#17#!#38#!#38#!# +NVarCharPartitionFunction#!#nvarchar#!#1#!#8000#!#0#!#0#!#bbf_unicode_cp1_ci_as +PARTITION_FUNCTION 유니코드스키마👻 #!#int#!#1#!#4#!#10#!#0#!# +PARTITION_FUNCTION 😎$@ #123 🌍rder #!#int#!#1#!#4#!#10#!#0#!# +PARTITION_FUNCTIONログインαιώνια#!#int#!#1#!#4#!#10#!#0#!# +PartitionFunctionHavingDifferentCollationInput#!#nvarchar#!#1#!#8000#!#0#!#0#!#bbf_unicode_cp1_ci_as +PartitionFunctionInsideProc1#!#int#!#1#!#4#!#10#!#0#!# +PartitionFunctionInsideProc2#!#int#!#1#!#4#!#10#!#0#!# +PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#bigint#!#1#!#8#!#19#!#0#!# +PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#bigint#!#1#!#8#!#19#!#0#!# +SmallDateTimePartitionFunction#!#smalldatetime#!#1#!#4#!#16#!#0#!# +SmallIntPartitionFunction#!#smallint#!#1#!#2#!#5#!#0#!# +SmallMoneyPartitionFunction#!#smallmoney#!#1#!#4#!#10#!#4#!# +TinyIntPartitionFunction#!#tinyint#!#1#!#1#!#3#!#0#!# +UniqueIdentifierPartitionFunction#!#uniqueidentifier#!#1#!#16#!#0#!#0#!# +VarBinaryPartitionFunction#!#varbinary#!#1#!#8000#!#0#!#0#!# +VarCharPartitionFunction#!#varchar#!#1#!#8000#!#0#!#0#!#bbf_unicode_cp1_ci_as +~~END~~ + + +SELECT * FROM GetPartitionSchemesMetadataView +GO +~~START~~ +nvarchar#!#nvarchar#!#char#!#nvarchar#!#bit#!#bit +BigIntPartitionScheme#!#BigIntPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +BinaryPartitionScheme#!#BinaryPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +CharPartitionScheme#!#CharPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +DatePartitionScheme#!#DatePartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +DateTime2PartitionScheme#!#DateTime2PartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +DateTimePartitionScheme#!#DateTimePartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +DecimalPartitionScheme#!#DecimalPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +IntPartitionScheme#!#IntPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +MoneyPartitionScheme#!#MoneyPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +NCharPartitionScheme#!#NCharPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +NumericPartitionScheme#!#NumericPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +NVarCharPartitionScheme#!#NVarCharPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +PARTITION_SCHEME 유니코드스키마👻 #!#PARTITION_FUNCTION 유니코드스키마👻 #!#PS#!#PARTITION_SCHEME#!#0#!#0 +PARTITION_SCHEME 😎$@ #123 🌍rder #!#PARTITION_FUNCTION 😎$@ #123 🌍rder #!#PS#!#PARTITION_SCHEME#!#0#!#0 +PARTITION_SCHEMEログインαιώνια#!#PARTITION_FUNCTIONログインαιώνια#!#PS#!#PARTITION_SCHEME#!#0#!#0 +PartitionSchemeInsideProc1#!#PartitionFunctionInsideProc1#!#PS#!#PARTITION_SCHEME#!#0#!#0 +PartitionSchemeInsideProc2#!#PartitionFunctionInsideProc2#!#PS#!#PARTITION_SCHEME#!#0#!#0 +PartitionSchemeNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz#!#PS#!#PARTITION_SCHEME#!#0#!#0 +PartitionSchemeNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder#!#PS#!#PARTITION_SCHEME#!#0#!#0 +SmallDateTimePartitionScheme#!#SmallDateTimePartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +SmallIntPartitionScheme#!#SmallIntPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +SmallMoneyPartitionScheme#!#SmallMoneyPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +TinyIntPartitionScheme#!#TinyIntPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +UniqueIdentifierPartitionScheme#!#UniqueIdentifierPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +VarBinaryPartitionScheme#!#VarBinaryPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +VarCharPartitionScheme#!#VarCharPartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +~~END~~ + + +SELECT * FROM PartitionFunctionContainsDuplicateName() +GO +~~START~~ +nvarchar +~~END~~ + + +SELECT * FROM PartitionFunctionContainsDuplicateIDs() +GO +~~START~~ +int +~~END~~ + + +SELECT * FROM PartitionSchemeContainsDuplicateName() +GO +~~START~~ +nvarchar +~~END~~ + + +SELECT * FROM PartitionSchemeContainsDuplicateIDs() +GO +~~START~~ +int +~~END~~ + + +SELECT * FROM GetPartitionSchemeOrFilegroupForTableOrIndex +GO +~~START~~ +varchar#!#varchar#!#nvarchar +partition_vu_prepare_bigint_table#!##!#BigIntPartitionScheme +partition_vu_prepare_bigint_table#!#partition_vu_prepare_bigint_ind877afb285426cec9d46b047e3cf96f63#!#BigIntPartitionScheme +partition_vu_prepare_binary_table#!##!#BinaryPartitionScheme +partition_vu_prepare_binary_table#!#partition_vu_prepare_binary_ind48a88b3c8178211af1ed1dcf4cfbe503#!#BinaryPartitionScheme +partition_vu_prepare_char_table#!##!#CharPartitionScheme +partition_vu_prepare_char_table#!#partition_vu_prepare_char_index32fed8129381de1b5745e90cd811516f#!#CharPartitionScheme +partition_vu_prepare_date_table#!##!#DatePartitionScheme +partition_vu_prepare_date_table#!#partition_vu_prepare_date_indexf571a291edad587ba646fc34c4566844#!#DatePartitionScheme +partition_vu_prepare_datetime_table#!##!#DateTimePartitionScheme +partition_vu_prepare_datetime_table#!#partition_vu_prepare_datetime_i364577d0a406eee6e806be980ac15d2e#!#DateTimePartitionScheme +partition_vu_prepare_datetime2_table#!##!#DateTime2PartitionScheme +partition_vu_prepare_datetime2_table#!#partition_vu_prepare_datetime2_4cad7647322c234b34b97cddb3cd1ad6#!#DateTime2PartitionScheme +partition_vu_prepare_decimal_table#!##!#DecimalPartitionScheme +partition_vu_prepare_decimal_table#!#partition_vu_prepare_decimal_infc7570aeccbb040dde39974c476a7ec9#!#DecimalPartitionScheme +partition_vu_prepare_int_table#!##!#IntPartitionScheme +partition_vu_prepare_int_table#!#partition_vu_prepare_int_indexpbbe9a6f0ef5edf6e63fa853dac4ed046#!#IntPartitionScheme +partition_vu_prepare_int_table#!#partition_vu_prepare_int_table_id_key#!#IntPartitionScheme +partition_vu_prepare_money_table#!##!#MoneyPartitionScheme +partition_vu_prepare_money_table#!#partition_vu_prepare_money_inde9b6a61ad06c0883c6d0f95b2fec9eeee#!#MoneyPartitionScheme +partition_vu_prepare_nchar_table#!##!#NCharPartitionScheme +partition_vu_prepare_nchar_table#!#partition_vu_prepare_nchar_indecdc4872501ea902494c8f710f4e9dbb1#!#NCharPartitionScheme +partition_vu_prepare_normal_table#!##!#PRIMARY +partition_vu_prepare_normal_table#!#partition_vu_prepare_normal_inded6315af14d88f45711ba24e46851b8f#!#PRIMARY +partition_vu_prepare_numeric_table#!##!#NumericPartitionScheme +partition_vu_prepare_numeric_table#!#partition_vu_prepare_numeric_inf04f315c86929345e23bee80713cf963#!#NumericPartitionScheme +partition_vu_prepare_nvarchar_table#!##!#NVarCharPartitionScheme +partition_vu_prepare_nvarchar_table#!#partition_vu_prepare_nvarchar_if89fa8cc46282fa6dc23e9f5b834f3ec#!#NVarCharPartitionScheme +partition_vu_prepare_smalldatetime_table#!##!#SmallDateTimePartitionScheme +partition_vu_prepare_smalldatetime_table#!#partition_vu_prepare_smalldatetfe8f8bfb8c766f9a1bcd804238ff35d8#!#SmallDateTimePartitionScheme +partition_vu_prepare_smallint_table#!##!#SmallIntPartitionScheme +partition_vu_prepare_smallint_table#!#partition_vu_prepare_smallint_i3eae48e3a131ed23416aa2891b58d579#!#SmallIntPartitionScheme +partition_vu_prepare_smallmoney_table#!##!#SmallMoneyPartitionScheme +partition_vu_prepare_smallmoney_table#!#partition_vu_prepare_smallmoney68389bf5dc5c581b33c4dbb8a3dc1dc8#!#SmallMoneyPartitionScheme +partition_vu_prepare_tinyint_table#!##!#TinyIntPartitionScheme +partition_vu_prepare_tinyint_table#!#partition_vu_prepare_tinyint_in02b271c73e639954190c6a45bd5dd1bb#!#TinyIntPartitionScheme +partition_vu_prepare_uniqueidentifier_table#!##!#UniqueIdentifierPartitionScheme +partition_vu_prepare_uniqueidentifier_table#!#partition_vu_prepare_uniqueidend39220cd3f46c5b2cea8c338a387aedf#!#UniqueIdentifierPartitionScheme +partition_vu_prepare_varbinary_table#!##!#VarBinaryPartitionScheme +partition_vu_prepare_varbinary_table#!#partition_vu_prepare_varbinary_26e1223f68c4186a96126a57446ac386#!#VarBinaryPartitionScheme +partition_vu_prepare_varchar_table#!##!#VarCharPartitionScheme +partition_vu_prepare_varchar_table#!#partition_vu_prepare_varchar_inc528f397ba573964de161e03035b8f08#!#VarCharPartitionScheme +~~END~~ + + +SELECT * FROM GetFileGroupMappingOfPartitionScheme +GO +~~START~~ +nvarchar#!#nvarchar#!#int +IntPartitionScheme#!#PRIMARY#!#1 +IntPartitionScheme#!#PRIMARY#!#2 +IntPartitionScheme#!#PRIMARY#!#3 +IntPartitionScheme#!#PRIMARY#!#4 +SmallIntPartitionScheme#!#PRIMARY#!#1 +SmallIntPartitionScheme#!#PRIMARY#!#2 +SmallIntPartitionScheme#!#PRIMARY#!#3 +SmallIntPartitionScheme#!#PRIMARY#!#4 +SmallIntPartitionScheme#!#PRIMARY#!#5 +~~END~~ + + +SELECT * FROM GetPartitionedTablePartitioningColumn +GO +~~START~~ +varchar#!#varchar#!#tinyint +partition_vu_prepare_bigint_table#!#id#!#1 +partition_vu_prepare_binary_table#!#id#!#1 +partition_vu_prepare_char_table#!#id#!#1 +partition_vu_prepare_date_table#!#id#!#1 +partition_vu_prepare_datetime_table#!#id#!#1 +partition_vu_prepare_datetime2_table#!#id#!#1 +partition_vu_prepare_decimal_table#!#id#!#1 +partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_money_table#!#id#!#1 +partition_vu_prepare_nchar_table#!#id#!#1 +partition_vu_prepare_numeric_table#!#id#!#1 +partition_vu_prepare_nvarchar_table#!#id#!#1 +partition_vu_prepare_smalldatetime_table#!#id#!#1 +partition_vu_prepare_smallint_table#!#id#!#1 +partition_vu_prepare_smallmoney_table#!#id#!#1 +partition_vu_prepare_tinyint_table#!#id#!#1 +partition_vu_prepare_uniqueidentifier_table#!#id#!#1 +partition_vu_prepare_varbinary_table#!#id#!#1 +partition_vu_prepare_varchar_table#!#id#!#1 +~~END~~ + + +SELECT * FROM GetPartitionedIndexPartitioningColumn +GO +~~START~~ +varchar#!#varchar#!#varchar#!#tinyint +partition_vu_prepare_bigint_ind877afb285426cec9d46b047e3cf96f63#!#partition_vu_prepare_bigint_table#!#id#!#1 +partition_vu_prepare_bigint_ind877afb285426cec9d46b047e3cf96f63#!#partition_vu_prepare_bigint_table#!#id#!#1 +partition_vu_prepare_binary_ind48a88b3c8178211af1ed1dcf4cfbe503#!#partition_vu_prepare_binary_table#!#id#!#1 +partition_vu_prepare_binary_ind48a88b3c8178211af1ed1dcf4cfbe503#!#partition_vu_prepare_binary_table#!#id#!#1 +partition_vu_prepare_char_index32fed8129381de1b5745e90cd811516f#!#partition_vu_prepare_char_table#!#id#!#1 +partition_vu_prepare_char_index32fed8129381de1b5745e90cd811516f#!#partition_vu_prepare_char_table#!#id#!#1 +partition_vu_prepare_date_indexf571a291edad587ba646fc34c4566844#!#partition_vu_prepare_date_table#!#id#!#1 +partition_vu_prepare_date_indexf571a291edad587ba646fc34c4566844#!#partition_vu_prepare_date_table#!#id#!#1 +partition_vu_prepare_datetime_i364577d0a406eee6e806be980ac15d2e#!#partition_vu_prepare_datetime_table#!#id#!#1 +partition_vu_prepare_datetime_i364577d0a406eee6e806be980ac15d2e#!#partition_vu_prepare_datetime_table#!#id#!#1 +partition_vu_prepare_datetime2_4cad7647322c234b34b97cddb3cd1ad6#!#partition_vu_prepare_datetime2_table#!#id#!#1 +partition_vu_prepare_datetime2_4cad7647322c234b34b97cddb3cd1ad6#!#partition_vu_prepare_datetime2_table#!#id#!#1 +partition_vu_prepare_decimal_infc7570aeccbb040dde39974c476a7ec9#!#partition_vu_prepare_decimal_table#!#id#!#1 +partition_vu_prepare_decimal_infc7570aeccbb040dde39974c476a7ec9#!#partition_vu_prepare_decimal_table#!#id#!#1 +partition_vu_prepare_int_indexpbbe9a6f0ef5edf6e63fa853dac4ed046#!#partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_int_indexpbbe9a6f0ef5edf6e63fa853dac4ed046#!#partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_int_indexpbbe9a6f0ef5edf6e63fa853dac4ed046#!#partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_int_table_id_key#!#partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_int_table_id_key#!#partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_int_table_id_key#!#partition_vu_prepare_int_table#!#id#!#1 +partition_vu_prepare_money_inde9b6a61ad06c0883c6d0f95b2fec9eeee#!#partition_vu_prepare_money_table#!#id#!#1 +partition_vu_prepare_money_inde9b6a61ad06c0883c6d0f95b2fec9eeee#!#partition_vu_prepare_money_table#!#id#!#1 +partition_vu_prepare_nchar_indecdc4872501ea902494c8f710f4e9dbb1#!#partition_vu_prepare_nchar_table#!#id#!#1 +partition_vu_prepare_nchar_indecdc4872501ea902494c8f710f4e9dbb1#!#partition_vu_prepare_nchar_table#!#id#!#1 +partition_vu_prepare_numeric_inf04f315c86929345e23bee80713cf963#!#partition_vu_prepare_numeric_table#!#id#!#1 +partition_vu_prepare_numeric_inf04f315c86929345e23bee80713cf963#!#partition_vu_prepare_numeric_table#!#id#!#1 +partition_vu_prepare_nvarchar_if89fa8cc46282fa6dc23e9f5b834f3ec#!#partition_vu_prepare_nvarchar_table#!#id#!#1 +partition_vu_prepare_nvarchar_if89fa8cc46282fa6dc23e9f5b834f3ec#!#partition_vu_prepare_nvarchar_table#!#id#!#1 +partition_vu_prepare_smalldatetfe8f8bfb8c766f9a1bcd804238ff35d8#!#partition_vu_prepare_smalldatetime_table#!#id#!#1 +partition_vu_prepare_smalldatetfe8f8bfb8c766f9a1bcd804238ff35d8#!#partition_vu_prepare_smalldatetime_table#!#id#!#1 +partition_vu_prepare_smallint_i3eae48e3a131ed23416aa2891b58d579#!#partition_vu_prepare_smallint_table#!#id#!#1 +partition_vu_prepare_smallint_i3eae48e3a131ed23416aa2891b58d579#!#partition_vu_prepare_smallint_table#!#id#!#1 +partition_vu_prepare_smallmoney68389bf5dc5c581b33c4dbb8a3dc1dc8#!#partition_vu_prepare_smallmoney_table#!#id#!#1 +partition_vu_prepare_smallmoney68389bf5dc5c581b33c4dbb8a3dc1dc8#!#partition_vu_prepare_smallmoney_table#!#id#!#1 +partition_vu_prepare_tinyint_in02b271c73e639954190c6a45bd5dd1bb#!#partition_vu_prepare_tinyint_table#!#id#!#1 +partition_vu_prepare_tinyint_in02b271c73e639954190c6a45bd5dd1bb#!#partition_vu_prepare_tinyint_table#!#id#!#1 +partition_vu_prepare_uniqueidend39220cd3f46c5b2cea8c338a387aedf#!#partition_vu_prepare_uniqueidentifier_table#!#id#!#1 +partition_vu_prepare_uniqueidend39220cd3f46c5b2cea8c338a387aedf#!#partition_vu_prepare_uniqueidentifier_table#!#id#!#1 +partition_vu_prepare_varbinary_26e1223f68c4186a96126a57446ac386#!#partition_vu_prepare_varbinary_table#!#id#!#1 +partition_vu_prepare_varbinary_26e1223f68c4186a96126a57446ac386#!#partition_vu_prepare_varbinary_table#!#id#!#1 +partition_vu_prepare_varchar_inc528f397ba573964de161e03035b8f08#!#partition_vu_prepare_varchar_table#!#id#!#1 +partition_vu_prepare_varchar_inc528f397ba573964de161e03035b8f08#!#partition_vu_prepare_varchar_table#!#id#!#1 +~~END~~ + + +SELECT * FROM GetSysPartitionsMetadata +GO +~~START~~ +varchar#!#int#!#int +363863941f079adaa9aa733200e57c9f_partition_0_id_key#!#1#!#2 +363863941f079adaa9aa733200e57c9f_partition_0#!#1#!#0 +363863941f079adaa9aa733200e57c9f_partition_0_value_idx#!#1#!#3 +363863941f079adaa9aa733200e57c9f_partition_1_id_key#!#2#!#2 +363863941f079adaa9aa733200e57c9f_partition_1#!#2#!#0 +363863941f079adaa9aa733200e57c9f_partition_1_value_idx#!#2#!#3 +363863941f079adaa9aa733200e57c9f_partition_2_id_key#!#3#!#2 +363863941f079adaa9aa733200e57c9f_partition_2#!#3#!#0 +363863941f079adaa9aa733200e57c9f_partition_2_value_idx#!#3#!#3 +363863941f079adaa9aa733200e57c9f_partition_3_value_idx#!#4#!#3 +363863941f079adaa9aa733200e57c9f_partition_3#!#4#!#0 +363863941f079adaa9aa733200e57c9f_partition_3_id_key#!#4#!#2 +partition_vu_prepare_normal_inded6315af14d88f45711ba24e46851b8f#!#1#!#2 +partition_vu_prepare_normal_table#!#1#!#0 +~~END~~ + + + + + + + + +-------------------------------------------------- +--- Test Partition Function Argument Limit +-------------------------------------------------- +-- create with max allowed limit +DECLARE @partition_count INT = 14998; +DECLARE @partition_interval INT = 1000; +DECLARE @partition_function_definition VARCHAR(MAX) = 'CREATE PARTITION FUNCTION PartitionFunctionWith14999Arg (int) AS RANGE RIGHT FOR VALUES ('; +-- Build the partition function definition +DECLARE @i INT = 1; +WHILE @i <= @partition_count +BEGIN + SET @partition_function_definition = @partition_function_definition + CAST((@i * @partition_interval) AS VARCHAR(10)) + ', ' + SET @i = @i + 1; +END +SET @partition_function_definition = @partition_function_definition + CAST((@i * @partition_interval) AS VARCHAR(10)) + ')' +-- Execute the partition function creation +EXEC (@partition_function_definition) +GO + +SELECT fanout FROM sys.partition_functions WHERE name = 'PartitionFunctionWith14999Arg' +GO +~~START~~ +int +15000 +~~END~~ + + +DROP PARTITION FUNCTION PartitionFunctionWith14999Arg +GO + + + + + + + +-- create when arg > max allowed limit should throw error +DECLARE @partition_count INT = 14999; +DECLARE @partition_interval INT = 1000; +DECLARE @partition_function_definition VARCHAR(MAX) = 'CREATE PARTITION FUNCTION PartitionFunctionWith15000Arg (int) AS RANGE RIGHT FOR VALUES ('; +-- Build the partition function definition +DECLARE @i INT = 1; +WHILE @i <= @partition_count +BEGIN + SET @partition_function_definition = @partition_function_definition + CAST((@i * @partition_interval) AS VARCHAR(10)) + ', ' + SET @i = @i + 1; +END +SET @partition_function_definition = @partition_function_definition + CAST((@i * @partition_interval) AS VARCHAR(10)) + ')' +-- Execute the partition function creation +EXEC (@partition_function_definition) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: CREATE/ALTER partition function failed as only a maximum of 15000 partitions can be created.)~~ + + + +-------------------------------------------------- +--- Test Partition Function/Scheme Name Limit +-------------------------------------------------- +CREATE PARTITION FUNCTION PartitionFunctionNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz (bigint) +AS RANGE RIGHT FOR VALUES (0, 10000, 100, 1000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The identifier that starts with 'PartitionFunctionNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmno' is too long. Maximum length is 128.)~~ + + +CREATE PARTITION SCHEME PartitionSchemeNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz AS +PARTITION PartitionFunctionDoesNotExists +ALL TO ([PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The identifier that starts with 'PartitionSchemeNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopq' is too long. Maximum length is 128.)~~ + + + +-------------------------------------------------- +--- TO test Permission +-------------------------------------------------- +USE PartitionDb; +GO + +CREATE LOGIN partition_l1 WITH PASSWORD = '12345678'; +GO + +CREATE USER partition_u1 FOR LOGIN partition_l1; +GO + +-- tsql user=partition_l1 password=12345678 +USE PartitionDb; +GO + +SELECT CURRENT_USER +GO +~~START~~ +varchar +partition_u1 +~~END~~ + + + +-- CREATE/DROP should throw permission error +------------------------------------------------------------ +--- only db owner and logins which are member of sysadmin +--- are allowed to create/drop partition function and scheme +------------------------------------------------------------ +CREATE PARTITION FUNCTION TestPartitionFunction (int) +AS RANGE RIGHT FOR VALUES (500, 1000, 10000); +Go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: User does not have permission to perform this action.)~~ + + +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION PartitionFunctionDoesNotExists +ALL TO ([PRIMARY]); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: User does not have permission to perform this action.)~~ + + +DROP PARTITION FUNCTION IntPartitionFunction +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the partition function 'IntPartitionFunction', because it does not exist or you do not have permission.)~~ + + +DROP PARTITION SCHEME IntPartitionScheme +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the partition scheme 'IntPartitionScheme', because it does not exist or you do not have permission.)~~ + + +------------------------------------------ +--- all user can access the metadata +------------------------------------------ +SELECT + name, type, type_desc, fanout, boundary_value_on_right, is_system + FROM + sys.partition_functions +go +~~START~~ +nvarchar#!#char#!#nvarchar#!#int#!#bit#!#bit +PartitionDb_PartitionFunction#!#R #!#RANGE#!#4#!#1#!#0 +~~END~~ + + +SELECT + ps.name as scheme_name, pf.name as function_name, ps.type, ps.type_desc, ps.is_default, ps.is_system + FROM + sys.partition_schemes ps + INNER JOIN + sys.partition_functions pf on (ps.function_id = pf.function_id) +go +~~START~~ +nvarchar#!#nvarchar#!#char#!#nvarchar#!#bit#!#bit +PartitionDb_PartitionScheme#!#PartitionDb_PartitionFunction#!#PS#!#PARTITION_SCHEME#!#0#!#0 +~~END~~ + + + +-- psql + +------------------------------------------------------------ +--- all user can use the metadata of the partition scheme +--- to create table if they permission to create table +------------------------------------------------------------ +-- grant create permission to user on schema so that it can create table +DO $$ +DECLARE + schema_name TEXT; +BEGIN + IF current_setting('babelfishpg_tsql.migration_mode') = 'multi-db' THEN + schema_name := 'partitiondb_dbo'; + ELSE + schema_name := 'dbo'; + END IF; + EXECUTE 'GRANT CREATE ON SCHEMA ' || quote_ident(schema_name) || ' TO partitiondb_partition_u1'; +END$$; +GO + +-- tsql user=partition_l1 password=12345678 +USE PartitionDb; +GO + +SELECT CURRENT_USER +GO +~~START~~ +varchar +partition_u1 +~~END~~ + + +CREATE TABLE PartitionDb_TestPartitionTable ( + Id INT, + Value sys.varchar(20) +) ON PartitionDb_PartitionScheme(Id); +GO + +DROP TABLE PartitionDb_TestPartitionTable +GO + +-- psql + +-- revoke create permission from user on schema +DO $$ +DECLARE + schema_name TEXT; +BEGIN + IF current_setting('babelfishpg_tsql.migration_mode') = 'multi-db' THEN + schema_name := 'partitiondb_dbo'; + ELSE + schema_name := 'dbo'; + END IF; + EXECUTE 'REVOKE CREATE ON SCHEMA ' || quote_ident(schema_name) || ' FROM partitiondb_partition_u1'; +END$$; +GO + +-- tsql +----------------------------------------------------------------------------------- +--- DB owner should be able to create/drop partition function and scheme +---------------------------------------------------------------------------------- +-- make the user a DB owner +USE PartitionDb; +GO + +DROP USER partition_u1; +GO + +execute sp_changedbowner 'partition_l1' +GO + +-- tsql user=partition_l1 password=12345678 +USE PartitionDb; +GO + +SELECT CURRENT_USER +GO +~~START~~ +varchar +dbo +~~END~~ + +-- CREATE/DROP should work now +CREATE PARTITION FUNCTION TestPartitionFunction (int) +AS RANGE RIGHT FOR VALUES (500, 1000, 10000); +Go + +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION TestPartitionFunction +ALL TO ([PRIMARY]); +GO + +DROP PARTITION SCHEME TestPartitionScheme +go + +DROP PARTITION FUNCTION TestPartitionFunction +go + +-- tsql +USE master +GO + + +------------------------------------------------------------------------------------------------------------ +--- Test error during Implicit Conversion of range values in Partition Function for each datatypes +------------------------------------------------------------------------------------------------------------ +CREATE PARTITION FUNCTION NewIntPartitionFunction (int) +AS RANGE RIGHT FOR VALUES (500, 1000, cast('xyz' as varchar)); +-- having duplicates also, but first it should try to convert and fail +CREATE PARTITION FUNCTION NewBigIntPartitionFunction (bigint) +AS RANGE RIGHT FOR VALUES (1000, 1000, 1000, cast('xyz' as varchar), 1000, 1000); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewSmallIntPartitionFunction (smallint) +AS RANGE RIGHT FOR VALUES ('xyz', 32767, -32768); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 1 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewTinyIntPartitionFunction (tinyint) +AS RANGE RIGHT FOR VALUES (0, 255, cast('xyz' as varchar)); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewDecimalPartitionFunction (decimal(10, 5)) +AS RANGE RIGHT FOR VALUES (0.0, 300.0, 200.0, 'xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 4 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewNumericPartitionFunction (numeric(5, 2)) +AS RANGE RIGHT FOR VALUES (0.0, 30.0, 10.0, 'xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 4 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewDatePartitionFunction (date) +AS RANGE RIGHT FOR VALUES ('2022-07-01', '2022-01-01','xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewDateTimePartitionFunction (datetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01 00:00:00', 'xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewDateTime2PartitionFunction (datetime2(3)) +AS RANGE RIGHT FOR VALUES ('2022-01-01 00:00:00.000', '2022-07-01 00:00:00.000', 'xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewSmallDateTimePartitionFunction (smalldatetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01', cast(0x123 as binary(4))); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewCharPartitionFunction (char(5)) +AS RANGE RIGHT FOR VALUES ('A', 'F', 'K', 'P', 'U', 'Z', cast(0x123 as binary(4))); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 7 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewNCharPartitionFunction (nchar(5)) +AS RANGE RIGHT FOR VALUES (N'A', N'F', N'K', N'P', N'U', N'Z', cast(0x123 as binary(4))); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 7 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewBinaryPartitionFunction (binary(4)) +AS RANGE RIGHT FOR VALUES (0x000, 0x800, 0x400, 'xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 4 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewVarBinaryPartitionFunction (varbinary(8)) +AS RANGE RIGHT FOR VALUES (0x0000000000000000, 0x8000000000000000, 0x4000000000000000, 'xyz'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 4 to partition function parameter type.)~~ + + +CREATE PARTITION FUNCTION NewUniqueIdentifierPartitionFunction (uniqueidentifier) +AS RANGE RIGHT FOR VALUES ('00000000-0000-0000-0000-000000000000', 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF', 123); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Could not implicitly convert range values type specified at ordinal 3 to partition function parameter type.)~~ + + + +-------------------------------------------------- +--- DROP PARTITION FUNCTION/SCHEME/TABLE using procedure +-------------------------------------------------- +EXEC PartitionProcedureDropPartitionTable +GO + +EXEC PartitionProcedureDropPartitionScheme +GO + +EXEC PartitionProcedureDropPartitionFunction +GO + +EXEC PartitionProcedureDropPartitionFunctionSchemeAndTable +GO + + +--------------------------------------------------------------------------- +--- PARTITIONED TABLES test +--------------------------------------------------------------------------- +SELECT * FROM GetPartitionedTableListFromSysTablesView +GO +~~START~~ +varchar +partition_vu_prepare_bigint_table +partition_vu_prepare_binary_table +partition_vu_prepare_char_table +partition_vu_prepare_date_table +partition_vu_prepare_datetime_table +partition_vu_prepare_datetime2_table +partition_vu_prepare_decimal_table +partition_vu_prepare_int_table +partition_vu_prepare_money_table +partition_vu_prepare_nchar_table +partition_vu_prepare_normal_table +partition_vu_prepare_numeric_table +partition_vu_prepare_nvarchar_table +partition_vu_prepare_smalldatetime_table +partition_vu_prepare_smallint_table +partition_vu_prepare_smallmoney_table +partition_vu_prepare_tinyint_table +partition_vu_prepare_uniqueidentifier_table +partition_vu_prepare_varbinary_table +partition_vu_prepare_varchar_table +~~END~~ + + +--------------------------------------------------------------------------- +--- PARTITIONED INDEX test +--------------------------------------------------------------------------- +SELECT * FROM GetPartitionedIndexListFromSysIndexesView +GO +~~START~~ +varchar +partition_vu_prepare_bigint_ind877afb285426cec9d46b047e3cf96f63 +partition_vu_prepare_binary_ind48a88b3c8178211af1ed1dcf4cfbe503 +partition_vu_prepare_char_index32fed8129381de1b5745e90cd811516f +partition_vu_prepare_date_indexf571a291edad587ba646fc34c4566844 +partition_vu_prepare_datetime_i364577d0a406eee6e806be980ac15d2e +partition_vu_prepare_datetime2_4cad7647322c234b34b97cddb3cd1ad6 +partition_vu_prepare_decimal_infc7570aeccbb040dde39974c476a7ec9 +partition_vu_prepare_int_indexpbbe9a6f0ef5edf6e63fa853dac4ed046 +partition_vu_prepare_int_table_id_key +partition_vu_prepare_money_inde9b6a61ad06c0883c6d0f95b2fec9eeee +partition_vu_prepare_nchar_indecdc4872501ea902494c8f710f4e9dbb1 +partition_vu_prepare_normal_inded6315af14d88f45711ba24e46851b8f +partition_vu_prepare_numeric_inf04f315c86929345e23bee80713cf963 +partition_vu_prepare_nvarchar_if89fa8cc46282fa6dc23e9f5b834f3ec +partition_vu_prepare_smalldatetfe8f8bfb8c766f9a1bcd804238ff35d8 +partition_vu_prepare_smallint_i3eae48e3a131ed23416aa2891b58d579 +partition_vu_prepare_smallmoney68389bf5dc5c581b33c4dbb8a3dc1dc8 +partition_vu_prepare_tinyint_in02b271c73e639954190c6a45bd5dd1bb +partition_vu_prepare_uniqueidend39220cd3f46c5b2cea8c338a387aedf +partition_vu_prepare_varbinary_26e1223f68c4186a96126a57446ac386 +partition_vu_prepare_varchar_inc528f397ba573964de161e03035b8f08 +~~END~~ + + + +---------------------------------------------------------------------------------------------- +--- System views should list only metadata of Partitioned table(not of the partitions) +---------------------------------------------------------------------------------------------- +SELECT count(*) from sys.tables where name = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +1 +~~END~~ + + +SELECT count(*) from sys.all_columns where object_id = OBJECT_ID('partition_vu_prepare_int_table') +GO +~~START~~ +int +2 +~~END~~ + + +SELECT count(*) from sys.columns where object_id = OBJECT_ID('partition_vu_prepare_int_table') +GO +~~START~~ +int +2 +~~END~~ + + +SELECT count(*) from sys.indexes where object_id = OBJECT_ID('partition_vu_prepare_int_table') +GO +~~START~~ +int +3 +~~END~~ + + +SELECT count(*) from sys.index_columns where object_id = OBJECT_ID('partition_vu_prepare_int_table') +GO +~~START~~ +int +5 +~~END~~ + + +SELECT count(*) from sys.all_objects where name = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +1 +~~END~~ + + +SELECT count(*) from sys.sp_tables_view where TABLE_NAME = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +1 +~~END~~ + + +SELECT count(*) from information_schema.columns where TABLE_NAME = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +2 +~~END~~ + + +SELECT count(*) from information_schema.tables where TABLE_NAME = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +1 +~~END~~ + + +SELECT count(*) from information_schema.table_constraints where TABLE_NAME = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +2 +~~END~~ + + +SELECT count(*) from information_schema.CONSTRAINT_COLUMN_USAGE where TABLE_NAME = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +2 +~~END~~ + + +SELECT count(*) from information_schema.key_column_usage where TABLE_NAME = 'partition_vu_prepare_int_table' +GO +~~START~~ +int +1 +~~END~~ + + +--------------------------------------------------------- +--- System views should not list metadata of Partitions +--------------------------------------------------------- +SELECT count(*) from sys.tables where name = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from sys.all_columns where object_id = OBJECT_ID('363863941f079adaa9aa733200e57c9f_partition_0') +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from sys.columns where object_id = OBJECT_ID('363863941f079adaa9aa733200e57c9f_partition_0') +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from sys.indexes where object_id = OBJECT_ID('363863941f079adaa9aa733200e57c9f_partition_0') +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from sys.index_columns where object_id = OBJECT_ID('363863941f079adaa9aa733200e57c9f_partition_0') +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from sys.all_objects where name = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from sys.sp_tables_view where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from information_schema.columns where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from information_schema.tables where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from information_schema.table_constraints where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from information_schema.CONSTRAINT_COLUMN_USAGE where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + +SELECT count(*) from information_schema.key_column_usage where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO +~~START~~ +int +0 +~~END~~ + + + + +-- psql +--------------------------------------------------------------------------- +--- Run analyze on each table and enable query plan +--------------------------------------------------------------------------- +ANALYZE master_dbo.partition_vu_prepare_int_table; +ANALYZE master_dbo.partition_vu_prepare_bigint_table; +ANALYZE master_dbo.partition_vu_prepare_smallint_table; +ANALYZE master_dbo.partition_vu_prepare_tinyint_table; +ANALYZE master_dbo.partition_vu_prepare_decimal_table; +ANALYZE master_dbo.partition_vu_prepare_numeric_table; +ANALYZE master_dbo.partition_vu_prepare_money_table; +ANALYZE master_dbo.partition_vu_prepare_smallmoney_table; +ANALYZE master_dbo.partition_vu_prepare_date_table; +ANALYZE master_dbo.partition_vu_prepare_datetime_table; +ANALYZE master_dbo.partition_vu_prepare_datetime2_table; +ANALYZE master_dbo.partition_vu_prepare_smalldatetime_table; +ANALYZE master_dbo.partition_vu_prepare_char_table; +ANALYZE master_dbo.partition_vu_prepare_varchar_table; +ANALYZE master_dbo.partition_vu_prepare_nvarchar_table; +ANALYZE master_dbo.partition_vu_prepare_nchar_table; +ANALYZE master_dbo.partition_vu_prepare_binary_table; +ANALYZE master_dbo.partition_vu_prepare_varbinary_table; +ANALYZE master_dbo.partition_vu_prepare_uniqueidentifier_table; +GO + +-- tsql +SELECT set_config('babelfishpg_tsql.explain_costs', 'off', false) +GO +~~START~~ +text +off +~~END~~ + + +SET BABELFISH_SHOWPLAN_ALL ON +GO + + +--------------------------------------------------------------------------- +--- Query plan of select on partitioned tables +--------------------------------------------------------------------------- +SELECT * FROM partition_vu_prepare_int_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_int_table +Gather + Workers Planned: 1 + Single Copy: true + -> Append + -> Seq Scan on "363863941f079adaa9aa733200e57c9f_partition_1" partition_vu_prepare_int_table_1 + -> Seq Scan on "363863941f079adaa9aa733200e57c9f_partition_2" partition_vu_prepare_int_table_2 + -> Seq Scan on "363863941f079adaa9aa733200e57c9f_partition_3" partition_vu_prepare_int_table_3 + -> Seq Scan on "363863941f079adaa9aa733200e57c9f_partition_0" partition_vu_prepare_int_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.768 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_bigint_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_bigint_table +Gather + Workers Planned: 1 + Single Copy: true + -> Append + -> Seq Scan on "548bb344374ce8d65342b36428375873_partition_1" partition_vu_prepare_bigint_table_1 + -> Seq Scan on "548bb344374ce8d65342b36428375873_partition_2" partition_vu_prepare_bigint_table_2 + -> Seq Scan on "548bb344374ce8d65342b36428375873_partition_3" partition_vu_prepare_bigint_table_3 + -> Seq Scan on "548bb344374ce8d65342b36428375873_partition_4" partition_vu_prepare_bigint_table_4 + -> Seq Scan on "548bb344374ce8d65342b36428375873_partition_0" partition_vu_prepare_bigint_table_5 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.126 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_smallint_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_smallint_table +Gather + Workers Planned: 1 + Single Copy: true + -> Append + -> Seq Scan on "12025e103721b70925744c196ce004cd_partition_1" partition_vu_prepare_smallint_table_1 + -> Seq Scan on "12025e103721b70925744c196ce004cd_partition_2" partition_vu_prepare_smallint_table_2 + -> Seq Scan on "12025e103721b70925744c196ce004cd_partition_3" partition_vu_prepare_smallint_table_3 + -> Seq Scan on "12025e103721b70925744c196ce004cd_partition_0" partition_vu_prepare_smallint_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.105 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_tinyint_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_tinyint_table +Gather + Workers Planned: 1 + Single Copy: true + -> Append + -> Seq Scan on "61446d711d19b5970809387caa7fd3d3_partition_1" partition_vu_prepare_tinyint_table_1 + -> Seq Scan on "61446d711d19b5970809387caa7fd3d3_partition_2" partition_vu_prepare_tinyint_table_2 + -> Seq Scan on "61446d711d19b5970809387caa7fd3d3_partition_3" partition_vu_prepare_tinyint_table_3 + -> Seq Scan on "61446d711d19b5970809387caa7fd3d3_partition_0" partition_vu_prepare_tinyint_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.136 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_decimal_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_decimal_table +Gather + Workers Planned: 1 + Single Copy: true + -> Append + -> Seq Scan on cda2902d769fd61eb60b1a461650212f_partition_1 partition_vu_prepare_decimal_table_1 + -> Seq Scan on cda2902d769fd61eb60b1a461650212f_partition_2 partition_vu_prepare_decimal_table_2 + -> Seq Scan on cda2902d769fd61eb60b1a461650212f_partition_3 partition_vu_prepare_decimal_table_3 + -> Seq Scan on cda2902d769fd61eb60b1a461650212f_partition_4 partition_vu_prepare_decimal_table_4 + -> Seq Scan on cda2902d769fd61eb60b1a461650212f_partition_0 partition_vu_prepare_decimal_table_5 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.094 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_numeric_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_numeric_table +Gather + Workers Planned: 1 + Single Copy: true + -> Append + -> Seq Scan on "57405760297bb338f333c148aac5f845_partition_1" partition_vu_prepare_numeric_table_1 + -> Seq Scan on "57405760297bb338f333c148aac5f845_partition_2" partition_vu_prepare_numeric_table_2 + -> Seq Scan on "57405760297bb338f333c148aac5f845_partition_3" partition_vu_prepare_numeric_table_3 + -> Seq Scan on "57405760297bb338f333c148aac5f845_partition_4" partition_vu_prepare_numeric_table_4 + -> Seq Scan on "57405760297bb338f333c148aac5f845_partition_0" partition_vu_prepare_numeric_table_5 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.096 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_money_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_money_table +Gather + Workers Planned: 1 + Single Copy: true + -> Append + -> Seq Scan on "640187c54e2c2984d190957d245a5fa5_partition_1" partition_vu_prepare_money_table_1 + -> Seq Scan on "640187c54e2c2984d190957d245a5fa5_partition_2" partition_vu_prepare_money_table_2 + -> Seq Scan on "640187c54e2c2984d190957d245a5fa5_partition_3" partition_vu_prepare_money_table_3 + -> Seq Scan on "640187c54e2c2984d190957d245a5fa5_partition_0" partition_vu_prepare_money_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.095 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_smallmoney_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_smallmoney_table +Gather + Workers Planned: 1 + Single Copy: true + -> Append + -> Seq Scan on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_1" partition_vu_prepare_smallmoney_table_1 + -> Seq Scan on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_2" partition_vu_prepare_smallmoney_table_2 + -> Seq Scan on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_3" partition_vu_prepare_smallmoney_table_3 + -> Seq Scan on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_0" partition_vu_prepare_smallmoney_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.096 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_date_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_date_table +Gather + Workers Planned: 1 + Single Copy: true + -> Append + -> Seq Scan on "4867824426e52acac5c93d9cbe8aa366_partition_1" partition_vu_prepare_date_table_1 + -> Seq Scan on "4867824426e52acac5c93d9cbe8aa366_partition_2" partition_vu_prepare_date_table_2 + -> Seq Scan on "4867824426e52acac5c93d9cbe8aa366_partition_3" partition_vu_prepare_date_table_3 + -> Seq Scan on "4867824426e52acac5c93d9cbe8aa366_partition_0" partition_vu_prepare_date_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.095 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_datetime_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_datetime_table +Gather + Workers Planned: 1 + Single Copy: true + -> Append + -> Seq Scan on "751ce655481adf15600727bf291667f7_partition_1" partition_vu_prepare_datetime_table_1 + -> Seq Scan on "751ce655481adf15600727bf291667f7_partition_2" partition_vu_prepare_datetime_table_2 + -> Seq Scan on "751ce655481adf15600727bf291667f7_partition_3" partition_vu_prepare_datetime_table_3 + -> Seq Scan on "751ce655481adf15600727bf291667f7_partition_0" partition_vu_prepare_datetime_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.095 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_datetime2_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_datetime2_table +Gather + Workers Planned: 1 + Single Copy: true + -> Append + -> Seq Scan on "5ed003cf80dacbb8cce0b21e175f7f94_partition_1" partition_vu_prepare_datetime2_table_1 + -> Seq Scan on "5ed003cf80dacbb8cce0b21e175f7f94_partition_2" partition_vu_prepare_datetime2_table_2 + -> Seq Scan on "5ed003cf80dacbb8cce0b21e175f7f94_partition_3" partition_vu_prepare_datetime2_table_3 + -> Seq Scan on "5ed003cf80dacbb8cce0b21e175f7f94_partition_0" partition_vu_prepare_datetime2_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.096 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_smalldatetime_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_smalldatetime_table +Gather + Workers Planned: 1 + Single Copy: true + -> Append + -> Seq Scan on b5c2e665ec4a1219ba8510e33e45379b_partition_1 partition_vu_prepare_smalldatetime_table_1 + -> Seq Scan on b5c2e665ec4a1219ba8510e33e45379b_partition_2 partition_vu_prepare_smalldatetime_table_2 + -> Seq Scan on b5c2e665ec4a1219ba8510e33e45379b_partition_3 partition_vu_prepare_smalldatetime_table_3 + -> Seq Scan on b5c2e665ec4a1219ba8510e33e45379b_partition_0 partition_vu_prepare_smalldatetime_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.094 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_char_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_char_table +Gather + Workers Planned: 4 + -> Parallel Append + -> Parallel Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_1" partition_vu_prepare_char_table_1 + -> Parallel Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_2" partition_vu_prepare_char_table_2 + -> Parallel Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_4" partition_vu_prepare_char_table_4 + -> Parallel Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_6" partition_vu_prepare_char_table_6 + -> Parallel Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_0" partition_vu_prepare_char_table_8 + -> Parallel Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_3" partition_vu_prepare_char_table_3 + -> Parallel Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_5" partition_vu_prepare_char_table_5 + -> Parallel Seq Scan on "5d20bd977eb6e6f1304dec45598c09f5_partition_7" partition_vu_prepare_char_table_7 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.095 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_varchar_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_varchar_table +Gather + Workers Planned: 1 + Single Copy: true + -> Append + -> Seq Scan on "933a5c7f0de13890324e53ee0711424b_partition_1" partition_vu_prepare_varchar_table_1 + -> Seq Scan on "933a5c7f0de13890324e53ee0711424b_partition_2" partition_vu_prepare_varchar_table_2 + -> Seq Scan on "933a5c7f0de13890324e53ee0711424b_partition_3" partition_vu_prepare_varchar_table_3 + -> Seq Scan on "933a5c7f0de13890324e53ee0711424b_partition_4" partition_vu_prepare_varchar_table_4 + -> Seq Scan on "933a5c7f0de13890324e53ee0711424b_partition_5" partition_vu_prepare_varchar_table_5 + -> Seq Scan on "933a5c7f0de13890324e53ee0711424b_partition_0" partition_vu_prepare_varchar_table_6 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.095 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_nvarchar_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_nvarchar_table +Gather + Workers Planned: 1 + Single Copy: true + -> Append + -> Seq Scan on "320465af1d1bd21f5b29c57f9f4e5c51_partition_1" partition_vu_prepare_nvarchar_table_1 + -> Seq Scan on "320465af1d1bd21f5b29c57f9f4e5c51_partition_2" partition_vu_prepare_nvarchar_table_2 + -> Seq Scan on "320465af1d1bd21f5b29c57f9f4e5c51_partition_3" partition_vu_prepare_nvarchar_table_3 + -> Seq Scan on "320465af1d1bd21f5b29c57f9f4e5c51_partition_4" partition_vu_prepare_nvarchar_table_4 + -> Seq Scan on "320465af1d1bd21f5b29c57f9f4e5c51_partition_5" partition_vu_prepare_nvarchar_table_5 + -> Seq Scan on "320465af1d1bd21f5b29c57f9f4e5c51_partition_0" partition_vu_prepare_nvarchar_table_6 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.096 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_nchar_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_nchar_table +Gather + Workers Planned: 4 + -> Parallel Append + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_1 partition_vu_prepare_nchar_table_1 + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_2 partition_vu_prepare_nchar_table_2 + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_4 partition_vu_prepare_nchar_table_4 + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_6 partition_vu_prepare_nchar_table_6 + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_0 partition_vu_prepare_nchar_table_8 + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_3 partition_vu_prepare_nchar_table_3 + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_5 partition_vu_prepare_nchar_table_5 + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_7 partition_vu_prepare_nchar_table_7 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.095 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_binary_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_binary_table +Gather + Workers Planned: 1 + Single Copy: true + -> Append + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_1" partition_vu_prepare_binary_table_1 + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_2" partition_vu_prepare_binary_table_2 + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_3" partition_vu_prepare_binary_table_3 + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_4" partition_vu_prepare_binary_table_4 + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_0" partition_vu_prepare_binary_table_5 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.095 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_varbinary_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_varbinary_table +Gather + Workers Planned: 1 + Single Copy: true + -> Append + -> Seq Scan on "77718961234110c3a22a3c977bc252d8_partition_1" partition_vu_prepare_varbinary_table_1 + -> Seq Scan on "77718961234110c3a22a3c977bc252d8_partition_2" partition_vu_prepare_varbinary_table_2 + -> Seq Scan on "77718961234110c3a22a3c977bc252d8_partition_3" partition_vu_prepare_varbinary_table_3 + -> Seq Scan on "77718961234110c3a22a3c977bc252d8_partition_4" partition_vu_prepare_varbinary_table_4 + -> Seq Scan on "77718961234110c3a22a3c977bc252d8_partition_0" partition_vu_prepare_varbinary_table_5 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.097 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_uniqueidentifier_table; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_uniqueidentifier_table +Gather + Workers Planned: 1 + Single Copy: true + -> Append + -> Seq Scan on f3baf999c06d6ea82082a4c549baeb77_partition_1 partition_vu_prepare_uniqueidentifier_table_1 + -> Seq Scan on f3baf999c06d6ea82082a4c549baeb77_partition_2 partition_vu_prepare_uniqueidentifier_table_2 + -> Seq Scan on f3baf999c06d6ea82082a4c549baeb77_partition_3 partition_vu_prepare_uniqueidentifier_table_3 + -> Seq Scan on f3baf999c06d6ea82082a4c549baeb77_partition_0 partition_vu_prepare_uniqueidentifier_table_4 +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.095 ms +~~END~~ + + +----------------------------------------------------------------------------------------- +--- Query plan of select on partitioned tables with predicate and enforced index scan +----------------------------------------------------------------------------------------- +SET BABELFISH_SHOWPLAN_ALL OFF +GO + +SELECT set_config('enable_seqscan', 'off', false); +SELECT set_config('enable_bitmapscan', 'off', false); +GO +~~START~~ +text +off +~~END~~ + +~~START~~ +text +off +~~END~~ + + +SET BABELFISH_SHOWPLAN_ALL ON +GO + + +SELECT * FROM partition_vu_prepare_int_table WHERE Id >= 0 AND Id < 500; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_int_table WHERE Id >= 0 AND Id < 500 +Gather + Workers Planned: 1 + Single Copy: true + -> Index Scan using "363863941f079adaa9aa733200e57c9f_partition_1_id_key" on "363863941f079adaa9aa733200e57c9f_partition_1" partition_vu_prepare_int_table + Index Cond: ((id >= 0) AND (id < 500)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 11.344 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_bigint_table WHERE Id >= 0 AND Id < 100; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_bigint_table WHERE Id >= 0 AND Id < 100 +Gather + Workers Planned: 1 + Single Copy: true + -> Index Scan using "548bb344374ce8d65342b36428375873_partition_1_id_idx" on "548bb344374ce8d65342b36428375873_partition_1" partition_vu_prepare_bigint_table + Index Cond: ((id >= 0) AND (id < 100)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.184 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_smallint_table WHERE Id >= -32768 AND Id < 0; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_smallint_table WHERE Id >= -32768 AND Id < 0 +Gather + Workers Planned: 1 + Single Copy: true + -> Index Scan using "12025e103721b70925744c196ce004cd_partition_1_id_idx" on "12025e103721b70925744c196ce004cd_partition_1" partition_vu_prepare_smallint_table + Index Cond: ((id >= '-32768'::integer) AND (id < 0)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 7.534 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_tinyint_table WHERE Id >= 0 AND Id < 128; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_tinyint_table WHERE Id >= 0 AND Id < 128 +Gather + Workers Planned: 1 + Single Copy: true + -> Index Scan using "61446d711d19b5970809387caa7fd3d3_partition_1_id_idx" on "61446d711d19b5970809387caa7fd3d3_partition_1" partition_vu_prepare_tinyint_table + Index Cond: (((id)::smallint >= 0) AND ((id)::smallint < 128)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.169 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_decimal_table WHERE Id >= 0.0 AND Id < 100.0; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_decimal_table WHERE Id >= 0.0 AND Id < 100.0 +Gather + Workers Planned: 1 + Single Copy: true + -> Index Scan using cda2902d769fd61eb60b1a461650212f_partition_1_id_idx on cda2902d769fd61eb60b1a461650212f_partition_1 partition_vu_prepare_decimal_table + Index Cond: (((id)::numeric >= 0.0) AND ((id)::numeric < 100.0)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 6.750 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_numeric_table WHERE Id >= 0.0 AND Id < 10.0; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_numeric_table WHERE Id >= 0.0 AND Id < 10.0 +Gather + Workers Planned: 1 + Single Copy: true + -> Index Scan using "57405760297bb338f333c148aac5f845_partition_1_id_idx" on "57405760297bb338f333c148aac5f845_partition_1" partition_vu_prepare_numeric_table + Index Cond: ((id >= 0.0) AND (id < 10.0)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.169 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_money_table WHERE Id >= 2.56789 AND Id < 3.56789; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_money_table WHERE Id >= 2.56789 AND Id < 3.56789 +Gather + Workers Planned: 1 + Single Copy: true + -> Append + -> Index Scan using "640187c54e2c2984d190957d245a5fa5_partition_1_id_idx" on "640187c54e2c2984d190957d245a5fa5_partition_1" partition_vu_prepare_money_table_1 + Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + -> Index Scan using "640187c54e2c2984d190957d245a5fa5_partition_0_id_idx" on "640187c54e2c2984d190957d245a5fa5_partition_0" partition_vu_prepare_money_table_2 + Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.230 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_smallmoney_table WHERE Id >= 2.56789 AND Id < 3.56789; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_smallmoney_table WHERE Id >= 2.56789 AND Id < 3.56789 +Gather + Workers Planned: 1 + Single Copy: true + -> Append + -> Index Scan using "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_1_id_idx" on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_1" partition_vu_prepare_smallmoney_table_1 + Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) + -> Index Scan using "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_0_id_idx" on "8acfdf2e7ec8a3fb29dd9f735c4d58b5_partition_0" partition_vu_prepare_smallmoney_table_2 + Index Cond: (((id)::fixeddecimal >= 2.56789) AND ((id)::fixeddecimal < 3.56789)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.162 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_date_table WHERE Id >= '2022-01-01' AND Id < '2022-07-01'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_date_table WHERE Id >= '2022-01-01' AND Id < '2022-07-01' +Gather + Workers Planned: 1 + Single Copy: true + -> Index Scan using "4867824426e52acac5c93d9cbe8aa366_partition_1_id_idx" on "4867824426e52acac5c93d9cbe8aa366_partition_1" partition_vu_prepare_date_table + Index Cond: ((id >= '2022-01-01'::date) AND (id < '2022-07-01'::date)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.192 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_datetime_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_datetime_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01' +Gather + Workers Planned: 1 + Single Copy: true + -> Index Scan using "751ce655481adf15600727bf291667f7_partition_1_id_idx" on "751ce655481adf15600727bf291667f7_partition_1" partition_vu_prepare_datetime_table + Index Cond: ((id >= '2019-01-01 00:00:00'::datetime) AND (id < '2022-01-01 00:00:00'::datetime)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.167 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_datetime2_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_datetime2_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01' +Gather + Workers Planned: 1 + Single Copy: true + -> Index Scan using "5ed003cf80dacbb8cce0b21e175f7f94_partition_1_id_idx" on "5ed003cf80dacbb8cce0b21e175f7f94_partition_1" partition_vu_prepare_datetime2_table + Index Cond: ((id >= '2019-01-01 00:00:00'::datetime2) AND (id < '2022-01-01 00:00:00'::datetime2)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.167 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_smalldatetime_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_smalldatetime_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01' +Gather + Workers Planned: 1 + Single Copy: true + -> Index Scan using b5c2e665ec4a1219ba8510e33e45379b_partition_1_id_idx on b5c2e665ec4a1219ba8510e33e45379b_partition_1 partition_vu_prepare_smalldatetime_table + Index Cond: ((id >= '2019-01-01 00:00:00'::smalldatetime) AND (id < '2022-01-01 00:00:00'::smalldatetime)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.167 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_char_table WHERE Id >= 'A' AND Id < 'B'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_char_table WHERE Id >= 'A' AND Id < 'B' +Gather + Workers Planned: 1 + Single Copy: true + -> Index Scan using "5d20bd977eb6e6f1304dec45598c09f5_partition_1_id_idx" on "5d20bd977eb6e6f1304dec45598c09f5_partition_1" partition_vu_prepare_char_table + Index Cond: ((id >= 'A'::bpchar) AND (id < 'B'::bpchar)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.174 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_varchar_table WHERE Id >= 'Apple' AND Id < 'Banana'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_varchar_table WHERE Id >= 'Apple' AND Id < 'Banana' +Gather + Workers Planned: 1 + Single Copy: true + -> Index Scan using "933a5c7f0de13890324e53ee0711424b_partition_1_id_idx" on "933a5c7f0de13890324e53ee0711424b_partition_1" partition_vu_prepare_varchar_table + Index Cond: ((id >= 'Apple'::"varchar") AND (id < 'Banana'::"varchar")) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.166 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_nvarchar_table WHERE Id >= N'Apple' AND Id < N'Banana'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_nvarchar_table WHERE Id >= N'Apple' AND Id < N'Banana' +Gather + Workers Planned: 1 + Single Copy: true + -> Index Scan using "320465af1d1bd21f5b29c57f9f4e5c51_partition_1_id_idx" on "320465af1d1bd21f5b29c57f9f4e5c51_partition_1" partition_vu_prepare_nvarchar_table + Index Cond: (((id)::"varchar" >= 'Apple'::"varchar") AND ((id)::"varchar" < 'Banana'::"varchar")) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.170 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_nchar_table WHERE Id >= N'A' AND Id < N'B'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_nchar_table WHERE Id >= N'A' AND Id < N'B' +Gather + Workers Planned: 4 + -> Parallel Append + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_3 partition_vu_prepare_nchar_table_3 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_5 partition_vu_prepare_nchar_table_5 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_7 partition_vu_prepare_nchar_table_7 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_1 partition_vu_prepare_nchar_table_1 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_2 partition_vu_prepare_nchar_table_2 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_4 partition_vu_prepare_nchar_table_4 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_6 partition_vu_prepare_nchar_table_6 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) + -> Parallel Seq Scan on e3b6f45b64d480f285db54a94209b4bc_partition_0 partition_vu_prepare_nchar_table_8 + Filter: (((id)::"varchar" >= 'A'::"varchar") AND ((id)::"varchar" < 'B'::"varchar")) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.167 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_binary_table WHERE Id >= 0x0000 AND Id < 0x0400; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_binary_table WHERE Id >= 0x0000 AND Id < 0x0400 +Gather + Workers Planned: 1 + Single Copy: true + -> Append + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_1" partition_vu_prepare_binary_table_1 + Filter: (((id)::bbf_varbinary >= '0x0000'::bbf_varbinary) AND ((id)::bbf_varbinary < '0x0400'::bbf_varbinary)) + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_2" partition_vu_prepare_binary_table_2 + Filter: (((id)::bbf_varbinary >= '0x0000'::bbf_varbinary) AND ((id)::bbf_varbinary < '0x0400'::bbf_varbinary)) + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_3" partition_vu_prepare_binary_table_3 + Filter: (((id)::bbf_varbinary >= '0x0000'::bbf_varbinary) AND ((id)::bbf_varbinary < '0x0400'::bbf_varbinary)) + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_4" partition_vu_prepare_binary_table_4 + Filter: (((id)::bbf_varbinary >= '0x0000'::bbf_varbinary) AND ((id)::bbf_varbinary < '0x0400'::bbf_varbinary)) + -> Seq Scan on "3a3cd2fe373a5dc4b9281d49f7960143_partition_0" partition_vu_prepare_binary_table_5 + Filter: (((id)::bbf_varbinary >= '0x0000'::bbf_varbinary) AND ((id)::bbf_varbinary < '0x0400'::bbf_varbinary)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 6.912 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_varbinary_table WHERE Id >= 0x0000000000000000 AND Id < 0x4000000000000000; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_varbinary_table WHERE Id >= 0x0000000000000000 AND Id < 0x4000000000000000 +Gather + Workers Planned: 1 + Single Copy: true + -> Index Scan using "77718961234110c3a22a3c977bc252d8_partition_1_id_idx" on "77718961234110c3a22a3c977bc252d8_partition_1" partition_vu_prepare_varbinary_table + Index Cond: (((id)::bbf_varbinary >= '0x0000000000000000'::bbf_varbinary) AND ((id)::bbf_varbinary < '0x4000000000000000'::bbf_varbinary)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.176 ms +~~END~~ + + +SELECT * FROM partition_vu_prepare_uniqueidentifier_table WHERE Id >= '00000000-0000-0000-0000-000000000000' AND Id < '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +GO +~~START~~ +text +Query Text: SELECT * FROM partition_vu_prepare_uniqueidentifier_table WHERE Id >= '00000000-0000-0000-0000-000000000000' AND Id < '6F9619FF-8B86-D011-B42D-00C04FC964FF' +Gather + Workers Planned: 1 + Single Copy: true + -> Index Scan using f3baf999c06d6ea82082a4c549baeb77_partition_1_id_idx on f3baf999c06d6ea82082a4c549baeb77_partition_1 partition_vu_prepare_uniqueidentifier_table + Index Cond: ((id >= '00000000-0000-0000-0000-000000000000'::uniqueidentifier) AND (id < '6F9619FF-8B86-D011-B42D-00C04FC964FF'::uniqueidentifier)) +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.198 ms +~~END~~ + + +SET BABELFISH_SHOWPLAN_ALL OFF +GO + +SELECT set_config('enable_seqscan', 'on', false); +SELECT set_config('enable_bitmapscan', 'on', false); +SELECT set_config('babelfishpg_tsql.explain_costs', 'on', false) +GO +~~START~~ +text +on +~~END~~ + +~~START~~ +text +on +~~END~~ + +~~START~~ +text +on +~~END~~ + + + + +-- psql +------------------------------------------ +--- Blocked Operation For Partitioned Tables +------------------------------------------- +-- user should not be allowed to CREATE/ATTACH/DETACH partition +-- to babelfish partitioned table from psql endpoint +SET ROLE master_dbo; +GO + +-- Attempt to create new partition with random values +CREATE TABLE NonExistentTable PARTITION OF master_dbo.partition_vu_prepare_int_table +FOR VALUES FROM (0) TO (500); +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: partition "nonexistenttable" would overlap partition "363863941f079adaa9aa733200e57c9f_partition_1" + Position: 157 + Server SQLState: 42P17)~~ + + +-- Attempt to create new partition with DEFAULT +CREATE TABLE NonExistentTable PARTITION OF master_dbo.partition_vu_prepare_int_table +DEFAULT +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: partition "nonexistenttable" conflicts with existing default partition "363863941f079adaa9aa733200e57c9f_partition_0" + Position: 134 + Server SQLState: 42P17)~~ + + +-- Attempt to drop partition of babelfish partitioned table from psql endpoint +DROP TABLE master_dbo."363863941f079adaa9aa733200e57c9f_partition_0"; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot drop the babelfish partition table '363863941f079adaa9aa733200e57c9f_partition_0'. + Server SQLState: 42704)~~ + + + +-- Attempt to detach +-- explicit schema name specified +ALTER TABLE master_dbo.partition_vu_prepare_int_table +DETACH PARTITION master_dbo."363863941f079adaa9aa733200e57c9f_partition_0"; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot detach partition from babelfish partitioned table 'partition_vu_prepare_int_table'. + Server SQLState: 0A000)~~ + + +-- using search_path +SET search_path = public, master_dbo; +ALTER TABLE master_dbo.partition_vu_prepare_int_table +DETACH PARTITION master_dbo."363863941f079adaa9aa733200e57c9f_partition_0"; +RESET search_path; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot detach partition from babelfish partitioned table 'partition_vu_prepare_int_table'. + Server SQLState: 0A000)~~ + + +-- Attempt to detach using CONCURRENTLY option +ALTER TABLE master_dbo.partition_vu_prepare_int_table +DETACH PARTITION master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +CONCURRENTLY; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot detach partition from babelfish partitioned table 'partition_vu_prepare_int_table'. + Server SQLState: 0A000)~~ + + +-- Attempt to detach using FINALIZE option +ALTER TABLE master_dbo.partition_vu_prepare_int_table +DETACH PARTITION master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +FINALIZE; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot detach partition from babelfish partitioned table 'partition_vu_prepare_int_table'. + Server SQLState: 0A000)~~ + + +-- Attempt to attach with Default value +ALTER TABLE master_dbo.partition_vu_prepare_int_table +ATTACH PARTITION NonExistentTable DEFAULT; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot attach partition to babelfish partitioned table 'partition_vu_prepare_int_table'. + Server SQLState: 0A000)~~ + + +-- Attempt to attach with random value +ALTER TABLE master_dbo.partition_vu_prepare_int_table +ATTACH PARTITION NonExistentTable FOR VALUES FROM (10) TO (20); +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot attach partition to babelfish partitioned table 'partition_vu_prepare_int_table'. + Server SQLState: 0A000)~~ + + + +-- user should not be allowed to modify partition +-- of babelfish partitioned table neither from psql nor tsql endpoint +-- explicit schema name specified +ALTER TABLE master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +ADD CONSTRAINT xyz CHECK ( id > 10 and id < 20); +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Modifying partitions directly is not supported. You can modify the partitions by modifying the parent table. + Server SQLState: 0A000)~~ + + +-- using search_path +SET search_path = public, master_dbo; +ALTER TABLE "363863941f079adaa9aa733200e57c9f_partition_0" +ADD CONSTRAINT xyz CHECK ( id > 10 and id < 20); +RESET search_path; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Modifying partitions directly is not supported. You can modify the partitions by modifying the parent table. + Server SQLState: 0A000)~~ + + +RESET ROLE; +GO + +-- Attempt to ADD storage parameter to babelfish partitioned table (not on the partitions) +SET babelfishpg_tsql.sql_dialect = "tsql"; +GO + +ALTER TABLE master_dbo.partition_vu_prepare_int_table SET (autovacuum_enabled = false); +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: cannot specify storage parameters for a partitioned table + Hint: Specify storage parameters for its leaf partitions instead. + Server SQLState: 42809)~~ + + +RESET babelfishpg_tsql.sql_dialect; +GO + + +-- tsql +ALTER TABLE [363863941f079adaa9aa733200e57c9f_partition_0] +ADD new_col int +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Modifying partitions directly is not supported. You can modify the partitions by modifying the parent table.)~~ + + + +ALTER TABLE [363863941f079adaa9aa733200e57c9f_partition_0] +ADD CONSTRAINT xyz DEFAULT 10 FOR id; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Modifying partitions directly is not supported. You can modify the partitions by modifying the parent table.)~~ + + +-- with explicity schema name +ALTER TABLE dbo.[363863941f079adaa9aa733200e57c9f_partition_0] +ADD new_col int +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Modifying partitions directly is not supported. You can modify the partitions by modifying the parent table.)~~ + + +ALTER TABLE dbo.[363863941f079adaa9aa733200e57c9f_partition_0] +ADD CONSTRAINT xyz DEFAULT 10 FOR id; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Modifying partitions directly is not supported. You can modify the partitions by modifying the parent table.)~~ + + +-- Attempt to drop partition of babelfish partitioned table from tsql endpoint +DROP TABLE [363863941f079adaa9aa733200e57c9f_partition_0] +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the babelfish partition table '363863941f079adaa9aa733200e57c9f_partition_0'.)~~ + + +-- psql +-------------------------------------------------------------------- +-- user should not be allowed to rename partition of +-- babelfish partitioned table neither from psql nor tsql endpoint +-------------------------------------------------------------------- +-- Attempt to rename partition of babelfish partitioned table from psql endpoint +-- explicit schema name specified +ALTER TABLE master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +RENAME TO xyz +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot rename babelfish partition table '363863941f079adaa9aa733200e57c9f_partition_0'. + Server SQLState: 0A000)~~ + + +-- using search_path +SET search_path = public, master_dbo; +ALTER TABLE "363863941f079adaa9aa733200e57c9f_partition_1" +RENAME TO xyz1 +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: Cannot rename babelfish partition table '363863941f079adaa9aa733200e57c9f_partition_1'. + Server SQLState: 0A000)~~ + + +-- tsql +-- Attempt to rename partition of babelfish partitioned table from tsql endpoint +-- NOTE: object not found error because sp_rename lookup in sys.objects which +-- will not list child objects +EXEC sp_rename '363863941f079adaa9aa733200e57c9f_partition_2', 'xyz2', 'OBJECT' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: There is no object with the given @objname.)~~ + + +-------------------------------------------------------------------- +--- Unsupported Option with CREATE TABLE with PARTITION SCHEME +-------------------------------------------------------------------- +-- Computed column as partitioning column is not yet supported in babelfish +CREATE TABLE TestPartitionedTable +( + id INT, + value INT, + computed_col AS id + value +) +ON IntPartitionScheme(computed_col); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cannot use generated column in partition key)~~ + + +CREATE TABLE TestPartitionedTable +( + id INT, + value INT, + computed_col AS id + value PERSISTED +) +ON IntPartitionScheme(computed_col); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cannot use generated column in partition key)~~ + + +-- temporary table +CREATE TABLE #TestPartitionedTable +( + id INT, + value INT +) +ON IntPartitionScheme(id); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Creation of temporary partitioned tables is not supported in Babelfish.)~~ + + + +--------------------------------------------------------------- +--- Negative Scenarios for CREATE TABLE with PARTITION SCHEME +--------------------------------------------------------------- +-- Attempt to create with multiple columns as partitioning scheme +CREATE TABLE TestPartitionedTable +( + id INT, + value INT +) +ON IntPartitionScheme(id, value); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near ',' at line 10 and character position 24)~~ + + +-- Attempt to create with a partition scheme that doesn't exist and column that doesn't exist in the table +CREATE TABLE TestPartitionedTable +( + id INT, + value INT +) +ON NonExistentPartitionScheme(NonExistentColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: column "nonexistentcolumn" named in partition key does not exist)~~ + + +-- Attempt to create with a partition scheme that doesn't exist +CREATE TABLE TestPartitionedTable +( + id INT, + value INT +) +ON NonExistentPartitionScheme(id); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid partition scheme 'NonExistentPartitionScheme' specifed.)~~ + + +-- Attempt to use two part name with partition scheme +CREATE TABLE TestPartitionedTable +( + id INT, + value INT +) +ON master.IntPartitionScheme(id); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '.' at line 7 and character position 9)~~ + + +-- Attempt to create with a unique constraint on a non-partition column +CREATE TABLE TestPartitionedTable +( + Id INT, + PartitionColumn INT, + Col1 INT UNIQUE +) +ON IntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: unique constraint on partitioned table must include all partitioning columns)~~ + + +-- Attempt to create with a primary key constraint on a non-partition column +CREATE TABLE TestPartitionedTable +( + Id INT, + PartitionColumn INT, + Col1 INT PRIMARY KEY +) +ON IntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: unique constraint on partitioned table must include all partitioning columns)~~ + + +--------------------------------------------------------------- +--- Negative Scenarios for CREATE TABLE with PARTITION SCHEME +--- Attempt to create with an incompatible partition column data type +--------------------------------------------------------------- +CREATE TABLE TestPartitionedTable1 +( + Id INT, + PartitionColumn DECIMAL(10, 2) +) +ON IntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'decimal' which is different from the partition function 'IntPartitionFunction' parameter data type 'int'.)~~ + + +CREATE TABLE TestPartitionedTable2 +( + Id INT, + PartitionColumn DATETIME +) +ON DatePartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'datetime' which is different from the partition function 'DatePartitionFunction' parameter data type 'date'.)~~ + + +CREATE TABLE TestPartitionedTable3 +( + Id INT, + PartitionColumn VARCHAR(10) +) +ON CharPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'varchar' which is different from the partition function 'CharPartitionFunction' parameter data type 'char'.)~~ + + +CREATE TABLE TestPartitionedTable4 +( + Id INT, + PartitionColumn VARBINARY(10) +) +ON BinaryPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'varbinary' which is different from the partition function 'BinaryPartitionFunction' parameter data type 'binary'.)~~ + + +CREATE TABLE TestPartitionedTable5 +( + Id INT, + PartitionColumn SMALLINT +) +ON BigIntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'int2' which is different from the partition function 'BigIntPartitionFunction' parameter data type 'bigint'.)~~ + + +CREATE TABLE TestPartitionedTable6 +( + Id INT, + PartitionColumn DECIMAL(10, 2) +) +ON SmallIntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'decimal' which is different from the partition function 'SmallIntPartitionFunction' parameter data type 'smallint'.)~~ + + +CREATE TABLE TestPartitionedTable7 +( + Id INT, + PartitionColumn DECIMAL(10, 5) +) +ON TinyIntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'decimal' which is different from the partition function 'TinyIntPartitionFunction' parameter data type 'tinyint'.)~~ + + +CREATE TABLE TestPartitionedTable8 +( + Id INT, + PartitionColumn BIGINT +) +ON DecimalPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'int8' which is different from the partition function 'DecimalPartitionFunction' parameter data type 'decimal'.)~~ + + +CREATE TABLE TestPartitionedTable9 +( + Id INT, + PartitionColumn MONEY +) +ON NumericPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'money' which is different from the partition function 'NumericPartitionFunction' parameter data type 'numeric'.)~~ + + +CREATE TABLE TestPartitionedTable10 +( + Id INT, + PartitionColumn INT +) +ON MoneyPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'int4' which is different from the partition function 'MoneyPartitionFunction' parameter data type 'money'.)~~ + + +CREATE TABLE TestPartitionedTable11 +( + Id INT, + PartitionColumn DATETIME +) +ON SmallMoneyPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'datetime' which is different from the partition function 'SmallMoneyPartitionFunction' parameter data type 'smallmoney'.)~~ + + +CREATE TABLE TestPartitionedTable12 +( + Id INT, + PartitionColumn DATETIME2(3) +) +ON DateTimePartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'datetime2' which is different from the partition function 'DateTimePartitionFunction' parameter data type 'datetime'.)~~ + + +CREATE TABLE TestPartitionedTable13 +( + Id INT, + PartitionColumn SMALLDATETIME +) +ON DateTime2PartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'smalldatetime' which is different from the partition function 'DateTime2PartitionFunction' parameter data type 'datetime2'.)~~ + + +CREATE TABLE TestPartitionedTable14 +( + Id INT, + PartitionColumn NVARCHAR(10) +) +ON SmallDateTimePartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'nvarchar' which is different from the partition function 'SmallDateTimePartitionFunction' parameter data type 'smalldatetime'.)~~ + + +CREATE TABLE TestPartitionedTable15 +( + Id INT, + PartitionColumn INT +) +ON NVarCharPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'int4' which is different from the partition function 'NVarCharPartitionFunction' parameter data type 'nvarchar'.)~~ + + +CREATE TABLE TestPartitionedTable16 +( + Id INT, + PartitionColumn NCHAR(5) +) +ON VarCharPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'nchar' which is different from the partition function 'VarCharPartitionFunction' parameter data type 'varchar'.)~~ + + +CREATE TABLE TestPartitionedTable17 +( + Id INT, + PartitionColumn INT +) +ON NCharPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'int4' which is different from the partition function 'NCharPartitionFunction' parameter data type 'nchar'.)~~ + + +-- using user defined type +CREATE TYPE PartitionUserDefinedType FROM SMALLINT; +GO + +CREATE TABLE TestPartitionedTable18 +( + Id INT, + PartitionColumn PartitionUserDefinedType +) +ON BigIntPartitionScheme(PartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Partition column 'partitioncolumn' has data type 'partitionuserdefinedtype' which is different from the partition function 'BigIntPartitionFunction' parameter data type 'bigint'.)~~ + + +DROP TYPE PartitionUserDefinedType +GO + +--------------------------------------------------------------- +--- Negative Scenarios for CREATE Index with PARTITION SCHEME +--------------------------------------------------------------- +CREATE TABLE TestPartitionedTable ( + PartitionColumn INT, + NonPartitionColumn INT +) ON IntPartitionScheme(PartitionColumn); +GO + +CREATE TABLE TestNonPartitionedTable ( + a INT, + b INT +) +GO + +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonExistentColumn1) +ON NonExistentPartitionScheme (NonExistentColumn2); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: column "nonexistentcolumn1" does not exist)~~ + + +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonPartitionColumn) +ON NonExistentPartitionScheme (NonExistentColumn2); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: column 'nonexistentcolumn2' does not exist)~~ + + +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonPartitionColumn) +ON NonExistentPartitionScheme (NonPartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid object name 'NonExistentPartitionScheme'.)~~ + + +-- scheme is different from the partition scheme used in the table +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonPartitionColumn) +ON BigIntPartitionScheme (NonPartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Un-aligned Index is not supported in Babelfish.)~~ + + +-- column specified with partition scheme is different +-- from the partition column used in the table +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonPartitionColumn) +ON IntPartitionScheme (NonPartitionColumn); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Un-aligned Index is not supported in Babelfish.)~~ + + +-- should work +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonPartitionColumn) +ON IntPartitionScheme (PartitionColumn); +GO + +DROP INDEX TestPartitionIndex ON TestPartitionedTable +GO + +-- usage of partition scheme on non-partitioned table (should fail) +CREATE INDEX TestPartitionIndex +ON TestNonPartitionedTable(a) +ON IntPartitionScheme (a); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Un-aligned Index is not supported in Babelfish.)~~ + + + +DROP TABLE TestPartitionedTable +GO + +DROP TABLE TestNonPartitionedTable +GO +-- psql +------------------------------------------------------------------------------------------- +--- Rename Operation on Partitioned Tables should update name in babelfish_partition_depend +--- and it should also update the name of all the partitions +------------------------------------------------------------------------------------------- +SELECT sys.db_name(dbid) as db_name, partition_scheme_name, schema_name, table_name FROM sys.babelfish_partition_depend where table_name = 'partition_vu_prepare_int_table'; +GO +~~START~~ +"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar" +master#!#IntPartitionScheme#!#dbo#!#partition_vu_prepare_int_table +~~END~~ + + +SELECT inhrelid::regclass as partition_name from pg_inherits where inhparent = (select oid from pg_class where relname = 'partition_vu_prepare_int_table')::regclass; +GO +~~START~~ +regclass +master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +master_dbo."363863941f079adaa9aa733200e57c9f_partition_1" +master_dbo."363863941f079adaa9aa733200e57c9f_partition_2" +master_dbo."363863941f079adaa9aa733200e57c9f_partition_3" +~~END~~ + + +-- tsql +-- trigger rename from TSQL endpoint +EXEC sp_rename 'partition_vu_prepare_int_table', 'partition_vu_prepare_int_table_renamed', 'OBJECT' +GO + +-- psql +SELECT sys.db_name(dbid) as db_name, partition_scheme_name, schema_name, table_name FROM sys.babelfish_partition_depend where table_name = 'partition_vu_prepare_int_table_renamed'; +GO +~~START~~ +"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar" +master#!#IntPartitionScheme#!#dbo#!#partition_vu_prepare_int_table_renamed +~~END~~ + + +SELECT inhrelid::regclass as partition_name from pg_inherits where inhparent = (select oid from pg_class where relname = 'partition_vu_prepare_int_table_renamed')::regclass; +GO +~~START~~ +regclass +master_dbo.c2647401dc3e9a950809daafcd188637_partition_0 +master_dbo.c2647401dc3e9a950809daafcd188637_partition_1 +master_dbo.c2647401dc3e9a950809daafcd188637_partition_2 +master_dbo.c2647401dc3e9a950809daafcd188637_partition_3 +~~END~~ + + +-- trigger rename from PSQL endpoint +ALTER TABLE master_dbo.partition_vu_prepare_int_table_renamed RENAME TO partition_vu_prepare_int_table; +GO + +-- we should get orginal here +SELECT sys.db_name(dbid) as db_name, partition_scheme_name, schema_name, table_name FROM sys.babelfish_partition_depend where table_name = 'partition_vu_prepare_int_table'; +GO +~~START~~ +"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar" +master#!#IntPartitionScheme#!#dbo#!#partition_vu_prepare_int_table +~~END~~ + + +SELECT inhrelid::regclass as partition_name from pg_inherits where inhparent = (select oid from pg_class where relname = 'partition_vu_prepare_int_table')::regclass; +GO +~~START~~ +regclass +master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +master_dbo."363863941f079adaa9aa733200e57c9f_partition_1" +master_dbo."363863941f079adaa9aa733200e57c9f_partition_2" +master_dbo."363863941f079adaa9aa733200e57c9f_partition_3" +~~END~~ + + +-- tsql +---------------------------------------------------------- +--- DOLLAR PARTITION FUNCTION name identifiers tests +---------------------------------------------------------- +SET QUOTED_IDENTIFIER ON; +GO + +SELECT $PARTITION."IntPartitionFunction" (100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT $PARTITION."PARTITION_FUNCTION 😎$@ #123 🌍rder "(100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT "master".$PARTITION."PARTITION_FUNCTION 😎$@ #123 🌍rder "(100) +GO +~~START~~ +int +2 +~~END~~ + + +SET QUOTED_IDENTIFIER OFF; +GO + + +SELECT $PARTITION.[PARTITION_FUNCTION 유니코드스키마👻 ] (100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT [master].$PARTITION.[PARTITION_FUNCTION 유니코드스키마👻 ] (100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT $PARTITION.[IntPartitionFunction] (100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT [master].$PARTITION.[IntPartitionFunction] (100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT $PARTITION.PARTITION_FUNCTIONログインαιώνια (100) +GO +~~START~~ +int +2 +~~END~~ + + +SELECT master.$PARTITION.PARTITION_FUNCTIONログインαιώνια (100) +GO +~~START~~ +int +2 +~~END~~ + + +------------------------------------------ +--- DOLLAR PARTITION FUNCTION Negative test +------------------------------------------ +-- explicit NULL value test +SELECT $PARTITION.IntPartitionFunction(NULL) +GO +~~START~~ +int +1 +~~END~~ + + +SELECT master.$PARTITION.IntPartitionFunction(NULL) +GO +~~START~~ +int +1 +~~END~~ + + +-- variable as NULL value +declare @var int = NULL +SELECT $PARTITION.IntPartitionFunction(@var) +GO +~~START~~ +int +1 +~~END~~ + + +-- non-existent database +SELECT NonExistentDatabase.$PARTITION.IntPartitionFunction(10) +GO +~~START~~ +int +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid database name 'NonExistentDatabase'.)~~ + + +-- error during implicit Conversion of values to partition function parameter type +SELECT $PARTITION.IntPartitionFunction('xyz') +GO +~~START~~ +int +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type integer: "xyz")~~ + + +-- using query +SELECT $PARTITION.IntPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_varchar_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type integer: "Apple")~~ + +--------------------------------------------------------------------- +--- Test for all the Supported Datatypes for Dollar Partition Function +--------------------------------------------------------------------- +SELECT $PARTITION.IntPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_int_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#int +1#!# +2#!#1 +2#!#100 +4#!#10000 +~~END~~ + + +SELECT $PARTITION.BigIntPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_bigint_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#bigint +1#!# +2#!#1 +3#!#100 +5#!#10000 +5#!#1000000000 +~~END~~ + + +SELECT $PARTITION.SmallIntPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_smallint_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#smallint +1#!# +2#!#-32768 +3#!#1 +4#!#32767 +~~END~~ + + +SELECT $PARTITION.TinyIntPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_tinyint_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#tinyint +1#!# +2#!#1 +3#!#128 +4#!#255 +~~END~~ + + +SELECT $PARTITION.DecimalPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_decimal_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#numeric +1#!# +2#!#1.00000 +3#!#100.00000 +4#!#200.00000 +5#!#300.00000 +~~END~~ + + +SELECT $PARTITION.NumericPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_numeric_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#numeric +1#!# +2#!#1.00 +3#!#10.00 +4#!#20.00 +5#!#30.00 +~~END~~ + + +SELECT $PARTITION.MoneyPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_money_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#money +1#!# +1#!#1.0000 +2#!#2.5679 +4#!#4.9100 +~~END~~ + + +SELECT $PARTITION.SmallMoneyPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_smallmoney_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#smallmoney +1#!# +1#!#1.0000 +2#!#2.5679 +4#!#4.9100 +~~END~~ + + +SELECT $PARTITION.DatePartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_date_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#date +1#!# +2#!#2022-01-01 +3#!#2022-07-01 +4#!#2023-01-01 +~~END~~ + + +SELECT $PARTITION.DateTimePartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_datetime_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#datetime +1#!# +2#!#2019-01-01 00:00:00.0 +3#!#2022-01-01 00:00:00.0 +4#!#2022-07-01 00:00:00.0 +~~END~~ + + +SELECT $PARTITION.DateTime2PartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_datetime2_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#datetime2 +1#!# +2#!#2019-01-01 00:00:00.000 +3#!#2022-01-01 00:00:00.000 +4#!#2022-07-01 00:00:00.000 +~~END~~ + + +SELECT $PARTITION.SmallDateTimePartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_smalldatetime_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#smalldatetime +1#!# +2#!#2019-01-01 00:00:00.0 +3#!#2022-01-01 00:00:00.0 +4#!#2022-07-01 00:00:00.0 +~~END~~ + + +SELECT $PARTITION.CharPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_char_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#char +1#!# +2#!#A +3#!#D +5#!#K +7#!#U +~~END~~ + + +SELECT $PARTITION.VarCharPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_varchar_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#varchar +1#!# +2#!#Apple +3#!#Banana +4#!#Cherry +5#!#Date +6#!#Mango +~~END~~ + + +SELECT $PARTITION.NVarCharPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_nvarchar_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#nvarchar +1#!# +2#!#Apple +3#!#Banana +4#!#Cherry +5#!#Date +6#!#Mango +~~END~~ + + +SELECT $PARTITION.NCharPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_nchar_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#nchar +1#!# +2#!#A +3#!#B +5#!#K +7#!#U +~~END~~ + + +SELECT $PARTITION.BinaryPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_binary_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#binary +1#!# +2#!#00000000 +2#!#00C00000 +3#!#04000000 +4#!#08000000 +~~END~~ + + +SELECT $PARTITION.VarBinaryPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_varbinary_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#varbinary +1#!# +2#!#0000000000000000 +3#!#4000000000000000 +4#!#8000000000000000 +5#!#C000000000000000 +~~END~~ + + +SELECT $PARTITION.UniqueIdentifierPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_uniqueidentifier_table +ORDER BY PartitionNumber, Id; +GO +~~START~~ +int#!#uniqueidentifier +1#!# +2#!#00000000-0000-0000-0000-000000000000 +3#!#6F9619FF-8B86-D011-B42D-00C04FC964FF +4#!#FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF +~~END~~ + + +---------------------------------------------- +--- DOLLAR PARTITION FUNCTION Dependency test +---------------------------------------------- +-- non-null test +SELECT * FROM DollarPartitionFunctionView +GO +~~START~~ +int#!#int +1#!# +2#!#1 +2#!#100 +4#!#10000 +~~END~~ + + +EXEC DollarPartitionFunctionProc +GO +~~START~~ +int#!#int +1#!# +2#!#1 +2#!#100 +4#!#10000 +~~END~~ + + +SELECT * FROM DollarPartitionFunctionFunc() +GO +~~START~~ +int#!#int +1#!# +2#!#1 +2#!#100 +4#!#10000 +~~END~~ + + +-- null test +SELECT * FROM DollarPartitionFunctionNullView +GO +~~START~~ +int +1 +~~END~~ + + +EXEC DollarPartitionFunctionNullProc +GO +~~START~~ +int +1 +~~END~~ + + +SELECT * FROM DollarPartitionFunctionNullFunc() +GO +~~START~~ +int +1 +~~END~~ + + +SELECT * FROM SysSearchPartitionDepView +GO +~~START~~ +int +2 +~~END~~ + + +SELECT * FROM SysSearchPartitionNULLDepView +GO +~~START~~ +int +2 +~~END~~ + +------------------------------------------------------ +--- DOLLAR PARTITION FUNCTION Cross Database test +------------------------------------------------------ +-- in current database with explicity lookup +SELECT master.$PARTITION.[IntPartitionFunction] (100) +GO +~~START~~ +int +2 +~~END~~ + + +-- use different database +USE PartitionDb; +GO + +SELECT CURRENT_USER +GO +~~START~~ +varchar +dbo +~~END~~ + + +SELECT master.$PARTITION.[IntPartitionFunction] (100) +GO +~~START~~ +int +2 +~~END~~ + + +-- test using guest login +CREATE LOGIN partition_l2 WITH PASSWORD = '12345678'; +GO + +CREATE USER partition_u2 FOR LOGIN partition_l2; +GO + +-- tsql user=partition_l2 password=12345678 database=partitiondb +SELECT CURRENT_USER +GO +~~START~~ +varchar +partition_u2 +~~END~~ + + +SELECT master.$PARTITION.[IntPartitionFunction] (100) +GO +~~START~~ +int +2 +~~END~~ + + +-- tsql +USE PartitionDb; +GO + +DROP USER partition_u2 +GO diff --git a/test/JDBC/expected/parallel_query/TestHalfvecDatatype.out b/test/JDBC/expected/parallel_query/TestHalfvecDatatype.out new file mode 100644 index 00000000000..5825cfeabc1 --- /dev/null +++ b/test/JDBC/expected/parallel_query/TestHalfvecDatatype.out @@ -0,0 +1,1823 @@ +-- tsql +-- should throw error since vector is only allowed in sys +exec sp_execute_postgresql 'create extension vector'; +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'vector' extension creation is restricted to 'sys' schema)~~ + + +exec sp_execute_postgresql 'create extension vector with schema sys'; +go + +create login vector_login with password='12345678' +go + +Alter server role sysadmin add member vector_login +go + +create database vector_db; +go + +use vector_db +go + +-- tsql user=vector_login password=12345678 +use vector_db; +go + +select set_config('babelfishpg_tsql.explain_costs', 'off', false); +go +~~START~~ +text +off +~~END~~ + +select set_config('babelfishpg_tsql.explain_timing', 'off', false); +go +~~START~~ +text +off +~~END~~ + +select set_config('babelfishpg_tsql.explain_summary', 'off', false); +go +~~START~~ +text +off +~~END~~ + + +SELECT CAST('[1,2,3]' as halfvec); +go +~~START~~ +varchar +[1,2,3] +~~END~~ + + +SELECT CAST('[-1,-2,-3]' as halfvec); +go +~~START~~ +varchar +[-1,-2,-3] +~~END~~ + + +SELECT CAST('[1.,2.,3.]' as halfvec); +go +~~START~~ +varchar +[1,2,3] +~~END~~ + + +SELECT CAST(' [ 1, 2 , 3 ] ' as halfvec); +go +~~START~~ +varchar +[1,2,3] +~~END~~ + + +SELECT CAST('[1.23456]' as halfvec); +go +~~START~~ +varchar +[1.234375] +~~END~~ + + +SELECT CAST('[hello,1]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[hello,1]")~~ + + +SELECT CAST('[NaN,1]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: NaN not allowed in halfvec)~~ + + +SELECT CAST('[Infinity,1]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: infinite value not allowed in halfvec)~~ + + +SELECT CAST('[-Infinity,1]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: infinite value not allowed in halfvec)~~ + + +SELECT CAST('[65519,-65519]' as halfvec); +go +~~START~~ +varchar +[65504,-65504] +~~END~~ + + +SELECT CAST('[65520,-65520]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: "65520" is out of range for type halfvec)~~ + + +SELECT CAST('[1e-8,-1e-8]' as halfvec); +go +~~START~~ +varchar +[0,-0] +~~END~~ + + +SELECT CAST('[4e38,1]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: "4e38" is out of range for type halfvec)~~ + + +SELECT CAST('[1e-46,1]' as halfvec); +go +~~START~~ +varchar +[0,1] +~~END~~ + + +SELECT CAST('[1,2,3' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[1,2,3")~~ + + +SELECT CAST('[1,2,3]9' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[1,2,3]9")~~ + + +SELECT CAST('1,2,3' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "1,2,3")~~ + + +SELECT CAST('' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "")~~ + + +SELECT CAST('[' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[")~~ + + +SELECT CAST('[ ' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[ ")~~ + + +SELECT CAST('[,' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[,")~~ + + +SELECT CAST('[]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: halfvec must have at least 1 dimension)~~ + + +SELECT CAST('[ ]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: halfvec must have at least 1 dimension)~~ + + +SELECT CAST('[,]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[,]")~~ + + +SELECT CAST('[1,]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[1,]")~~ + + +SELECT CAST('[1a]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[1a]")~~ + + +SELECT CAST('[1,,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[1,,3]")~~ + + +SELECT CAST('[1, ,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type halfvec: "[1, ,3]")~~ + + +SELECT CAST('[1,2,3]' as halfvec(3)); +go +~~START~~ +varchar +[1,2,3] +~~END~~ + + +SELECT CAST('[1,2,3]' as halfvec(2)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: expected 2 dimensions, not 3)~~ + + +SELECT CAST('[1,2,3]' as halfvec(3, 2)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid type modifier)~~ + + +SELECT CAST('[1,2,3]' as halfvec('a')); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '(' at line 1 and character position 32)~~ + + +SELECT CAST('[1,2,3]' as halfvec(0)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: dimensions for type halfvec must be at least 1)~~ + + +SELECT CAST('[1,2,3]' as halfvec(16001)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: dimensions for type halfvec cannot exceed 16000)~~ + + +SELECT CAST('{"[1,2,3]"}' as halfvec(2)[]); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '[]' at line 1 and character position 39)~~ + + +SELECT CAST('[1,2,3]' as halfvec) + CAST('[4,5,6]' as halfvec); +go +~~START~~ +varchar +[5,7,9] +~~END~~ + + +SELECT CAST('[65519]' as halfvec) + CAST('[65519]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: value out of range: overflow)~~ + + +SELECT CAST('[1,2]' as halfvec) + CAST('[3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT CAST('[1,2,3]' as halfvec) - CAST('[4,5,6]' as halfvec); +go +~~START~~ +varchar +[-3,-3,-3] +~~END~~ + + +SELECT CAST('[-65519]' as halfvec) - CAST('[65519]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: value out of range: overflow)~~ + + +SELECT CAST('[1,2]' as halfvec) - CAST('[3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT CAST('[1,2,3]' as halfvec) * CAST('[4,5,6]' as halfvec); +go +~~START~~ +varchar +[4,10,18] +~~END~~ + + +SELECT CAST('[65519]' as halfvec) * CAST('[65519]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: value out of range: overflow)~~ + + +SELECT CAST('[1e-7]' as halfvec) * CAST('[1e-7]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: value out of range: underflow)~~ + + +SELECT CAST('[1,2]' as halfvec) * CAST('[3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT CAST('[1,2,3]' as halfvec) + CAST('[4,5]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 3 and 2)~~ + + +SELECT CAST('[1,2,3]' as halfvec) < CAST('[1,2,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '<' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) < CAST('[1,2]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '<' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) <= CAST('[1,2,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '<' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) <= CAST('[1,2]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '<' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) = CAST('[1,2,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '=' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) = CAST('[1,2]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '=' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) != CAST('[1,2,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '!' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) != CAST('[1,2]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '!' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) >= CAST('[1,2,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '>' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) >= CAST('[1,2]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '>' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) > CAST('[1,2,3]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '>' at line 1 and character position 34)~~ + + +SELECT CAST('[1,2,3]' as halfvec) > CAST('[1,2]' as halfvec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '>' at line 1 and character position 34)~~ + + +SELECT halfvec_cmp(CAST('[1,2,3]' as halfvec), CAST('[1,2,3]' as halfvec)); +go +~~START~~ +int +0 +~~END~~ + + +SELECT halfvec_cmp(CAST('[1,2,3]' as halfvec), CAST('[0,0,0]' as halfvec)); +go +~~START~~ +int +1 +~~END~~ + + +SELECT halfvec_cmp(CAST('[0,0,0]' as halfvec), CAST('[1,2,3]' as halfvec)); +go +~~START~~ +int +-1 +~~END~~ + + +SELECT halfvec_cmp(CAST('[1,2]' as halfvec), CAST('[1,2,3]' as halfvec)); +go +~~START~~ +int +-1 +~~END~~ + + +SELECT halfvec_cmp(CAST('[1,2,3]' as halfvec), CAST('[1,2]' as halfvec)); +go +~~START~~ +int +1 +~~END~~ + + +SELECT halfvec_cmp(CAST('[1,2]' as halfvec), CAST('[2,3,4]' as halfvec)); +go +~~START~~ +int +-1 +~~END~~ + + +SELECT halfvec_cmp(CAST('[2,3]' as halfvec), CAST('[1,2,3]' as halfvec)); +go +~~START~~ +int +1 +~~END~~ + + +SELECT vector_dims(CAST('[1,2,3]' as halfvec)); +go +~~START~~ +int +3 +~~END~~ + + +SELECT ROUND(CAST(l2_norm(CAST('[1,1]' as halfvec)) as numeric), 5); +go +~~START~~ +numeric +1.00000 +~~END~~ + + +SELECT l2_norm(CAST('[3,4]' as halfvec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_norm(CAST('[0,1]' as halfvec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT l2_norm(CAST('[0,0]' as halfvec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT l2_norm(CAST('[2]' as halfvec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT l2_distance(CAST('[0,0]' as halfvec), CAST('[3,4]' as halfvec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_distance(CAST('[0,0]' as halfvec), CAST('[0,1]' as halfvec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT l2_distance(CAST('[1,2]' as halfvec), CAST('[3]' as halfvec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT l2_distance(CAST('[1,1,1,1,1,1,1,1,1]' as halfvec), CAST('[1,1,1,1,1,1,1,4,5]' as halfvec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT CAST('[0,0]' as halfvec) <-> CAST('[3,4]' as halfvec); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT inner_product(CAST('[1,2]' as halfvec), CAST('[3,4]' as halfvec)); +go +~~START~~ +float +11.0 +~~END~~ + + +SELECT inner_product(CAST('[1,2]' as halfvec), CAST('[3]' as halfvec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT inner_product(CAST('[65504]' as halfvec), CAST('[65504]' as halfvec)); +go +~~START~~ +float +4.290774016E9 +~~END~~ + + +SELECT inner_product(CAST('[1,1,1,1,1,1,1,1,1]' as halfvec), CAST('[1,2,3,4,5,6,7,8,9]' as halfvec)); +go +~~START~~ +float +45.0 +~~END~~ + + +SELECT CAST('[1,2]' as halfvec) <#> CAST('[3,4]' as halfvec); +go +~~START~~ +float +-11.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,2]' as halfvec), CAST('[2,4]' as halfvec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,2]' as halfvec), CAST('[0,0]' as halfvec)); +go +~~START~~ +float +NaN +~~END~~ + + +SELECT cosine_distance(CAST('[1,1]' as halfvec), CAST('[1,1]' as halfvec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,0]' as halfvec), CAST('[0,2]' as halfvec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,1]' as halfvec), CAST('[-1,-1]' as halfvec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,2]' as halfvec), CAST('[3]' as halfvec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT cosine_distance(CAST('[1,1]' as halfvec), CAST('[1.1,1.1]' as halfvec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,1]' as halfvec), CAST('[-1.1,-1.1]' as halfvec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,2,3,4,5,6,7,8,9]' as halfvec), CAST('[1,2,3,4,5,6,7,8,9]' as halfvec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('[1,2,3,4,5,6,7,8,9]' as halfvec), CAST('[-1,-2,-3,-4,-5,-6,-7,-8,-9]' as halfvec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT CAST('[1,2]' as halfvec) <=> CAST('[2,4]' as halfvec); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT l1_distance(CAST('[0,0]' as halfvec), CAST('[3,4]' as halfvec)); +go +~~START~~ +float +7.0 +~~END~~ + + +SELECT l1_distance(CAST('[0,0]' as halfvec), CAST('[0,1]' as halfvec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT l1_distance(CAST('[1,2]' as halfvec), CAST('[3]' as halfvec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different halfvec dimensions 2 and 1)~~ + + +SELECT l1_distance(CAST('[1,2,3,4,5,6,7,8,9]' as halfvec), CAST('[1,2,3,4,5,6,7,8,9]' as halfvec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT l1_distance(CAST('[1,2,3,4,5,6,7,8,9]' as halfvec), CAST('[0,3,2,5,4,7,6,9,8]' as halfvec)); +go +~~START~~ +float +9.0 +~~END~~ + + +SELECT CAST('[0,0]' as halfvec) <+> CAST('[3,4]' as halfvec); +go +~~START~~ +float +7.0 +~~END~~ + + +SELECT l2_normalize(CAST('[3,4]' as halfvec)); +go +~~START~~ +varchar +[0.60009766,0.7998047] +~~END~~ + + +SELECT l2_normalize(CAST('[3,0]' as halfvec)); +go +~~START~~ +varchar +[1,0] +~~END~~ + + +SELECT l2_normalize(CAST('[0,0.1]' as halfvec)); +go +~~START~~ +varchar +[0,1] +~~END~~ + + +SELECT l2_normalize(CAST('[0,0]' as halfvec)); +go +~~START~~ +varchar +[0,0] +~~END~~ + + +SELECT l2_normalize(CAST('[65504]' as halfvec)); +go +~~START~~ +varchar +[1] +~~END~~ + + +SELECT binary_quantize(CAST('[1,0,-1]' as halfvec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: data type bit is not supported yet)~~ + + +SELECT binary_quantize(CAST('[0,0.1,-0.2,-0.3,0.4,0.5,0.6,-0.7,0.8,-0.9,1]' as halfvec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: data type bit is not supported yet)~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 1, 3); +go +~~START~~ +varchar +[1,2,3] +~~END~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 3, 2); +go +~~START~~ +varchar +[3,4] +~~END~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), -1, 3); +go +~~START~~ +varchar +[1] +~~END~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 3, 9); +go +~~START~~ +varchar +[3,4,5] +~~END~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 1, 0); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: halfvec must have at least 1 dimension)~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 3, -1); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: halfvec must have at least 1 dimension)~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), -1, 2); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: halfvec must have at least 1 dimension)~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 2147483647, 10); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: halfvec must have at least 1 dimension)~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 3, 2147483647); +go +~~START~~ +varchar +[3,4,5] +~~END~~ + + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), -2147483644, 2147483647); +go +~~START~~ +varchar +[1,2] +~~END~~ + + +SELECT halfvec_avg(array_agg(CAST(n as halfvec))) FROM generate_series(1, 16002) n; +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cannot cast type integer to halfvec)~~ + + +-- hnsw_halfvec +-- l2 +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING hnsw (val halfvec_l2_ops); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,2,3] +[1,2,4] +[1,1,1] +[0,0,0] +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec) NULLS LAST +Gather (actual rows=4 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <-> '[3,3,3]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <-> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <-> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <-> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SELECT COUNT(*) FROM halfvec_table; +go +~~START~~ +int +5 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM halfvec_table +Gather (actual rows=1 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Aggregate (actual rows=1 loops=1) + -> Seq Scan on halfvec_table (actual rows=5 loops=1) +~~END~~ + + +TRUNCATE TABLE halfvec_table; +go + +SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec) NULLS LAST +Gather (actual rows=0 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=0 loops=1) + Order By: (val <-> '[3,3,3]'::halfvec) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- inner product +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING hnsw (val halfvec_ip_ops); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <#> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,2,4] +[1,2,3] +[1,1,1] +[0,0,0] +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <#> CAST('[3,3,3]' AS halfvec) NULLS LAST +Gather (actual rows=4 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <#> '[3,3,3]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <#> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <#> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <#> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- cosine +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING hnsw (val halfvec_cosine_ops); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <=> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,1,1] +[1,2,3] +[1,2,4] +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <=> CAST('[3,3,3]' AS halfvec) NULLS LAST +Gather (actual rows=3 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=3 loops=1) + Order By: (val <=> '[3,3,3]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> CAST('[0,0,0]' AS halfvec)) t2; +go +~~START~~ +int +3 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> CAST('[0,0,0]' AS halfvec) NULLS LAST) t2 +Gather (actual rows=1 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=3 loops=1) + Order By: (val <=> '[0,0,0]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +3 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=3 loops=1) + Order By: (val <=> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- L1 +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING hnsw (val halfvec_l1_ops); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <+> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,2,3] +[1,2,4] +[1,1,1] +[0,0,0] +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <+> CAST('[3,3,3]' AS halfvec) NULLS LAST +Gather (actual rows=4 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <+> '[3,3,3]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <+> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <+> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <+> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + +-- ivfflat +-- l2 +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING ivfflat (val halfvec_l2_ops) WITH (lists = 1); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,2,3] +[1,2,4] +[1,1,1] +[0,0,0] +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec) NULLS LAST +Gather (actual rows=4 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <-> '[3,3,3]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <-> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <-> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=4 loops=1) + Order By: (val <-> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SELECT COUNT(*) FROM halfvec_table; +go +~~START~~ +int +5 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM halfvec_table +Gather (actual rows=1 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Aggregate (actual rows=1 loops=1) + -> Seq Scan on halfvec_table (actual rows=5 loops=1) +~~END~~ + + +TRUNCATE TABLE halfvec_table; +go + +SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec) NULLS LAST +Gather (actual rows=0 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=0 loops=1) + Order By: (val <-> '[3,3,3]'::halfvec) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- inner product +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING ivfflat (val halfvec_ip_ops) WITH (lists = 1) WITH (lists = 1); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near 'lists' at line 1 and character position 92)~~ + + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <#> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,2,4] +[1,2,3] +[1,1,1] +[0,0,0] + +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <#> CAST('[3,3,3]' AS halfvec) NULLS LAST +Gather (actual rows=5 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Sort (actual rows=5 loops=1) + Sort Key: ((val <#> '[3,3,3]'::halfvec)) + Worker 0: Sort Method: quicksort Memory: 25kB + -> Seq Scan on halfvec_table (actual rows=5 loops=1) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <#> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +5 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <#> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Sort (actual rows=5 loops=1) + Sort Key: ((halfvec_table.val <#> $0)) + Sort Method: quicksort Memory: 25kB + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) + -> Seq Scan on halfvec_table (actual rows=5 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- cosine +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON halfvec_table USING ivfflat (val halfvec_cosine_ops) WITH (lists = 1); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM halfvec_table ORDER BY val <=> CAST('[3,3,3]' AS halfvec); +go +~~START~~ +varchar +[1,1,1] +[1,2,3] +[1,2,4] +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM halfvec_table ORDER BY val <=> CAST('[3,3,3]' AS halfvec) NULLS LAST +Gather (actual rows=3 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=3 loops=1) + Order By: (val <=> '[3,3,3]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> CAST('[0,0,0]' AS halfvec)) t2; +go +~~START~~ +int +3 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> CAST('[0,0,0]' AS halfvec) NULLS LAST) t2 +Gather (actual rows=1 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=3 loops=1) + Order By: (val <=> '[0,0,0]'::halfvec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> (SELECT CAST(NULL as halfvec))) t2; +go +~~START~~ +int +3 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> (SELECT CAST(NULL as halfvec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxhalfvec_table7f9bec28bc8902d45d905788d7aa59a1 on halfvec_table (actual rows=3 loops=1) + Order By: (val <=> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go +~~START~~ +text +on +~~END~~ + + +select set_config('babelfishpg_tsql.explain_costs', 'on', false); +go +~~START~~ +text +on +~~END~~ + +select set_config('babelfishpg_tsql.explain_timing', 'on', false); +go +~~START~~ +text +on +~~END~~ + +select set_config('babelfishpg_tsql.explain_summary', 'on', false); +go +~~START~~ +text +on +~~END~~ + + +-- system metadata, all objects get their datatype info from one of: +-- typecodes or datatype_info data we have created. Testing sys.types for typecodes +-- and sp_sproc_columns_100 for datatype_info is enough +select count(*) from sys.types where name = 'halfvec'; +go +~~START~~ +int +1 +~~END~~ + + +create procedure halfvec_proc_1 @a halfvec, @b varchar(max) as select @a as a, @b as b; +go + +exec sp_sproc_columns_100 @procedure_name= 'halfvec_proc_1' +go +~~START~~ +varchar#!#varchar#!#nvarchar#!#varchar#!#smallint#!#smallint#!#varchar#!#int#!#int#!#smallint#!#smallint#!#smallint#!#varchar#!#nvarchar#!#smallint#!#smallint#!#int#!#int#!#varchar#!#tinyint +vector_db#!#dbo#!#halfvec_proc_1;1#!#@RETURN_VALUE#!#5#!#4#!#int#!#10#!#4#!#0#!#10#!#0#!##!##!#4#!##!##!#0#!#NO#!#56 +vector_db#!#dbo#!#halfvec_proc_1;1#!#@a#!#1#!##!#halfvec#!#0#!#-1#!#0#!##!##!##!##!##!##!##!#1#!#NO#!# +vector_db#!#dbo#!#halfvec_proc_1;1#!#@b#!#1#!#12#!#varchar#!#0#!#8000#!#0#!##!#1#!##!##!#12#!##!##!#2#!#YES#!#39 +~~END~~ + + +drop procedure halfvec_proc_1; +go + +create table t(a halfvec(3), b varchar(max)) +go +select * from information_schema.columns where table_name = 't' +go +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#int#!#nvarchar#!#varchar#!#nvarchar#!#int#!#int#!#tinyint#!#smallint#!#int#!#smallint#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +vector_db#!#dbo#!#t#!#a#!#1#!##!#YES#!#halfvec#!#-1#!##!##!##!##!##!##!##!##!##!##!##!##!##!# +vector_db#!#dbo#!#t#!#b#!#2#!##!#YES#!#varchar#!#-1#!#-1#!##!##!##!##!##!##!##!##!##!#bbf_unicode_cp1_ci_as#!##!##!# +~~END~~ + +select count(*) from sys.columns where object_id = sys.object_id('t') +go +~~START~~ +int +2 +~~END~~ + +drop table t; +go + +-- Testing with different typmod +CREATE TABLE document_embeddings ( + id int PRIMARY KEY, + embedding halfvec(4) NOT NULL +); +go +CREATE INDEX document_embeddings_embedding_idx ON document_embeddings USING hnsw (embedding vector_l2_ops); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: operator class "vector_l2_ops" does not accept data type halfvec)~~ + +INSERT INTO document_embeddings(id, embedding) VALUES(1, CAST('[21,-2,0,2.5]' as halfvec)); +INSERT INTO document_embeddings(id, embedding) VALUES(2, CAST('[5, 10000, -9.75, 8]' as halfvec)); +INSERT INTO document_embeddings(id, embedding) VALUES(3, CAST('[-0.02,23,3.14,00]' as halfvec)); +WITH cte AS ( + SELECT CAST(2e2 AS real) a, 80 b, CAST('-65519' AS real) c, -1 d +) +INSERT INTO document_embeddings(id, embedding) SELECT 4, CAST(CONCAT('[',a, ',', b, ',', c, ',', d, ']') as halfvec) FROM cte; +go +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +SELECT * FROM document_embeddings; +go +~~START~~ +int#!#varchar +1#!#[21,-2,0,2.5] +2#!#[5,10000,-9.75,8] +3#!#[-0.020004272,23,3.140625,0] +4#!#[200,80,-65504,-1] +~~END~~ + +SELECT TOP 5 * FROM document_embeddings ORDER BY embedding <=> '[3,1,2,4]'; +go +~~START~~ +int#!#varchar +1#!#[21,-2,0,2.5] +3#!#[-0.020004272,23,3.140625,0] +2#!#[5,10000,-9.75,8] +4#!#[200,80,-65504,-1] +~~END~~ + +-- extending PG syntax to have generic vector expression support +SELECT count(embedding <-> '[3,1,2,0]') FROM document_embeddings; +SELECT count(embedding <=> '[3,1,2,0]') FROM document_embeddings; +SELECT count(embedding <#> '[3,1,2,0]') FROM document_embeddings; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +int +4 +~~END~~ + +~~START~~ +int +4 +~~END~~ + + +-- WHERE clause expressions +SELECT * FROM document_embeddings WHERE embedding <-> '[3,20, 1,-2.5]' < 5; +SELECT * FROM document_embeddings WHERE embedding <=> '[3,20, 1,-2.5]' < 5; +SELECT * FROM document_embeddings WHERE embedding <#> '[3,20, 1,-2.5]' < 5; +go +~~START~~ +int#!#varchar +~~END~~ + +~~START~~ +int#!#varchar +1#!#[21,-2,0,2.5] +2#!#[5,10000,-9.75,8] +3#!#[-0.020004272,23,3.140625,0] +4#!#[200,80,-65504,-1] +~~END~~ + +~~START~~ +int#!#varchar +1#!#[21,-2,0,2.5] +2#!#[5,10000,-9.75,8] +3#!#[-0.020004272,23,3.140625,0] +~~END~~ + + +SELECT AVG(embedding) FROM document_embeddings; +go +~~START~~ +varchar +[56.5,2526,-16376,2.375] +~~END~~ + + +SELECT id, AVG(embedding) FROM document_embeddings GROUP BY id; +go +~~START~~ +int#!#varchar +2#!#[5,10000,-9.75,8] +3#!#[-0.020004272,23,3.140625,0] +4#!#[200,80,-65504,-1] +1#!#[21,-2,0,2.5] +~~END~~ + + +Drop table document_embeddings +go + +-- psql +-- Need to terminate active session before cleaning up the login +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'vector_login' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +GO +~~START~~ +bool +t +~~END~~ + + +-- tsql +use master +go + +exec sp_execute_postgresql 'drop extension vector'; +go + +drop login vector_login +go + +drop database vector_db; +go diff --git a/test/JDBC/expected/parallel_query/TestSparsevecDatatype.out b/test/JDBC/expected/parallel_query/TestSparsevecDatatype.out new file mode 100644 index 00000000000..b4e480d7a3f --- /dev/null +++ b/test/JDBC/expected/parallel_query/TestSparsevecDatatype.out @@ -0,0 +1,1611 @@ +-- tsql +-- should throw error since vector is only allowed in sys +exec sp_execute_postgresql 'create extension vector'; +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: 'vector' extension creation is restricted to 'sys' schema)~~ + + +exec sp_execute_postgresql 'create extension vector with schema sys'; +go + +create login vector_login with password='12345678' +go + +Alter server role sysadmin add member vector_login +go + +create database vector_db; +go + +use vector_db +go + +-- tsql user=vector_login password=12345678 +use vector_db; +go + +select set_config('babelfishpg_tsql.explain_costs', 'off', false); +go +~~START~~ +text +off +~~END~~ + +select set_config('babelfishpg_tsql.explain_timing', 'off', false); +go +~~START~~ +text +off +~~END~~ + +select set_config('babelfishpg_tsql.explain_summary', 'off', false); +go +~~START~~ +text +off +~~END~~ + + +SELECT CAST('{1:1.5,3:3.5}/5' as sparsevec); +go +~~START~~ +varchar +{1:1.5,3:3.5}/5 +~~END~~ + + +SELECT CAST('{1:-2,3:-4}/5' as sparsevec); +go +~~START~~ +varchar +{1:-2,3:-4}/5 +~~END~~ + + +SELECT CAST('{1:2.,3:4.}/5' as sparsevec); +go +~~START~~ +varchar +{1:2,3:4}/5 +~~END~~ + + +SELECT CAST(' { 1 : 1.5 , 3 : 3.5 } / 5 ' as sparsevec); +go +~~START~~ +varchar +{1:1.5,3:3.5}/5 +~~END~~ + + +SELECT CAST('{1:1.23456}/1' as sparsevec); +go +~~START~~ +varchar +{1:1.23456}/1 +~~END~~ + + +SELECT CAST('{1:hello,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{1:hello,2:1}/2")~~ + + +SELECT CAST('{1:NaN,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: NaN not allowed in sparsevec)~~ + + +SELECT CAST('{1:Infinity,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: infinite value not allowed in sparsevec)~~ + + +SELECT CAST('{1:-Infinity,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: infinite value not allowed in sparsevec)~~ + + +SELECT CAST('{1:1.5e38,2:-1.5e38}/2' as sparsevec); +go +~~START~~ +varchar +{1:1.5e+38,2:-1.5e+38}/2 +~~END~~ + + +SELECT CAST('{1:1.5e+38,2:-1.5e+38}/2' as sparsevec); +go +~~START~~ +varchar +{1:1.5e+38,2:-1.5e+38}/2 +~~END~~ + + +SELECT CAST('{1:1.5e-38,2:-1.5e-38}/2' as sparsevec); +go +~~START~~ +varchar +{1:1.5e-38,2:-1.5e-38}/2 +~~END~~ + + +SELECT CAST('{1:4e38,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: "4e38" is out of range for type sparsevec)~~ + + +SELECT CAST('{1:-4e38,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: "-4e38" is out of range for type sparsevec)~~ + + +SELECT CAST('{1:1e-46,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: "1e-46" is out of range for type sparsevec)~~ + + +SELECT CAST('{1:-1e-46,2:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: "-1e-46" is out of range for type sparsevec)~~ + + +SELECT CAST('' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "")~~ + + +SELECT CAST('{' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{")~~ + + +SELECT CAST('{ ' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{ ")~~ + + +SELECT CAST('{:' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{:")~~ + + +SELECT CAST('{,' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{,")~~ + + +SELECT CAST('{}' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{}")~~ + + +SELECT CAST('{}/'' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near ''{}/'' at line 1 and character position 12)~~ + + +SELECT CAST('{}/1' as sparsevec); +go +~~START~~ +varchar +{}/1 +~~END~~ + + +SELECT CAST('{}/1a' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{}/1a")~~ + + +SELECT CAST('{ }/1' as sparsevec); +go +~~START~~ +varchar +{}/1 +~~END~~ + + +SELECT CAST('{:}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{:}/1")~~ + + +SELECT CAST('{,}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{,}/1")~~ + + +SELECT CAST('{1,}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{1,}/1")~~ + + +SELECT CAST('{:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{:1}/1")~~ + + +SELECT CAST('{1:}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{1:}/1")~~ + + +SELECT CAST('{1a:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{1a:1}/1")~~ + + +SELECT CAST('{1:1a}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{1:1a}/1")~~ + + +SELECT CAST('{1:1,}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid input syntax for type sparsevec: "{1:1,}/1")~~ + + +SELECT CAST('{1:0,2:1,3:0}/3' as sparsevec); +go +~~START~~ +varchar +{2:1}/3 +~~END~~ + + +SELECT CAST('{2:1,1:1}/2' as sparsevec); +go +~~START~~ +varchar +{1:1,2:1}/2 +~~END~~ + + +SELECT CAST('{1:1,1:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec indices must not contain duplicates)~~ + + +SELECT CAST('{1:1,2:1,1:1}/2' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec indices must not contain duplicates)~~ + + +SELECT CAST('{}/5' as sparsevec); +go +~~START~~ +varchar +{}/5 +~~END~~ + + +SELECT CAST('{}/-1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec must have at least 1 dimension)~~ + + +SELECT CAST('{}/1000000001' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec cannot have more than 1000000000 dimensions)~~ + + +SELECT CAST('{}/2147483648' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec cannot have more than 1000000000 dimensions)~~ + + +SELECT CAST('{}/-2147483649' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec must have at least 1 dimension)~~ + + +SELECT CAST('{}/9223372036854775808' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec cannot have more than 1000000000 dimensions)~~ + + +SELECT CAST('{}/-9223372036854775809' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec must have at least 1 dimension)~~ + + +SELECT CAST('{2147483647:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec index out of bounds)~~ + + +SELECT CAST('{2147483648:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec index out of bounds)~~ + + +SELECT CAST('{-2147483648:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec index out of bounds)~~ + + +SELECT CAST('{-2147483649:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec index out of bounds)~~ + + +SELECT CAST('{0:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec index out of bounds)~~ + + +SELECT CAST('{2:1}/1' as sparsevec); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: sparsevec index out of bounds)~~ + + +SELECT CAST('{}/3' as sparsevec(3)); +go +~~START~~ +varchar +{}/3 +~~END~~ + + +SELECT CAST('{}/3' as sparsevec(2)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: expected 2 dimensions, not 3)~~ + + +SELECT CAST('{}/3' as sparsevec(3, 2)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: invalid type modifier)~~ + + +SELECT CAST('{}/3' as sparsevec('a')); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '(' at line 1 and character position 31)~~ + + +SELECT CAST('{}/3' as sparsevec(0)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: dimensions for type sparsevec must be at least 1)~~ + + +SELECT CAST('{}/3' as sparsevec(1000000001)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: dimensions for type sparsevec cannot exceed 1000000000)~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) < CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +0 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) < CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +0 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) <= CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +1 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) <= CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +0 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) = CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +1 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) = CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +0 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) != CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +0 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) != CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +1 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) >= CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +1 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) >= CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +1 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) > CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +0 +~~END~~ + + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) > CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go +~~START~~ +int +1 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{1:1,2:2,3:3}/3' as sparsevec), CAST('{1:1,2:2,3:3}/3' as sparsevec)); +go +~~START~~ +int +0 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{1:1,2:2,3:3}/3' as sparsevec), CAST('{}/3' as sparsevec)); +go +~~START~~ +int +1 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{}/3' as sparsevec), CAST('{1:1,2:2,3:3}/3' as sparsevec)); +go +~~START~~ +int +-1 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:1,2:2,3:3}/3' as sparsevec)); +go +~~START~~ +int +-1 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{1:1,2:2,3:3}/3' as sparsevec), CAST('{1:1,2:2}/2' as sparsevec)); +go +~~START~~ +int +1 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:2,2:3,3:4}/3' as sparsevec)); +go +~~START~~ +int +-1 +~~END~~ + + +SELECT sparsevec_cmp(CAST('{1:2,2:3}/2' as sparsevec), CAST('{1:1,2:2,3:3}/3' as sparsevec)); +go +~~START~~ +int +1 +~~END~~ + + +SELECT ROUND(l2_norm(CAST('{1:1,2:1}/2' as sparsevec)), 5); +go +~~START~~ +numeric +1.41421 +~~END~~ + + +SELECT l2_norm(CAST('{1:3,2:4}/2' as sparsevec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_norm(CAST('{2:1}/2' as sparsevec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT l2_norm(CAST('{1:3e37,2:4e37}/2' as sparsevec)); +go +~~START~~ +float +5.000000042966943E37 +~~END~~ + + +SELECT l2_norm(CAST('{}/2' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT l2_norm(CAST('{1:2}/1' as sparsevec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT l2_distance(CAST('{}/2' as sparsevec), CAST('{1:3,2:4}/2' as sparsevec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_distance(CAST('{1:3}/2' as sparsevec), CAST('{2:4}/2' as sparsevec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_distance(CAST('{2:4}/2' as sparsevec), CAST('{1:3}/2' as sparsevec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_distance(CAST('{1:3,2:4}/2' as sparsevec), CAST('{}/2' as sparsevec)); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT l2_distance(CAST('{}/2' as sparsevec), CAST('{2:1}/2' as sparsevec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT CAST('{}/2' as sparsevec) <-> CAST('{1:3,2:4}/2' as sparsevec); +go +~~START~~ +float +5.0 +~~END~~ + + +SELECT inner_product(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:2,2:4}/2' as sparsevec)); +go +~~START~~ +float +10.0 +~~END~~ + + +SELECT inner_product(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:3}/1' as sparsevec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different sparsevec dimensions 2 and 1)~~ + + +SELECT inner_product(CAST('{1:1,3:3}/4' as sparsevec), CAST('{2:2,4:4}/4' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT inner_product(CAST('{2:2,4:4}/4' as sparsevec), CAST('{1:1,3:3}/4' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT inner_product(CAST('{1:1,3:3,5:5}/5' as sparsevec), CAST('{2:4,3:6,4:8}/5' as sparsevec)); +go +~~START~~ +float +18.0 +~~END~~ + + +SELECT inner_product(CAST('{1:1}/2' as sparsevec), CAST('{}/2' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT inner_product(CAST('{}/2' as sparsevec), CAST('{1:1}/2' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT inner_product(CAST('{1:3e38}/1' as sparsevec), CAST('{1:3e38}/1' as sparsevec)); +go +~~START~~ +float +Infinity +~~END~~ + + +SELECT inner_product(CAST('{1:1,3:3,5:5}/5' as sparsevec), CAST('{2:4,3:6,4:8}/5' as sparsevec)); +go +~~START~~ +float +18.0 +~~END~~ + + +SELECT CAST('{1:1,2:2}/2' as sparsevec) <#> CAST('{1:3,2:4}/2' as sparsevec); +go +~~START~~ +float +-11.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:2,2:4}/2' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:1,2:2}/2' as sparsevec), CAST('{}/2' as sparsevec)); +go +~~START~~ +float +NaN +~~END~~ + + +SELECT cosine_distance(CAST('{1:1,2:1}/2' as sparsevec), CAST('{1:1,2:1}/2' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:1}/2' as sparsevec), CAST('{2:2}/2' as sparsevec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:1,2:1}/2' as sparsevec), CAST('{1:-1,2:-1}/2' as sparsevec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:2}/2' as sparsevec), CAST('{2:2}/2' as sparsevec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT cosine_distance(CAST('{2:2}/2' as sparsevec), CAST('{1:2}/2' as sparsevec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:3}/1' as sparsevec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different sparsevec dimensions 2 and 1)~~ + + +SELECT cosine_distance(CAST('{1:1,2:1}/2' as sparsevec), CAST('{1:1.1,2:1.1}/2' as sparsevec)); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:1,2:1}/2' as sparsevec), CAST('{1:-1.1,2:-1.1}/2' as sparsevec)); +go +~~START~~ +float +2.0 +~~END~~ + + +SELECT cosine_distance(CAST('{1:3e38}/1' as sparsevec), CAST('{1:3e38}/1' as sparsevec)); +go +~~START~~ +float +NaN +~~END~~ + + +SELECT cosine_distance(CAST('{}/1' as sparsevec), CAST('{}/1' as sparsevec)); +go +~~START~~ +float +NaN +~~END~~ + + +SELECT CAST('{1:1,2:2}/2' as sparsevec) <=> CAST('{1:2,2:4}/2' as sparsevec); +go +~~START~~ +float +0.0 +~~END~~ + + +SELECT l1_distance(CAST('{}/2' as sparsevec), CAST('{1:3,2:4}/2' as sparsevec)); +go +~~START~~ +float +7.0 +~~END~~ + + +SELECT l1_distance(CAST('{}/2' as sparsevec), CAST('{2:1}/2' as sparsevec)); +go +~~START~~ +float +1.0 +~~END~~ + + +SELECT l1_distance(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:3}/1' as sparsevec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: different sparsevec dimensions 2 and 1)~~ + + +SELECT l1_distance(CAST('{1:3e38}/1' as sparsevec), CAST('{1:-3e38}/1' as sparsevec)); +go +~~START~~ +float +Infinity +~~END~~ + + +SELECT l1_distance(CAST('{1:1,3:3,5:5,7:7}/8' as sparsevec), CAST('{2:2,4:4,6:6,8:8}/8' as sparsevec)); +go +~~START~~ +float +36.0 +~~END~~ + + +SELECT l1_distance(CAST('{1:1,3:3,5:5,7:7,9:9}/9' as sparsevec), CAST('{2:2,4:4,6:6,8:8}/9' as sparsevec)); +go +~~START~~ +float +45.0 +~~END~~ + + +SELECT CAST('{}/2' as sparsevec) <+> CAST('{1:3,2:4}/2' as sparsevec); +go +~~START~~ +float +7.0 +~~END~~ + + +SELECT l2_normalize(CAST('{1:3,2:4}/2' as sparsevec)); +go +~~START~~ +varchar +{1:0.6,2:0.8}/2 +~~END~~ + + +SELECT l2_normalize(CAST('{1:3}/2' as sparsevec)); +go +~~START~~ +varchar +{1:1}/2 +~~END~~ + + +SELECT l2_normalize(CAST('{2:0.1}/2' as sparsevec)); +go +~~START~~ +varchar +{2:1}/2 +~~END~~ + + +SELECT l2_normalize(CAST('{}/2' as sparsevec)); +go +~~START~~ +varchar +{}/2 +~~END~~ + + +SELECT l2_normalize(CAST('{1:3e38}/1' as sparsevec)); +go +~~START~~ +varchar +{1:1}/1 +~~END~~ + + +SELECT l2_normalize(CAST('{1:3e38,2:1e-37}/2' as sparsevec)); +go +~~START~~ +varchar +{1:1}/2 +~~END~~ + + +SELECT l2_normalize(CAST('{2:3e37,4:3e-37,6:4e37,8:4e-37}/9' as sparsevec)); +go +~~START~~ +varchar +{2:0.6,6:0.8}/9 +~~END~~ + + + +-- L2 +CREATE TABLE sparsevec_table (val sparsevec(3)); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{}/3' AS sparsevec)), (CAST('{1:1,2:2,3:3}/3' AS sparsevec)), (CAST('{1:1,2:1,3:1}/3' AS sparsevec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON sparsevec_table USING hnsw (val sparsevec_l2_ops); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{1:1,2:2,3:4}/3' AS sparsevec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM sparsevec_table ORDER BY val <-> CAST('{1:3,2:3,3:3}/3' AS sparsevec); +go +~~START~~ +varchar +{1:1,2:2,3:3}/3 +{1:1,2:2,3:4}/3 +{1:1,2:1,3:1}/3 +{}/3 +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM sparsevec_table ORDER BY val <-> CAST('{1:3,2:3,3:3}/3' AS sparsevec) NULLS LAST +Gather (actual rows=4 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=4 loops=1) + Order By: (val <-> '{1:3,2:3,3:3}/3'::sparsevec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <-> (SELECT CAST(NULL as sparsevec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <-> (SELECT CAST(NULL as sparsevec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=4 loops=1) + Order By: (val <-> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SELECT COUNT(*) FROM sparsevec_table; +go +~~START~~ +int +5 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM sparsevec_table +Gather (actual rows=1 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Aggregate (actual rows=1 loops=1) + -> Seq Scan on sparsevec_table (actual rows=5 loops=1) +~~END~~ + + +TRUNCATE TABLE sparsevec_table; +go + +SELECT * FROM sparsevec_table ORDER BY val <-> CAST('{1:3,2:3,3:3}/3' AS sparsevec); +go +~~START~~ +varchar +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM sparsevec_table ORDER BY val <-> CAST('{1:3,2:3,3:3}/3' AS sparsevec) NULLS LAST +Gather (actual rows=0 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=0 loops=1) + Order By: (val <-> '{1:3,2:3,3:3}/3'::sparsevec) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE sparsevec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- inner product +CREATE TABLE sparsevec_table (val sparsevec(3)); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{}/3' AS sparsevec)), (CAST('{1:1,2:2,3:3}/3' AS sparsevec)), (CAST('{1:1,2:1,3:1}/3' AS sparsevec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON sparsevec_table USING hnsw (val sparsevec_ip_ops); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{1:1,2:2,3:4}/3' AS sparsevec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM sparsevec_table ORDER BY val <#> CAST('{1:3,2:3,3:3}/3' AS sparsevec); +go +~~START~~ +varchar +{1:1,2:2,3:4}/3 +{1:1,2:2,3:3}/3 +{1:1,2:1,3:1}/3 +{}/3 +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM sparsevec_table ORDER BY val <#> CAST('{1:3,2:3,3:3}/3' AS sparsevec) NULLS LAST +Gather (actual rows=4 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=4 loops=1) + Order By: (val <#> '{1:3,2:3,3:3}/3'::sparsevec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <#> (SELECT CAST(NULL as sparsevec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <#> (SELECT CAST(NULL as sparsevec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=4 loops=1) + Order By: (val <#> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE sparsevec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- cosine +CREATE TABLE sparsevec_table (val sparsevec(3)); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{}/3' AS sparsevec)), (CAST('{1:1,2:2,3:3}/3' AS sparsevec)), (CAST('{1:1,2:1,3:1}/3' AS sparsevec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON sparsevec_table USING hnsw (val sparsevec_cosine_ops); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{1:1,2:2,3:4}/3' AS sparsevec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM sparsevec_table ORDER BY val <=> CAST('{1:3,2:3,3:3}/3' AS sparsevec); +go +~~START~~ +varchar +{1:1,2:1,3:1}/3 +{1:1,2:2,3:3}/3 +{1:1,2:2,3:4}/3 +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM sparsevec_table ORDER BY val <=> CAST('{1:3,2:3,3:3}/3' AS sparsevec) NULLS LAST +Gather (actual rows=3 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=3 loops=1) + Order By: (val <=> '{1:3,2:3,3:3}/3'::sparsevec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <=> CAST('{}/3' AS sparsevec)) t2; +go +~~START~~ +int +3 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <=> CAST('{}/3' AS sparsevec) NULLS LAST) t2 +Gather (actual rows=1 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Aggregate (actual rows=1 loops=1) + -> Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=3 loops=1) + Order By: (val <=> '{}/3'::sparsevec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <=> (SELECT CAST(NULL as sparsevec))) t2; +go +~~START~~ +int +3 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <=> (SELECT CAST(NULL as sparsevec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=3 loops=1) + Order By: (val <=> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE sparsevec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- L1 +CREATE TABLE sparsevec_table (val sparsevec(3)); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{}/3' AS sparsevec)), (CAST('{1:1,2:2,3:3}/3' AS sparsevec)), (CAST('{1:1,2:1,3:1}/3' AS sparsevec)), (NULL); +go +~~ROW COUNT: 4~~ + + +CREATE INDEX idx ON sparsevec_table USING hnsw (val sparsevec_l1_ops); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{1:1,2:2,3:4}/3' AS sparsevec)); +go +~~ROW COUNT: 1~~ + + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +~~START~~ +text +off +~~END~~ + +~~START~~ +text +Query Text: SELECT set_config('enable_seqscan', 'off', false) +Result (actual rows=1 loops=1) +~~END~~ + +SELECT * FROM sparsevec_table ORDER BY val <+> CAST('{1:3,2:3,3:3}/3' AS sparsevec); +go +~~START~~ +varchar +{1:1,2:2,3:3}/3 +{1:1,2:2,3:4}/3 +{1:1,2:1,3:1}/3 +{}/3 +~~END~~ + +~~START~~ +text +Query Text: SELECT * FROM sparsevec_table ORDER BY val <+> CAST('{1:3,2:3,3:3}/3' AS sparsevec) NULLS LAST +Gather (actual rows=4 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=4 loops=1) + Order By: (val <+> '{1:3,2:3,3:3}/3'::sparsevec) +~~END~~ + + +SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <+> (SELECT CAST(NULL as sparsevec))) t2; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <+> (SELECT CAST(NULL as sparsevec)) NULLS LAST) t2 +Aggregate (actual rows=1 loops=1) + -> Index Scan using idxsparsevec_table7f9bec28bc8902d45d905788d7aa59a1 on sparsevec_table (actual rows=4 loops=1) + Order By: (val <+> $0) + InitPlan 1 (returns $0) + -> Result (actual rows=1 loops=1) +~~END~~ + + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE sparsevec_table; +go +~~START~~ +text +on +~~END~~ + + + +-- non-zero elements +CREATE TABLE sparsevec_table (val sparsevec(1001)); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST(array_fill(1, ARRAY[1001]) AS sparsevec)); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '(' at line 1 and character position 46)~~ + + +CREATE INDEX idx ON sparsevec_table USING hnsw (val sparsevec_l2_ops); +go + +TRUNCATE TABLE sparsevec_table; +go + +DROP TABLE sparsevec_table; +go + +select set_config('babelfishpg_tsql.explain_costs', 'on', false); +go +~~START~~ +text +on +~~END~~ + +select set_config('babelfishpg_tsql.explain_timing', 'on', false); +go +~~START~~ +text +on +~~END~~ + +select set_config('babelfishpg_tsql.explain_summary', 'on', false); +go +~~START~~ +text +on +~~END~~ + + +-- system metadata, all objects get their datatype info from one of: +-- typecodes or datatype_info data we have created. Testing sys.types for typecodes +-- and sp_sproc_columns_100 for datatype_info is enough +select count(*) from sys.types where name = 'sparsevec'; +go +~~START~~ +int +1 +~~END~~ + + +create procedure sparsevec_proc_1 @a sparsevec, @b varchar(max) as select @a as a, @b as b; +go + +exec sp_sproc_columns_100 @procedure_name= 'sparsevec_proc_1' +go +~~START~~ +varchar#!#varchar#!#nvarchar#!#varchar#!#smallint#!#smallint#!#varchar#!#int#!#int#!#smallint#!#smallint#!#smallint#!#varchar#!#nvarchar#!#smallint#!#smallint#!#int#!#int#!#varchar#!#tinyint +vector_db#!#dbo#!#sparsevec_proc_1;1#!#@RETURN_VALUE#!#5#!#4#!#int#!#10#!#4#!#0#!#10#!#0#!##!##!#4#!##!##!#0#!#NO#!#56 +vector_db#!#dbo#!#sparsevec_proc_1;1#!#@a#!#1#!##!#sparsevec#!#0#!#-1#!#0#!##!##!##!##!##!##!##!#1#!#NO#!# +vector_db#!#dbo#!#sparsevec_proc_1;1#!#@b#!#1#!#12#!#varchar#!#0#!#8000#!#0#!##!#1#!##!##!#12#!##!##!#2#!#YES#!#39 +~~END~~ + + +drop procedure sparsevec_proc_1; +go + +create table t(a sparsevec(3), b varchar(max)) +go +select * from information_schema.columns where table_name = 't' +go +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#int#!#nvarchar#!#varchar#!#nvarchar#!#int#!#int#!#tinyint#!#smallint#!#int#!#smallint#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +vector_db#!#dbo#!#t#!#a#!#1#!##!#YES#!#sparsevec#!#-1#!##!##!##!##!##!##!##!##!##!##!##!##!##!# +vector_db#!#dbo#!#t#!#b#!#2#!##!#YES#!#varchar#!#-1#!#-1#!##!##!##!##!##!##!##!##!##!#bbf_unicode_cp1_ci_as#!##!##!# +~~END~~ + +select count(*) from sys.columns where object_id = sys.object_id('t') +go +~~START~~ +int +2 +~~END~~ + +drop table t; +go + +-- Testing with different typmod +CREATE TABLE document_embeddings ( + id int PRIMARY KEY, + embedding sparsevec(5) NOT NULL +); +go +CREATE INDEX document_embeddings_embedding_idx ON document_embeddings USING hnsw (embedding vector_l2_ops); +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: operator class "vector_l2_ops" does not accept data type sparsevec)~~ + +INSERT INTO document_embeddings(id, embedding) VALUES(1, CAST('{1:5,2:1}/5' as sparsevec)); +INSERT INTO document_embeddings(id, embedding) VALUES(2, CAST('{1:5, 2:10000, 3:-9.75, 4:8}/5' as sparsevec)); +INSERT INTO document_embeddings(id, embedding) VALUES(3, CAST('{1:-0.02,2:23,4:3.14,5:00}/5' as sparsevec)); +WITH cte AS ( + SELECT CAST(2e2 AS real) a, 80 b, CAST('-305' AS real) c, -1 d +) +INSERT INTO document_embeddings(id, embedding) SELECT 4, CAST(CONCAT('{1:',a, ',3:', b, ',4:', c, ',5:', d, '}/5') as sparsevec) FROM cte; +go +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +SELECT * FROM document_embeddings; +go +~~START~~ +int#!#varchar +1#!#{1:5,2:1}/5 +2#!#{1:5,2:10000,3:-9.75,4:8}/5 +3#!#{1:-0.02,2:23,4:3.14}/5 +4#!#{1:200,3:80,4:-305,5:-1}/5 +~~END~~ + +SELECT TOP 5 * FROM document_embeddings ORDER BY embedding <=> '{1:1,2:2,3:4}/5'; +go +~~START~~ +int#!#varchar +2#!#{1:5,2:10000,3:-9.75,4:8}/5 +3#!#{1:-0.02,2:23,4:3.14}/5 +4#!#{1:200,3:80,4:-305,5:-1}/5 +1#!#{1:5,2:1}/5 +~~END~~ + +-- extending PG syntax to have generic vector expression support +SELECT count(embedding <-> '{1:1,2:2,3:4}/5') FROM document_embeddings; +SELECT count(embedding <=> '{1:1,2:2,3:4}/5') FROM document_embeddings; +SELECT count(embedding <#> '{1:1,2:2,3:4}/5') FROM document_embeddings; +go +~~START~~ +int +4 +~~END~~ + +~~START~~ +int +4 +~~END~~ + +~~START~~ +int +4 +~~END~~ + + +-- WHERE clause expressions +SELECT * FROM document_embeddings WHERE embedding <-> '{1:1,2:2,4:4}/5' < 5; +SELECT * FROM document_embeddings WHERE embedding <=> '{1:1,2:2,4:4}/5' < 5; +SELECT * FROM document_embeddings WHERE embedding <#> '{1:1,2:2,4:4}/5' < 5; +go +~~START~~ +int#!#varchar +~~END~~ + +~~START~~ +int#!#varchar +1#!#{1:5,2:1}/5 +2#!#{1:5,2:10000,3:-9.75,4:8}/5 +3#!#{1:-0.02,2:23,4:3.14}/5 +4#!#{1:200,3:80,4:-305,5:-1}/5 +~~END~~ + +~~START~~ +int#!#varchar +1#!#{1:5,2:1}/5 +2#!#{1:5,2:10000,3:-9.75,4:8}/5 +3#!#{1:-0.02,2:23,4:3.14}/5 +~~END~~ + + +SELECT AVG(embedding) FROM document_embeddings; +go +~~ERROR (Code: 206)~~ + +~~ERROR (Message: The function avg is found but cannot be used. Possibly due to datatype mismatch and implicit casting is not allowed.)~~ + + +SELECT id, AVG(embedding) FROM document_embeddings GROUP BY id; +go +~~ERROR (Code: 206)~~ + +~~ERROR (Message: The function avg is found but cannot be used. Possibly due to datatype mismatch and implicit casting is not allowed.)~~ + + +Drop table document_embeddings +go + +-- psql +-- Need to terminate active session before cleaning up the login +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'vector_login' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +GO +~~START~~ +bool +t +~~END~~ + + +-- tsql +use master +go + +exec sp_execute_postgresql 'drop extension vector'; +go + +drop login vector_login +go + +drop database vector_db; +go diff --git a/test/JDBC/expected/parallel_query/TestVectorDatatype.out b/test/JDBC/expected/parallel_query/TestVectorDatatype.out index 829499226d6..13c3c7edf87 100644 --- a/test/JDBC/expected/parallel_query/TestVectorDatatype.out +++ b/test/JDBC/expected/parallel_query/TestVectorDatatype.out @@ -101,7 +101,7 @@ go ~~ERROR (Message: value out of range: underflow)~~ -SELECT vector_dims('[1,2,3]'); +SELECT vector_dims(CAST('[1,2,3]' as vector)); go ~~START~~ int @@ -140,7 +140,7 @@ go ~~ERROR (Message: syntax error near 'Cast' at line 1 and character position 19)~~ -SELECT l2_distance('[0,0]', '[3,4]'); +SELECT l2_distance(CAST('[0,0]' as vector), CAST('[3,4]' as vector)); go ~~START~~ float @@ -148,7 +148,7 @@ float ~~END~~ -SELECT l2_distance('[0,0]', '[0,1]'); +SELECT l2_distance(CAST('[0,0]' as vector), CAST('[0,1]' as vector)); go ~~START~~ float @@ -156,14 +156,14 @@ float ~~END~~ -SELECT l2_distance('[1,2]', '[3]'); +SELECT l2_distance(CAST('[1,2]' as vector), CAST('[3]' as vector)); go ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: different vector dimensions 2 and 1)~~ -SELECT l2_distance('[3e38]', '[-3e38]'); +SELECT l2_distance(CAST('[3e38]' as vector), CAST('[-3e38]' as vector)); go ~~START~~ float @@ -171,7 +171,7 @@ Infinity ~~END~~ -SELECT inner_product('[1,2]', '[3,4]'); +SELECT inner_product(CAST('[1,2]' as vector), CAST('[3,4]' as vector)); go ~~START~~ float @@ -179,14 +179,14 @@ float ~~END~~ -SELECT inner_product('[1,2]', '[3]'); +SELECT inner_product(CAST('[1,2]' as vector), CAST('[3]' as vector)); go ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: different vector dimensions 2 and 1)~~ -SELECT inner_product('[3e38]', '[3e38]'); +SELECT inner_product(CAST('[3e38]' as vector), CAST('[3e38]' as vector)); go ~~START~~ float @@ -194,7 +194,7 @@ Infinity ~~END~~ -SELECT cosine_distance('[1,2]', '[2,4]'); +SELECT cosine_distance(CAST('[1,2]' as vector), CAST('[2,4]' as vector)); go ~~START~~ float @@ -202,7 +202,7 @@ float ~~END~~ -SELECT cosine_distance('[1,2]', '[0,0]'); +SELECT cosine_distance(CAST('[1,2]' as vector), CAST('[0,0]' as vector)); go ~~START~~ float @@ -210,7 +210,7 @@ NaN ~~END~~ -SELECT cosine_distance('[1,1]', '[1,1]'); +SELECT cosine_distance(CAST('[1,1]' as vector), CAST('[1,1]' as vector)); go ~~START~~ float @@ -218,7 +218,7 @@ float ~~END~~ -SELECT cosine_distance('[1,0]', '[0,2]'); +SELECT cosine_distance(CAST('[1,0]' as vector), CAST('[0,2]' as vector)); go ~~START~~ float @@ -226,7 +226,7 @@ float ~~END~~ -SELECT cosine_distance('[1,1]', '[-1,-1]'); +SELECT cosine_distance(CAST('[1,1]' as vector), CAST('[-1,-1]' as vector)); go ~~START~~ float @@ -234,14 +234,14 @@ float ~~END~~ -SELECT cosine_distance('[1,2]', '[3]'); +SELECT cosine_distance(CAST('[1,2]' as vector), CAST('[3]' as vector)); go ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: different vector dimensions 2 and 1)~~ -SELECT cosine_distance('[1,1]', '[1.1,1.1]'); +SELECT cosine_distance(CAST('[1,1]' as vector), CAST('[1.1,1.1]' as vector)); go ~~START~~ float @@ -249,7 +249,7 @@ float ~~END~~ -SELECT cosine_distance('[1,1]', '[-1.1,-1.1]'); +SELECT cosine_distance(CAST('[1,1]' as vector), CAST('[-1.1,-1.1]' as vector)); go ~~START~~ float @@ -257,7 +257,7 @@ float ~~END~~ -SELECT cosine_distance('[3e38]', '[3e38]'); +SELECT cosine_distance(CAST('[3e38]' as vector), CAST('[3e38]' as vector)); go ~~START~~ float @@ -265,7 +265,7 @@ NaN ~~END~~ -SELECT l1_distance('[0,0]', '[3,4]'); +SELECT l1_distance(CAST('[0,0]' as vector), CAST('[3,4]' as vector)); go ~~START~~ float @@ -273,7 +273,7 @@ float ~~END~~ -SELECT l1_distance('[0,0]', '[0,1]'); +SELECT l1_distance(CAST('[0,0]' as vector), CAST('[0,1]' as vector)); go ~~START~~ float @@ -281,14 +281,14 @@ float ~~END~~ -SELECT l1_distance('[1,2]', '[3]'); +SELECT l1_distance(CAST('[1,2]' as vector), CAST('[3]' as vector)); go ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: different vector dimensions 2 and 1)~~ -SELECT l1_distance('[3e38]', '[-3e38]'); +SELECT l1_distance(CAST('[3e38]' as vector), CAST('[-3e38]' as vector)); go ~~START~~ float @@ -1216,49 +1216,49 @@ SELECT CAST('[4e38,1]' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: infinite value not allowed in vector)~~ +~~ERROR (Message: "4e38" is out of range for type vector)~~ SELECT CAST('[1,2,3' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "[1,2,3")~~ +~~ERROR (Message: invalid input syntax for type vector: "[1,2,3")~~ SELECT CAST('[1,2,3]9' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "[1,2,3]9")~~ +~~ERROR (Message: invalid input syntax for type vector: "[1,2,3]9")~~ SELECT CAST('1,2,3' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "1,2,3")~~ +~~ERROR (Message: invalid input syntax for type vector: "1,2,3")~~ SELECT CAST('' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "")~~ +~~ERROR (Message: invalid input syntax for type vector: "")~~ SELECT CAST('[' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "[")~~ +~~ERROR (Message: invalid input syntax for type vector: "[")~~ SELECT CAST('[,' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "[,")~~ +~~ERROR (Message: invalid input syntax for type vector: "[,")~~ SELECT CAST('[]' as vector); @@ -1286,7 +1286,7 @@ SELECT CAST('[1,,3]' as vector); go ~~ERROR (Code: 33557097)~~ -~~ERROR (Message: malformed vector literal: "[1,,3]")~~ +~~ERROR (Message: invalid input syntax for type vector: "[1,,3]")~~ SELECT CAST('[1, ,3]' as vector); diff --git a/test/JDBC/expected/parallel_query/test_like_for_AI-vu-verify.out b/test/JDBC/expected/parallel_query/test_like_for_AI-vu-verify.out index b59b32e6fb1..5227ca0b292 100644 --- a/test/JDBC/expected/parallel_query/test_like_for_AI-vu-verify.out +++ b/test/JDBC/expected/parallel_query/test_like_for_AI-vu-verify.out @@ -1747,7 +1747,7 @@ Hi café SELECT UPPER((SELECT col FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%oNo')); GO ~~START~~ -text +nvarchar TELÉFONO ~~END~~ @@ -4357,7 +4357,7 @@ Hi café SELECT UPPER((SELECT col FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%no')); GO ~~START~~ -text +nvarchar JALAPEÑO ~~END~~ diff --git a/test/JDBC/expected/patindex-AI-collations.out b/test/JDBC/expected/patindex-AI-collations.out new file mode 100644 index 00000000000..a157e2f73ae --- /dev/null +++ b/test/JDBC/expected/patindex-AI-collations.out @@ -0,0 +1,1191 @@ + +-- BASIC TESTS +-- [] wildcard single character to match or not match +SELECT PATINDEX('%[A-Z]%', 'a' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('%[A-Z]%', 'b' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('%[A-Z]%', 'z' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('[^A-Z]', 'z' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('[^A-Z]', 'A' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('[^A-Z]', 'b' COLLATE Latin1_General_CI_AI) +GO +~~START~~ +bigint +1 +~~END~~ + +~~START~~ +bigint +1 +~~END~~ + +~~START~~ +bigint +1 +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + + +-- _ wildcard one single character to match +SELECT PATINDEX('_', 'b' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('%[A-Z]_[^A-Y]%', 'aBž' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('%aZď_[^A-Y]%', 'hqyÁzdjz' COLLATE Latin1_General_CI_AI) +GO +~~START~~ +bigint +1 +~~END~~ + +~~START~~ +bigint +1 +~~END~~ + +~~START~~ +bigint +4 +~~END~~ + + +-- _ wildcard one single character to match +SELECT PATINDEX('_', 'ě' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('%[A-Z]_[^A-Y]%', 'âBz' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('%aZď_[^A-Y]%', 'hqyâzdjż' COLLATE Latin1_General_CI_AI) +GO +~~START~~ +bigint +1 +~~END~~ + +~~START~~ +bigint +1 +~~END~~ + +~~START~~ +bigint +4 +~~END~~ + + +-- Basic Accent Insensitivity +DECLARE @testString NVARCHAR(100) = 'Café jalapeño'; +SELECT PATINDEX('%café%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 1 +SELECT PATINDEX('%jalapeno%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 6 +GO +~~START~~ +bigint +1 +~~END~~ + +~~START~~ +bigint +6 +~~END~~ + + +-- Mixed Case and Accent Sensitivity +DECLARE @testString NVARCHAR(100) = 'Résumé'; +SELECT PATINDEX('%résumé%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 1 +SELECT PATINDEX('%RESUME%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 1 +GO +~~START~~ +bigint +1 +~~END~~ + +~~START~~ +bigint +1 +~~END~~ + + +-- not found +DECLARE @testString NVARCHAR(100) = 'Example string'; +SELECT PATINDEX('%notfound%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 0 +GO +~~START~~ +bigint +0 +~~END~~ + + +-- pattern with special character +DECLARE @testString NVARCHAR(100) = 'Price: $100.00'; +SELECT PATINDEX('%$100%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 8 +SELECT PATINDEX('%100.00%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 9 +GO +~~START~~ +bigint +8 +~~END~~ + +~~START~~ +bigint +9 +~~END~~ + + +-- multiple occurrence +DECLARE @testString NVARCHAR(100) = 'Patterñ with pattern and another pattern'; +SELECT PATINDEX('%pattern%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 1 +GO +~~START~~ +bigint +1 +~~END~~ + +DECLARE @testString NVARCHAR(100) = 'patterPattèrn with pâttérn and another pattêrn'; +SELECT PATINDEX('%pattern%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 7 +GO +~~START~~ +bigint +7 +~~END~~ + + +-- empty null string +DECLARE @testString NVARCHAR(100) = ''; +DECLARE @nullString NVARCHAR(100) = NULL; +SELECT PATINDEX('%anything%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 0 +SELECT PATINDEX('%anything%', @nullString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: NULL +GO +~~START~~ +bigint +0 +~~END~~ + +~~START~~ +bigint + +~~END~~ + + +-- multiple wild cards +DECLARE @testString NVARCHAR(100) = 'Patteřn matching wiťh _ and % wildćards'; +-- `%` matches any sequence of characters +SELECT PATINDEX('%with %wildcards%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 18 +-- `_` matches exactly one character +SELECT PATINDEX('%with _ and %wildcards%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 18 +GO +~~START~~ +bigint +18 +~~END~~ + +~~START~~ +bigint +18 +~~END~~ + + + + +-- Wildcard Combination in Patterns +DECLARE @testString NVARCHAR(100) = 'Example of pattérn matching wìth speciál cases'; +-- `%` and `_` used together +SELECT PATINDEX('%pattêrn%_wíth%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 11 +-- Single `_` used in the middle +SELECT PATINDEX('%pattern _mátching%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 11 +GO +~~START~~ +bigint +12 +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + + +-- consecutive wildcards +DECLARE @testString NVARCHAR(100) = 'Dàtá with multiplé %% wildcařds'; +-- Multiple `%` wildcards +SELECT PATINDEX('%multíple % wildcaṛds%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 9 +GO +~~START~~ +bigint +11 +~~END~~ + + +-- Leading and Trailing Wildcards +DECLARE @testString NVARCHAR(100) = 'Example ştriñAEg for tésting patterns'; +-- Wildcards at both ends +SELECT PATINDEX('%strińÆg for%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 9 +-- Wildcard in the middle +SELECT PATINDEX('%strińÆg%for%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 9 +GO +~~START~~ +bigint +9 +~~END~~ + +~~START~~ +bigint +9 +~~END~~ + + +-- Complex Pattern with Special Characters +DECLARE @testString NVARCHAR(100) = 'Price: $100.00 and $200.00'; +-- Pattern with special characters and wildcards +SELECT PATINDEX('%$100.00%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 8 +SELECT PATINDEX('%$%.00%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 8 (matches $100.00) +GO +~~START~~ +bigint +8 +~~END~~ + +~~START~~ +bigint +8 +~~END~~ + + +-- Wildcards with Mixed Case +DECLARE @testString NVARCHAR(100) = 'Case Insensitive Pattern Matching'; +-- Case-insensitive wildcard match +SELECT PATINDEX('%pattern matćhing%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 19 +GO +~~START~~ +bigint +18 +~~END~~ + + +-- Long String with Wildcard +DECLARE @testString NVARCHAR(MAX) = REPLICATE('Long text with many characters to téšt the páttAern matching functionality. ', 10); +-- Long string with wildcard pattern +SELECT PATINDEX('%teśt %the% pattÆrn%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: Position in the long text +GO +~~START~~ +bigint +35 +~~END~~ + + +-- Overlapping Patterns +DECLARE @testString NVARCHAR(100) = '123123123'; +-- Pattern where `%123%` is overlapping +SELECT PATINDEX('%123123%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 1 +GO +~~START~~ +bigint +1 +~~END~~ + + +-- Escaping Wildcards +DECLARE @testString NVARCHAR(100) = 'Special characters: % and _'; +-- Escaping `%` and `_` using a pattern that should match literally +SELECT PATINDEX('%[%]%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 19 (matching `%`) +SELECT PATINDEX('%[_]%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 30 (matching `_`) +GO +~~START~~ +bigint +21 +~~END~~ + +~~START~~ +bigint +27 +~~END~~ + + +-- Wildcard with Special Characters +DECLARE @testString NVARCHAR(100) = 'File name: dața_*.txt'; +-- Wildcard with special characters +SELECT PATINDEX('%dáta_%.ťxt%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 11 +GO +~~START~~ +bigint +12 +~~END~~ + + +-- Patterns with Trailing Wildcard and Special Characters +DECLARE @testString NVARCHAR(100) = 'Numbér: 12345-6789 and 98765-4321'; +SELECT PATINDEX('%12345-%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 10 +GO +~~START~~ +bigint +9 +~~END~~ + + + +-- Multiple wildcards and special characters +DECLARE @testString NVARCHAR(100) = '123-456_789*012'; +SELECT PATINDEX('%-456_789*%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 4 +GO +~~START~~ +bigint +4 +~~END~~ + + +-- Case and accent insensitivity with complex pattern +DECLARE @testString NVARCHAR(100) = 'Accénted words: café, résumé, jalapeño'; +SELECT PATINDEX('%café%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 18 +SELECT PATINDEX('%resume%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 25 +GO +~~START~~ +bigint +17 +~~END~~ + +~~START~~ +bigint +23 +~~END~~ + + + +DECLARE @testString NVARCHAR(100) = 'Null and empty string patterns'; +-- Null pattern +DECLARE @nullPattern NVARCHAR(100) = NULL; +SELECT PATINDEX(@nullPattern, @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 0 +-- Empty pattern +DECLARE @emptyPattern NVARCHAR(100) = ''; +SELECT PATINDEX(@emptyPattern, @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 1 +GO +~~START~~ +bigint + +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + + +-- Nested wildcards +DECLARE @testString NVARCHAR(100) = 'Pattern example: a1b2c3d4e5'; +SELECT PATINDEX('%a1%b2%c3%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 1 (matches "a1b2c3") +SELECT PATINDEX('%a1_b2%c3_%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 1 (matches "a1b2c3") +GO +~~START~~ +bigint +18 +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + + +-- Long pattern with multiple wildcards +DECLARE @testString NVARCHAR(100) = REPLICATE('X', 50) + 'ý' + REPLICATE('X', 50) + 'Ź' + REPLICATE('X', 50); +SELECT PATINDEX('%X%Y%Ż%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 51 (matches "Y" and "Z") +GO +~~START~~ +bigint +0 +~~END~~ + + + +-- Pattern with digit ranges +DECLARE @testString NVARCHAR(100) = 'Order numbers: 123, 456, 789'; +SELECT PATINDEX('%[1-3][0-9][0-9]%', @testString COLLATE Latin1_General_CI_AI) -- Expected: Match Found +GO +~~START~~ +bigint +16 +~~END~~ + + + +-- Pattern with letter ranges +DECLARE @testString NVARCHAR(100) = 'Alphabet sequence: âbC, ďEf, GħI'; +SELECT PATINDEX('%[A-C][A-C][A-C]%', @testString COLLATE Latin1_General_CI_AI) +GO +~~START~~ +bigint +20 +~~END~~ + + +-- Pattern with alphanumeric ranges +DECLARE @testString NVARCHAR(100) = 'Code rańges: Á1B2, C3D4, E5F6'; +SELECT PATINDEX('%[A-C][1-4][A-C][1-4]%', @testString COLLATE Latin1_General_CI_AI) +GO +~~START~~ +bigint +14 +~~END~~ + + +-- Pattern with special characters and ranges +DECLARE @testString NVARCHAR(100) = 'Special chárs: !@#, $%^, &*()'; +SELECT PATINDEX('%[!@#][$%^&][*()]%', @testString COLLATE Latin1_General_CI_AI) +GO +~~START~~ +bigint +0 +~~END~~ + + +SELECT PATINDEX('%àbćd%', ' ' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('%abcd%', 'xyz ' COLLATE Latin1_General_CI_AI) +GO +~~START~~ +bigint +0 +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + + +SELECT PATINDEX(N'%[A-AE]%', N'Æ' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX(N'%[AE-E]%', N'Æ' COLLATE Latin1_General_CI_AI) +GO +~~START~~ +bigint +0 +~~END~~ + +~~START~~ +bigint +1 +~~END~~ + + + +-- BASIC TESTS +-- [] wildcard single character to match or not match +SELECT PATINDEX('%[A-Z]%', 'á' COLLATE Latin1_General_CS_AI) +SELECT PATINDEX('%[A-Z]%', 'b' COLLATE Latin1_General_CS_AI) +SELECT PATINDEX('%[A-Z]%', 'z' COLLATE Latin1_General_CS_AI) +SELECT PATINDEX('[^A-Z]', 'z' COLLATE Latin1_General_CS_AI) +SELECT PATINDEX('[^A-Z]', 'A' COLLATE Latin1_General_CS_AI) +SELECT PATINDEX('[^A-Z]', 'b' COLLATE Latin1_General_CS_AI) +GO +~~START~~ +bigint +0 +~~END~~ + +~~START~~ +bigint +1 +~~END~~ + +~~START~~ +bigint +1 +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + + +-- _ wildcard one single character to match +SELECT PATINDEX('_', 'b' COLLATE Latin1_General_CS_AI) +SELECT PATINDEX('%[A-Ž]_[^À-Y]%', 'aBz' COLLATE Latin1_General_CS_AI) +SELECT PATINDEX('%áZď_[^Á-Y]%', 'hqyaždjž' COLLATE Latin1_General_CS_AI) +GO +~~START~~ +bigint +1 +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + + +-- _ wildcard one single character to match +SELECT PATINDEX('_', 'b' COLLATE Latin1_General_CS_AI) +SELECT PATINDEX('%[A-Z]_[^A-Y]%', 'áBż' COLLATE Latin1_General_CS_AI) +SELECT PATINDEX('%aZď_[^A-Y]%', 'hqyazdjz' COLLATE Latin1_General_CS_AI) +GO +~~START~~ +bigint +1 +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + + +-- Basic Accent Insensitivity +DECLARE @testString NVARCHAR(100) = 'Café jalapeño'; +SELECT PATINDEX('%café%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 1 +SELECT PATINDEX('%jalapeno%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 6 +GO +~~START~~ +bigint +0 +~~END~~ + +~~START~~ +bigint +6 +~~END~~ + + +-- Mixed Case and Accent Sensitivity +DECLARE @testString NVARCHAR(100) = 'Résumé'; +SELECT PATINDEX('%résumé%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 0 +SELECT PATINDEX('%RESUME%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 0 +SELECT PATINDEX('%Resume%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 1 +GO +~~START~~ +bigint +0 +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + +~~START~~ +bigint +1 +~~END~~ + + +-- not found +DECLARE @testString NVARCHAR(100) = 'Example string'; +SELECT PATINDEX('%notfound%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 0 +SELECT PATINDEX('%Example String%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 0 +GO +~~START~~ +bigint +0 +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + + +-- pattern with special character +DECLARE @testString NVARCHAR(100) = 'Price: $100.00'; +SELECT PATINDEX('%$100%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 8 +SELECT PATINDEX('%100.00%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 9 +GO +~~START~~ +bigint +8 +~~END~~ + +~~START~~ +bigint +9 +~~END~~ + + +-- multiple occurrence +DECLARE @testString NVARCHAR(100) = 'Pattern with páttern and another pattern'; +SELECT PATINDEX('%pattern%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 14 +GO +~~START~~ +bigint +14 +~~END~~ + +DECLARE @testString NVARCHAR(100) = 'patterPattern with pattern and another pattern'; +SELECT PATINDEX('%pattérn%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 20 +GO +~~START~~ +bigint +20 +~~END~~ + + +-- empty null string +DECLARE @testString NVARCHAR(100) = ''; +DECLARE @nullString NVARCHAR(100) = NULL; +SELECT PATINDEX('%anything%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 0 +SELECT PATINDEX('%anything%', @nullString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: NULL +GO +~~START~~ +bigint +0 +~~END~~ + +~~START~~ +bigint + +~~END~~ + + +-- multiple wild cards +DECLARE @testString NVARCHAR(100) = 'Pattern matching wìth _ and % wildcards'; +-- `%` matches any sequence of characters +SELECT PATINDEX('%witħ %wildçards%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 18 +-- `_` matches exactly one character +SELECT PATINDEX('%with _ and %wildcards%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 18 +GO +~~START~~ +bigint +18 +~~END~~ + +~~START~~ +bigint +18 +~~END~~ + + + + +-- Wildcard Combination in Patterns +DECLARE @testString NVARCHAR(100) = 'Example of pattern matching with special cases'; +-- `%` and `_` used together +SELECT PATINDEX('%pattern%_with%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 11 +-- Single `_` used in the middle +SELECT PATINDEX('%pattern _matching%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 11 +GO +~~START~~ +bigint +12 +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + + +-- consecutive wildcards +DECLARE @testString NVARCHAR(100) = 'Data with multiple %% wildcards'; +-- Multiple `%` wildcards +SELECT PATINDEX('%multiple % wildcards%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 9 +GO +~~START~~ +bigint +11 +~~END~~ + + +-- Leading and Trailing Wildcards +DECLARE @testString NVARCHAR(100) = 'Example string for testing patterns'; +-- Wildcards at both ends +SELECT PATINDEX('%string for%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 9 +-- Wildcard in the middle +SELECT PATINDEX('%string%for%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 9 +GO +~~START~~ +bigint +9 +~~END~~ + +~~START~~ +bigint +9 +~~END~~ + + +-- Complex Pattern with Special Characters +DECLARE @testString NVARCHAR(100) = 'Price: $100.00 and $200.00'; +-- Pattern with special characters and wildcards +SELECT PATINDEX('%$100.00%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 8 +SELECT PATINDEX('%$%.00%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 8 (matches $100.00) +GO +~~START~~ +bigint +8 +~~END~~ + +~~START~~ +bigint +8 +~~END~~ + + +-- Wildcards with Mixed Case +DECLARE @testString NVARCHAR(100) = 'Case Insensitive Pattern Matching'; +-- Case-insensitive wildcard match +SELECT PATINDEX('%pattern matching%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 19 +GO +~~START~~ +bigint +0 +~~END~~ + + +-- Long String with Wildcard +DECLARE @testString NVARCHAR(MAX) = REPLICATE('Long text with many characters to tést the pattern matching functionality. ', 10); +-- Long string with wildcard pattern +SELECT PATINDEX('%teşt %thé% pattern%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: Position in the long text +GO +~~START~~ +bigint +35 +~~END~~ + + +-- Overlapping Patterns +DECLARE @testString NVARCHAR(100) = '123123123'; +-- Pattern where `%123%` is overlapping +SELECT PATINDEX('%123123%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 1 +GO +~~START~~ +bigint +1 +~~END~~ + + +-- Escaping Wildcards +DECLARE @testString NVARCHAR(100) = 'Special characters: % and _'; +-- Escaping `%` and `_` using a pattern that should match literally +SELECT PATINDEX('%[%]%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 19 (matching `%`) +SELECT PATINDEX('%[_]%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 30 (matching `_`) +GO +~~START~~ +bigint +21 +~~END~~ + +~~START~~ +bigint +27 +~~END~~ + + +-- Wildcard with Special Characters +DECLARE @testString NVARCHAR(100) = 'File name: data_*.txt'; +-- Wildcard with special characters +SELECT PATINDEX('%data_%.txt%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 11 +GO +~~START~~ +bigint +12 +~~END~~ + + +-- Patterns with Trailing Wildcard and Special Characters +DECLARE @testString NVARCHAR(100) = 'Number: 12345-6789 and 98765-4321'; +SELECT PATINDEX('%12345-%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 10 +GO +~~START~~ +bigint +9 +~~END~~ + + + +-- Multiple wildcards and special characters +DECLARE @testString NVARCHAR(100) = '123-456_789*012'; +SELECT PATINDEX('%-456_789*%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 4 +GO +~~START~~ +bigint +4 +~~END~~ + + +-- Case and accent insensitivity with complex pattern +DECLARE @testString NVARCHAR(100) = 'Accénted words: café, résumé, jalapeño'; +SELECT PATINDEX('%café%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 18 +SELECT PATINDEX('%resume%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 25 +GO +~~START~~ +bigint +17 +~~END~~ + +~~START~~ +bigint +23 +~~END~~ + + + +DECLARE @testString NVARCHAR(100) = 'Null and empty string patterns'; +-- Null pattern +DECLARE @nullPattern NVARCHAR(100) = NULL; +SELECT PATINDEX(@nullPattern, @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 0 +-- Empty pattern +DECLARE @emptyPattern NVARCHAR(100) = ''; +SELECT PATINDEX(@emptyPattern, @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 1 +GO +~~START~~ +bigint + +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + + +-- Nested wildcards +DECLARE @testString NVARCHAR(100) = 'Pattern example: a1b2c3d4e5'; +SELECT PATINDEX('%a1%b2%c3%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 1 (matches "a1b2c3") +SELECT PATINDEX('%a1_b2%c3_%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 1 (matches "a1b2c3") +GO +~~START~~ +bigint +18 +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + + +-- Long pattern with multiple wildcards +DECLARE @testString NVARCHAR(100) = REPLICATE('X', 50) + 'Ý' + REPLICATE('X', 50) + 'Z' + REPLICATE('X', 50); +SELECT PATINDEX('%X%Y%Z%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 51 (matches "Y" and "Z") +GO +~~START~~ +bigint +0 +~~END~~ + + + +-- Pattern with digit ranges +DECLARE @testString NVARCHAR(100) = 'Order numbers: 123, 456, 789'; +SELECT PATINDEX('%[1-3][0-9][0-9]%', @testString COLLATE Latin1_General_CS_AI) -- Expected: Match Found +GO +~~START~~ +bigint +16 +~~END~~ + + + +-- Pattern with letter ranges +DECLARE @testString NVARCHAR(100) = 'Alphabet sequence: ABĆ, DEF, GHI'; +SELECT PATINDEX('%[A-C][A-C][A-C]%', @testString COLLATE Latin1_General_CS_AI) +GO +~~START~~ +bigint +20 +~~END~~ + + +-- Pattern with alphanumeric ranges +DECLARE @testString NVARCHAR(100) = 'Code ranges: A1B2, C3D4, E5F6'; +SELECT PATINDEX('%[A-C][1-4][A-C][1-4]%', @testString COLLATE Latin1_General_CS_AI) +GO +~~START~~ +bigint +14 +~~END~~ + + +-- Pattern with special characters and ranges +DECLARE @testString NVARCHAR(100) = 'Special chars: !@#, $%^, &*()'; +SELECT PATINDEX('%[!@#][$%^&][*()]%', @testString COLLATE Latin1_General_CS_AI) +GO +~~START~~ +bigint +0 +~~END~~ + + +SELECT PATINDEX('%abćd%', ' ' COLLATE Latin1_General_CS_AI) +SELECT PATINDEX('%abcd%', 'xyz ' COLLATE Latin1_General_CS_AI) +GO +~~START~~ +bigint +0 +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + + + +SELECT PATINDEX(N'%[a-ae]%', N'Æ' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX(N'%[A-AE]%', N'Æ' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX(N'%[ae-e]%', N'Æ' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX(N'%[AE-E]%', N'Æ' COLLATE Latin1_General_CI_AI) +GO +~~START~~ +bigint +0 +~~END~~ + +~~START~~ +bigint +0 +~~END~~ + +~~START~~ +bigint +1 +~~END~~ + +~~START~~ +bigint +1 +~~END~~ + + +SELECT PATINDEX(N'%[-AE]%', N'Æ' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX(N'%%', N'Æ' COLLATE Latin1_General_CI_AI) +GO +~~START~~ +bigint +1 +~~END~~ + +~~START~~ +bigint +1 +~~END~~ + + +SELECT PATINDEX('[a-', '[a-' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('[a-]', '-' COLLATE Latin1_General_CI_AI) +GO +~~START~~ +bigint +0 +~~END~~ + +~~START~~ +bigint +1 +~~END~~ + + +CREATE TABLE #TestStrings ( + Id INT PRIMARY KEY, + TestText NVARCHAR(100) +); +GO + +INSERT INTO #TestStrings (Id, TestText) VALUES +(1, N'Çalışkan'), +(2, N'kalem'), +(3, N'KÜTÜPHANE'), +(4, N'Örnek'), +(5, N'çalışkan'), +(6, N'kalem'), +(7, N'öRnek'); +GO +~~ROW COUNT: 7~~ + + +SELECT Id, TestText, + PATINDEX(N'%çalış%', TestText COLLATE Turkish_CI_AI) AS Position +FROM #TestStrings; +GO +~~START~~ +int#!#nvarchar#!#bigint +1#!#Çalışkan#!#1 +2#!#kalem#!#0 +3#!#KÜTÜPHANE#!#0 +4#!#Örnek#!#0 +5#!#çalışkan#!#1 +6#!#kalem#!#0 +7#!#öRnek#!#0 +~~END~~ + + + +SELECT Id, TestText, + PATINDEX(N'%çalış%' COLLATE Turkish_CI_AI, TestText) AS Position +FROM #TestStrings; +DROP TABLE #TestStrings +GO +~~START~~ +int#!#nvarchar#!#bigint +1#!#Çalışkan#!#1 +2#!#kalem#!#0 +3#!#KÜTÜPHANE#!#0 +4#!#Örnek#!#0 +5#!#çalışkan#!#1 +6#!#kalem#!#0 +7#!#öRnek#!#0 +~~END~~ + + +CREATE TABLE #TestStrings ( + Id INT PRIMARY KEY, + TestText NVARCHAR(100) COLLATE Turkish_CI_AI +); +GO + +INSERT INTO #TestStrings (Id, TestText) VALUES +(1, N'Çalışkan'), +(2, N'kalem'), +(3, N'KÜTÜPHANE'), +(4, N'Örnek'), +(5, N'çalışkan'), +(6, N'kalem'), +(7, N'öRnek'); +GO +~~ROW COUNT: 7~~ + + +SELECT Id, TestText, + PATINDEX(N'%çalış%', TestText) AS Position +FROM #TestStrings; +GO +~~START~~ +int#!#nvarchar#!#bigint +1#!#Çalışkan#!#1 +2#!#kalem#!#0 +3#!#KÜTÜPHANE#!#0 +4#!#Örnek#!#0 +5#!#çalışkan#!#1 +6#!#kalem#!#0 +7#!#öRnek#!#0 +~~END~~ + + + +-- Computed columns +CREATE TABLE babel_5118_with_computed_col (pattern NVARCHAR(100), src NVARCHAR(100), patindex AS PATINDEX(pattern, src COLLATE Latin1_General_CS_AI)) +GO + +INSERT INTO babel_5118_with_computed_col (pattern, src) +VALUES + ('%[A-C][A-C][A-C]%', 'Alphabet sequence: ABĆ, DEF, GHI'), + ('%pattern%_with%', 'Example of pattern matching with special cases'), + ('_','b'); +GO +~~ROW COUNT: 3~~ + + +-- Check constraints +ALTER TABLE babel_5118_with_computed_col ADD CONSTRAINT chkRowCount CHECK (PATINDEX(pattern, src COLLATE Latin1_General_CS_AI) >= 1); +GO + +INSERT INTO babel_5118_with_computed_col (pattern, src) VALUES ('_a','b'); +GO +~~ERROR (Code: 547)~~ + +~~ERROR (Message: new row for relation "babel_5118_with_computed_col" violates check constraint "chkrowcount")~~ + + +INSERT INTO babel_5118_with_computed_col (pattern, src) VALUES ('_','b'); +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_5118_VIEW AS SELECT pattern, src, PATINDEX(pattern, src COLLATE Latin1_General_CS_AI) AS PATINDEX FROM babel_5118_with_computed_col ORDER BY pattern +GO + +SELECT * FROM babel_5118_VIEW +GO +~~START~~ +nvarchar#!#nvarchar#!#bigint +_#!#b#!#1 +_#!#b#!#1 +%[A-C][A-C][A-C]%#!#Alphabet sequence: ABĆ, DEF, GHI#!#20 +%pattern%_with%#!#Example of pattern matching with special cases#!#12 +~~END~~ + + +CREATE PROCEDURE babel_5118_with_proc +AS +SELECT pattern, src, PATINDEX(pattern, src COLLATE Latin1_General_CS_AI) AS PATINDEX FROM babel_5118_with_computed_col ORDER BY pattern +GO + +EXEC babel_5118_with_proc +GO +~~START~~ +nvarchar#!#nvarchar#!#bigint +_#!#b#!#1 +_#!#b#!#1 +%[A-C][A-C][A-C]%#!#Alphabet sequence: ABĆ, DEF, GHI#!#20 +%pattern%_with%#!#Example of pattern matching with special cases#!#12 +~~END~~ + + +DROP VIEW babel_5118_VIEW +GO + +DROP PROCEDURE babel_5118_with_proc +GO + +DROP TABLE babel_5118_with_computed_col +GO + +-- CONCAT INSIDE PATINDEX +SELECT PATINDEX(N'%[A-C]%_%[^A-Y]%Z%', CONCAT(REPEAT('b', 50), REPEAT('A', 50), REPEAT('Z', 50), REPEAT('Z', 50)) COLLATE Latin1_General_CI_AI) +GO +~~START~~ +bigint +1 +~~END~~ + + +-- Surrogate pair charcters +SELECT PATINDEX(N'%😀%', N'😀' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX(N'%Z%', N'ABC😀ZABC' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX(N'😀%', N'😀A' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX(N'%D😀%', N'ABCD😀ABCD' COLLATE Latin1_General_CI_AI) +GO +~~START~~ +bigint +1 +~~END~~ + +~~START~~ +bigint +5 +~~END~~ + +~~START~~ +bigint +1 +~~END~~ + +~~START~~ +bigint +4 +~~END~~ + diff --git a/test/JDBC/expected/pg_stat_statements_tsql.out b/test/JDBC/expected/pg_stat_statements_tsql.out index 7103f9d35a6..7c55141a593 100644 --- a/test/JDBC/expected/pg_stat_statements_tsql.out +++ b/test/JDBC/expected/pg_stat_statements_tsql.out @@ -539,7 +539,7 @@ int SELECT REVERSE(name) FROM pgss_cust go ~~START~~ -text +varchar CBA ZYX NML diff --git a/test/JDBC/expected/pgr_select_having.out b/test/JDBC/expected/pgr_select_having.out index b20e2be38a9..b36629bef19 100644 --- a/test/JDBC/expected/pgr_select_having.out +++ b/test/JDBC/expected/pgr_select_having.out @@ -70,7 +70,7 @@ SELECT lower(c), count(c) FROM test_having ORDER BY lower(c); GO ~~START~~ -text#!#int +varchar#!#int bbbb #!#3 cccc #!#4 xxxx #!#1 diff --git a/test/JDBC/expected/pgr_select_implicit.out b/test/JDBC/expected/pgr_select_implicit.out index d718a2e8426..8294c9bc850 100644 --- a/test/JDBC/expected/pgr_select_implicit.out +++ b/test/JDBC/expected/pgr_select_implicit.out @@ -335,7 +335,7 @@ SELECT lower(test_missing_target.c), count(c) FROM test_missing_target GROUP BY lower(c) ORDER BY lower(c); GO ~~START~~ -text#!#int +varchar#!#int abab #!#2 bbbb #!#3 cccc #!#4 diff --git a/test/JDBC/expected/psql_logical_babelfish_db.out b/test/JDBC/expected/psql_logical_babelfish_db.out index 0a804f271d9..87497ca168e 100644 --- a/test/JDBC/expected/psql_logical_babelfish_db.out +++ b/test/JDBC/expected/psql_logical_babelfish_db.out @@ -1,6 +1,6 @@ -- psql -- check whether we can query system views before setting the GUC. Should return zero rows -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases'; +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go ~~START~~ "sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#int4#!#"sys"."varchar"#!#varchar#!#"sys"."varchar"#!#int4#!#int4#!#int2#!#int2#!#int4#!#int2#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar" @@ -30,21 +30,21 @@ master -- query system views. Should return metadata of master database -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases'; +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go ~~START~~ "sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#int4#!#"sys"."varchar"#!#varchar#!#"sys"."varchar"#!#int4#!#int4#!#int2#!#int2#!#int4#!#int2#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar" -master#!#dbo#!#sysdatabases#!#name#!#1#!##!#YES#!#text#!#2147483647#!#2147483647#!##!##!##!##!##!##!##!##!##!#C#!##!##!# +master#!#dbo#!#sysdatabases#!#category#!#9#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#cmptlevel#!#10#!##!#YES#!#tinyint#!##!##!#3#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#crdate#!#7#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# master#!#dbo#!#sysdatabases#!#dbid#!#2#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#sid#!#3#!##!#YES#!#varbinary#!#85#!#85#!##!##!##!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#filename#!#11#!##!#YES#!#nvarchar#!#260#!#520#!##!##!##!##!##!##!##!##!##!#bbf_unicode_cp1_ci_as#!##!##!# master#!#dbo#!#sysdatabases#!#mode#!#4#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#name#!#1#!##!#YES#!#text#!#2147483647#!#2147483647#!##!##!##!##!##!##!##!##!##!#C#!##!##!# +master#!#dbo#!#sysdatabases#!#reserved#!#8#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#sid#!#3#!##!#YES#!#varbinary#!#85#!#85#!##!##!##!##!##!##!##!##!##!##!##!##!# master#!#dbo#!#sysdatabases#!#status#!#5#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# master#!#dbo#!#sysdatabases#!#status2#!#6#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#crdate#!#7#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#reserved#!#8#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#category#!#9#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#cmptlevel#!#10#!##!#YES#!#tinyint#!##!##!#3#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#filename#!#11#!##!#YES#!#nvarchar#!#260#!#520#!##!##!##!##!##!##!##!##!##!#bbf_unicode_cp1_ci_as#!##!##!# master#!#dbo#!#sysdatabases#!#version#!#12#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# ~~END~~ @@ -54,7 +54,7 @@ set psql_logical_babelfish_db_name = 'invalid_db' go -- should return zero rows as the database set does not exist -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases'; +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go ~~START~~ "sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#int4#!#"sys"."varchar"#!#varchar#!#"sys"."varchar"#!#int4#!#int4#!#int2#!#int2#!#int4#!#int2#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar" @@ -63,21 +63,21 @@ go -- tsql -- should return data of master as the current database is master -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go ~~START~~ nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#int#!#nvarchar#!#varchar#!#nvarchar#!#int#!#int#!#tinyint#!#smallint#!#int#!#smallint#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar -master#!#dbo#!#sysdatabases#!#name#!#1#!##!#YES#!#text#!#2147483647#!#2147483647#!##!##!##!##!##!##!##!##!##!#C#!##!##!# +master#!#dbo#!#sysdatabases#!#category#!#9#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#cmptlevel#!#10#!##!#YES#!#tinyint#!##!##!#3#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#crdate#!#7#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# master#!#dbo#!#sysdatabases#!#dbid#!#2#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#sid#!#3#!##!#YES#!#varbinary#!#85#!#85#!##!##!##!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#filename#!#11#!##!#YES#!#nvarchar#!#260#!#520#!##!##!##!##!##!##!##!##!##!#bbf_unicode_cp1_ci_as#!##!##!# master#!#dbo#!#sysdatabases#!#mode#!#4#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#name#!#1#!##!#YES#!#text#!#2147483647#!#2147483647#!##!##!##!##!##!##!##!##!##!#C#!##!##!# +master#!#dbo#!#sysdatabases#!#reserved#!#8#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#sid#!#3#!##!#YES#!#varbinary#!#85#!#85#!##!##!##!##!##!##!##!##!##!##!##!##!# master#!#dbo#!#sysdatabases#!#status#!#5#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# master#!#dbo#!#sysdatabases#!#status2#!#6#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#crdate#!#7#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#reserved#!#8#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#category#!#9#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#cmptlevel#!#10#!##!#YES#!#tinyint#!##!##!#3#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#filename#!#11#!##!#YES#!#nvarchar#!#260#!#520#!##!##!##!##!##!##!##!##!##!#bbf_unicode_cp1_ci_as#!##!##!# master#!#dbo#!#sysdatabases#!#version#!#12#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# ~~END~~ @@ -96,21 +96,21 @@ logical_database_db1 -- should return data of master as the current database is master -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go ~~START~~ nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#int#!#nvarchar#!#varchar#!#nvarchar#!#int#!#int#!#tinyint#!#smallint#!#int#!#smallint#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar -master#!#dbo#!#sysdatabases#!#name#!#1#!##!#YES#!#text#!#2147483647#!#2147483647#!##!##!##!##!##!##!##!##!##!#C#!##!##!# +master#!#dbo#!#sysdatabases#!#category#!#9#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#cmptlevel#!#10#!##!#YES#!#tinyint#!##!##!#3#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#crdate#!#7#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# master#!#dbo#!#sysdatabases#!#dbid#!#2#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#sid#!#3#!##!#YES#!#varbinary#!#85#!#85#!##!##!##!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#filename#!#11#!##!#YES#!#nvarchar#!#260#!#520#!##!##!##!##!##!##!##!##!##!#bbf_unicode_cp1_ci_as#!##!##!# master#!#dbo#!#sysdatabases#!#mode#!#4#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#name#!#1#!##!#YES#!#text#!#2147483647#!#2147483647#!##!##!##!##!##!##!##!##!##!#C#!##!##!# +master#!#dbo#!#sysdatabases#!#reserved#!#8#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# +master#!#dbo#!#sysdatabases#!#sid#!#3#!##!#YES#!#varbinary#!#85#!#85#!##!##!##!##!##!##!##!##!##!##!##!##!# master#!#dbo#!#sysdatabases#!#status#!#5#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# master#!#dbo#!#sysdatabases#!#status2#!#6#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#crdate#!#7#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#reserved#!#8#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#category#!#9#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#cmptlevel#!#10#!##!#YES#!#tinyint#!##!##!#3#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -master#!#dbo#!#sysdatabases#!#filename#!#11#!##!#YES#!#nvarchar#!#260#!#520#!##!##!##!##!##!##!##!##!##!#bbf_unicode_cp1_ci_as#!##!##!# master#!#dbo#!#sysdatabases#!#version#!#12#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# ~~END~~ @@ -119,21 +119,21 @@ use logical_database_db1 go -- should return data of logical_database_db1 as the current database is logical_database_db1 -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go ~~START~~ nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#int#!#nvarchar#!#varchar#!#nvarchar#!#int#!#int#!#tinyint#!#smallint#!#int#!#smallint#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar -logical_database_db1#!#dbo#!#sysdatabases#!#name#!#1#!##!#YES#!#text#!#2147483647#!#2147483647#!##!##!##!##!##!##!##!##!##!#C#!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#category#!#9#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#cmptlevel#!#10#!##!#YES#!#tinyint#!##!##!#3#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#crdate#!#7#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# logical_database_db1#!#dbo#!#sysdatabases#!#dbid#!#2#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#sid#!#3#!##!#YES#!#varbinary#!#85#!#85#!##!##!##!##!##!##!##!##!##!##!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#filename#!#11#!##!#YES#!#nvarchar#!#260#!#520#!##!##!##!##!##!##!##!##!##!#bbf_unicode_cp1_ci_as#!##!##!# logical_database_db1#!#dbo#!#sysdatabases#!#mode#!#4#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#name#!#1#!##!#YES#!#text#!#2147483647#!#2147483647#!##!##!##!##!##!##!##!##!##!#C#!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#reserved#!#8#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#sid#!#3#!##!#YES#!#varbinary#!#85#!#85#!##!##!##!##!##!##!##!##!##!##!##!##!# logical_database_db1#!#dbo#!#sysdatabases#!#status#!#5#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# logical_database_db1#!#dbo#!#sysdatabases#!#status2#!#6#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#crdate#!#7#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#reserved#!#8#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#category#!#9#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#cmptlevel#!#10#!##!#YES#!#tinyint#!##!##!#3#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#filename#!#11#!##!#YES#!#nvarchar#!#260#!#520#!##!##!##!##!##!##!##!##!##!#bbf_unicode_cp1_ci_as#!##!##!# logical_database_db1#!#dbo#!#sysdatabases#!#version#!#12#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# ~~END~~ @@ -145,7 +145,7 @@ alter server role sysadmin add member logical_database_l1 go -- psql user=logical_database_l1 password=12345678 -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases'; +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go ~~START~~ "sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#int4#!#"sys"."varchar"#!#varchar#!#"sys"."varchar"#!#int4#!#int4#!#int2#!#int2#!#int4#!#int2#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar" @@ -156,21 +156,21 @@ go set psql_logical_babelfish_db_name = 'logical_database_db1' go -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases'; +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go ~~START~~ "sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#int4#!#"sys"."varchar"#!#varchar#!#"sys"."varchar"#!#int4#!#int4#!#int2#!#int2#!#int4#!#int2#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar"#!#"sys"."varchar" -logical_database_db1#!#dbo#!#sysdatabases#!#name#!#1#!##!#YES#!#text#!#2147483647#!#2147483647#!##!##!##!##!##!##!##!##!##!#C#!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#category#!#9#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#cmptlevel#!#10#!##!#YES#!#tinyint#!##!##!#3#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#crdate#!#7#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# logical_database_db1#!#dbo#!#sysdatabases#!#dbid#!#2#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#sid#!#3#!##!#YES#!#varbinary#!#85#!#85#!##!##!##!##!##!##!##!##!##!##!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#filename#!#11#!##!#YES#!#nvarchar#!#260#!#520#!##!##!##!##!##!##!##!##!##!#bbf_unicode_cp1_ci_as#!##!##!# logical_database_db1#!#dbo#!#sysdatabases#!#mode#!#4#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#name#!#1#!##!#YES#!#text#!#2147483647#!#2147483647#!##!##!##!##!##!##!##!##!##!#C#!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#reserved#!#8#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# +logical_database_db1#!#dbo#!#sysdatabases#!#sid#!#3#!##!#YES#!#varbinary#!#85#!#85#!##!##!##!##!##!##!##!##!##!##!##!##!# logical_database_db1#!#dbo#!#sysdatabases#!#status#!#5#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# logical_database_db1#!#dbo#!#sysdatabases#!#status2#!#6#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#crdate#!#7#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#reserved#!#8#!##!#YES#!#datetime#!##!##!##!##!##!#3#!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#category#!#9#!##!#YES#!#int#!##!##!#10#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#cmptlevel#!#10#!##!#YES#!#tinyint#!##!##!#3#!#10#!#0#!##!##!##!##!##!##!##!##!##!# -logical_database_db1#!#dbo#!#sysdatabases#!#filename#!#11#!##!#YES#!#nvarchar#!#260#!#520#!##!##!##!##!##!##!##!##!##!#bbf_unicode_cp1_ci_as#!##!##!# logical_database_db1#!#dbo#!#sysdatabases#!#version#!#12#!##!#YES#!#smallint#!##!##!#5#!#10#!#0#!##!##!##!##!##!##!##!##!##!# ~~END~~ diff --git a/test/JDBC/expected/replace-before-14_3-vu-cleanup.out b/test/JDBC/expected/replace-before-14_3-vu-cleanup.out new file mode 100644 index 00000000000..7d4228b5100 --- /dev/null +++ b/test/JDBC/expected/replace-before-14_3-vu-cleanup.out @@ -0,0 +1,62 @@ +DROP FUNCTION babel_4836_replace_itvf_func +GO + +DROP FUNCTION babel_4836_replace_dep_func +GO + +DROP PROCEDURE babel_4836_replace_dep_proc +GO + +DROP VIEW babel_4836_replace_dep_view +GO + +DROP VIEW babel_4836_replace_dep_view1 +GO + +DROP TABLE babel_4836_replace_image_UDT_t +GO + +DROP TABLE babel_4836_replace_var_UDT_t +GO + +DROP TYPE dbo.babel_4836_replace_varUDT +GO + +DROP TYPE dbo.babel_4836_replace_imageUDT +GO + +DROP TABLE babel_4836_replace_text +GO + +DROP TABLE babel_4836_replace_ntext +GO + +DROP TABLE babel_4836_replace_image +GO + +DROP TABLE babel_4836_replace_arabic_cs_as +GO + +DROP TABLE babel_4836_replace_arabic_ci_as +GO + +DROP TABLE babel_4836_replace_chinese_prc_cs_as +GO + +DROP TABLE babel_4836_replace_chinese_prc_ci_as +GO + +DROP TABLE babel_4836_replace_t5 +GO + +DROP TABLE babel_4836_replace_t4 +GO + +DROP TABLE babel_4836_replace_t3 +GO + +DROP TABLE babel_4836_replace_t2 +GO + +DROP TABLE babel_4836_replace_t1 +GO diff --git a/test/JDBC/expected/replace-before-14_3-vu-prepare.out b/test/JDBC/expected/replace-before-14_3-vu-prepare.out new file mode 100644 index 00000000000..60bab033a61 --- /dev/null +++ b/test/JDBC/expected/replace-before-14_3-vu-prepare.out @@ -0,0 +1,132 @@ +CREATE TABLE babel_4836_replace_t1(a NCHAR(50), b NCHAR(20), c NCHAR(20)) +GO +INSERT INTO babel_4836_replace_t1 VALUES(N' abc🙂defghi🙂🙂 ', N'🙂de', N'x🙂y') +INSERT INTO babel_4836_replace_t1 VALUES(N' 比尔·拉莫斯 ', N'拉莫', N'尔·比') +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_t2(a NVARCHAR(50), b NVARCHAR(20), c NVARCHAR(20)) +GO +INSERT INTO babel_4836_replace_t2 VALUES(N' abc🙂defghi🙂🙂 ', N'🙂de', N'x🙂y') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_t3(a VARCHAR(50), b VARCHAR(20), c VARCHAR(20)) +GO +INSERT INTO babel_4836_replace_t3 VALUES(' abc🙂defghi🙂🙂 ', '🙂de', 'x🙂y') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_t4(a BINARY(50), b BINARY(20), c BINARY(20)) +GO +INSERT INTO babel_4836_replace_t4 VALUES(0x6162636465, 0x6263, 0x747576) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_t5(a VARBINARY(50), b VARBINARY(20), c VARBINARY(20)) +GO +INSERT INTO babel_4836_replace_t5 VALUES(0x6162636465, 0x6263, 0x747576) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CI_AS, c VARCHAR(20) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4836_replace_chinese_prc_ci_as VALUES(N' 比尔·拉莫斯 ', N'拉莫', N'尔·比') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CS_AS, c VARCHAR(20) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4836_replace_chinese_prc_cs_as VALUES(N' 比尔·拉莫斯 ', N'拉莫', N'尔·比') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS, b VARCHAR(20) COLLATE ARABIC_CI_AS, c VARCHAR(20) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4836_replace_arabic_ci_as VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS, b VARCHAR(20) COLLATE ARABIC_CS_AS, c VARCHAR(20) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4836_replace_arabic_cs_as VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_image(a IMAGE) +GO +INSERT INTO babel_4836_replace_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_text(a TEXT, b TEXT, c TEXT) +GO +INSERT INTO babel_4836_replace_text VALUES (N' abc🙂defghi🙂🙂 ', N'🙂def', N'jhi🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_ntext(a NTEXT, b NTEXT, c NTEXT) +GO +INSERT INTO babel_4836_replace_ntext VALUES (N' abc🙂defghi🙂🙂 ', N'🙂def', N'jhi🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TYPE dbo.babel_4836_replace_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4836_replace_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4836_replace_image_UDT_t(a dbo.babel_4836_replace_imageUDT, b dbo.babel_4836_replace_imageUDT, c dbo.babel_4836_replace_imageUDT) +GO +INSERT INTO babel_4836_replace_image_UDT_t VALUES(CAST('abcdef' as dbo.babel_4836_replace_imageUDT), CAST('bc' as dbo.babel_4836_replace_imageUDT), CAST('gh' as dbo.babel_4836_replace_imageUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_var_UDT_t(a dbo.babel_4836_replace_imageUDT, b dbo.babel_4836_replace_varUDT, c dbo.babel_4836_replace_varUDT) +GO +INSERT INTO babel_4836_replace_var_UDT_t VALUES(CAST('abcdef' as dbo.babel_4836_replace_imageUDT), CAST('bc' as dbo.babel_4836_replace_varUDT), CAST('gh' as dbo.babel_4836_replace_varUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_4836_replace_dep_view AS + SELECT replace(a, b, c) as result FROM babel_4836_replace_t2 +GO + +CREATE VIEW babel_4836_replace_dep_view1 AS + SELECT replace(a, b, c) as result FROM babel_4836_replace_t3 +GO + +CREATE PROCEDURE babel_4836_replace_dep_proc AS + SELECT replace(a, b, c) as result FROM babel_4836_replace_t2 +GO + +CREATE FUNCTION babel_4836_replace_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 replace(a, b, c) FROM babel_4836_replace_t2) +END +GO + +CREATE FUNCTION babel_4836_replace_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT replace(a, b, c) as result FROM babel_4836_replace_t2) +GO diff --git a/test/JDBC/expected/replace-before-14_3-vu-verify.out b/test/JDBC/expected/replace-before-14_3-vu-verify.out new file mode 100644 index 00000000000..7d553a9e97e --- /dev/null +++ b/test/JDBC/expected/replace-before-14_3-vu-verify.out @@ -0,0 +1,2855 @@ +declare @string1 nvarchar(30) = N'比尔·拉',@string2 nvarchar(30) = N'斯', @pat nvarchar(10) = N'尔' +select REPLACE(@string1, @pat, @string2) +GO +~~START~~ +nvarchar +比斯·拉 +~~END~~ + + +-- NULL +SELECT replace(NULL, 'acs', 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace('scd', NULL, 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace('scd', 'scd', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace(NULL, NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace(NULL, 'aces', 'scdwe') +GO +~~START~~ +varchar + +~~END~~ + + +-- different no. of arguments +SELECT replace('aceds', 'aces', 'scdwe', 'acsdes') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.replace function requires 3 arguments)~~ + + +SELECT replace('aces', 'scdwe') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.replace function requires 3 arguments)~~ + + +-- input type char +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +varchar +??·??? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +??·??? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +??·??·? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +??·??·? +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +varchar +??·?·?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +??·?·?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +??·?·?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_ci_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CI_AS FROM babel_4836_replace_chinese_prc_ci_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_cs_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CS_AS FROM babel_4836_replace_chinese_prc_cs_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_ci_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +SELECT replace(a, b, c) COLLATE ARABIC_CI_AS FROM babel_4836_replace_arabic_ci_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_cs_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +SELECT replace(a, b, c) COLLATE ARABIC_CS_AS FROM babel_4836_replace_arabic_cs_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +nvarchar +??·??? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·??? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??·??·? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·??·? +~~END~~ + + +-- with table column of type nchar +SELECT replace(a, b, c) FROM babel_4836_replace_t1 +GO +~~START~~ +nvarchar + abc🙂defghi🙂🙂 + 比尔·拉莫斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +DECLARE @inputString BINARY(10) = 0x61626364656667, @pattern BINARY(10) = 0x6364, @replacement BINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +-- with table column of type binary +SELECT replace(a, b, c) FROM babel_4836_replace_t4 +GO +~~START~~ +varchar +atuvde +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +DECLARE @inputString VARBINARY(10) = 0x61626364656667, @pattern VARBINARY(10) = 0x6364, @replacement VARBINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +-- with table column of type varbinary +SELECT replace(a, b, c) FROM babel_4836_replace_t5 +GO +~~START~~ +varchar +atuvde +~~END~~ + + + +-- input type text +SELECT replace(a, b, c) FROM babel_4836_replace_text +GO +~~START~~ +varchar + abcjhi?ghi?? +~~END~~ + + +DECLARE @pattern VARCHAR(20) = '?de', @replacement VARCHAR(10) = 'x?y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_text +GO +~~START~~ +varchar + abc?defghi?? +~~END~~ + + +-- input type ntext +SELECT replace(a, b, c) FROM babel_4836_replace_ntext +GO +~~START~~ +varchar + abcjhi?ghi?? +~~END~~ + + +DECLARE @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(10) = N'x🙂y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_ntext +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4836_replace_dep_view +GO +~~START~~ +text +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: nondeterministic collations are not supported for substring searches)~~ + + +SELECT * FROM babel_4836_replace_dep_view1 +GO +~~START~~ +text +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: nondeterministic collations are not supported for substring searches)~~ + + +EXEC babel_4836_replace_dep_proc +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_dep_func() +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_itvf_func() +GO +~~START~~ +text + abcx?yfghi?? +~~END~~ + + +-- different datatypes of inputString and pattern/replacement +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +??·??? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??·??·? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??·??? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?ywfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +??·??? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement)+ '|' +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??·??·? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??·??? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??·??? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'ABCDEF', @pattern BINARY(4) = 0x414243, @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +?·? DEF +~~END~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @pattern NCHAR(20) = N'尔·比', @replacement VARBINARY(2) = 0x4144 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +ABCD +~~END~~ + + +-- input type UDT +-- in table babel_4836_replace_image_UDT_t, col 'a', 'b' and 'c' has basetype image +SELECT replace(a, b, c) FROM babel_4836_replace_image_UDT_t +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +-- in table babel_4836_replace_var_UDT_t, col 'a', 'b' and 'c' has basetype varchar +SELECT replace(b, b, c) FROM babel_4836_replace_var_UDT_t +GO +~~START~~ +varchar +gh +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, '12', '06'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString date = '2016-12-21', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern date = '2016-12-21', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @replacement date = '2016-12-21'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @date date = '2016-12-21', @replacement VARCHAR(10) = '06'; +DECLARE @pattern datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @date date = '2016-12-21'; +DECLARE @replacement datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern smalldatetime = '2016-12-21 12:43:10', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern VARCHAR(30) = '2016-12-21 12:43:10', @replacement smalldatetime = '2016-12-21 12:43:10'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern time(4) = '12:10:05.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern VARCHAR(30) = '12:10:05.1237', @replacement time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @replacement datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern datetime2(4) = '1968-10-23 12:45:37.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1237', @replacement datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString decimal = 123456, @pattern decimal = 12, @replacement decimal = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern decimal = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement decimal = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString numeric = 12345.12, @pattern numeric = 12, @replacement numeric = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern numeric = 12.12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement numeric = 12.12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString float = 12345.1, @pattern float = 12, @replacement float = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern float = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement float = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString real = 12345.1, @pattern real = 12, @replacement real = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern real = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement real = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString bigint = 12345678, @pattern bigint = 12, @replacement bigint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bigint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bigint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString int = 12345678, @pattern int = 12, @replacement int = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern int = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement int = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smallint = 12356, @pattern smallint = 12, @replacement smallint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString tinyint = 235, @pattern tinyint = 12, @replacement tinyint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern tinyint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement tinyint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString money = 12356, @pattern money = 12, @replacement money = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern money = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement money = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smallmoney = 12356, @pattern smallmoney = 12, @replacement smallmoney = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallmoney = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallmoney = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString bit = 1, @pattern bit = 1, @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bit = 1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of replace function.)~~ + + +SELECT replace(a, a, a) FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +SELECT replace('a', a, 'a') FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of replace function.)~~ + + +SELECT replace('a', 'a', a) FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of replace function.)~~ + + +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(a, @pattern, @replacement) from babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern xml = CAST ('' AS xml), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geometry = geometry::STGeomFromText('POINT (1 2)', 0), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geography = geography::STGeomFromText('POINT (1 2)', 4326), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geography = geography::STGeomFromText('POINT (1 2)', 4326); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO +~~START~~ +varchar +5A9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(CAST (@inputString AS VARCHAR(50)), CAST (@pattern AS VARCHAR(50)), CAST (@replacement AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO +~~START~~ +varchar +POINT(4 5) +~~END~~ + diff --git a/test/JDBC/expected/replace-before-15_8-or-16_4-vu-cleanup.out b/test/JDBC/expected/replace-before-15_8-or-16_4-vu-cleanup.out new file mode 100644 index 00000000000..7d4228b5100 --- /dev/null +++ b/test/JDBC/expected/replace-before-15_8-or-16_4-vu-cleanup.out @@ -0,0 +1,62 @@ +DROP FUNCTION babel_4836_replace_itvf_func +GO + +DROP FUNCTION babel_4836_replace_dep_func +GO + +DROP PROCEDURE babel_4836_replace_dep_proc +GO + +DROP VIEW babel_4836_replace_dep_view +GO + +DROP VIEW babel_4836_replace_dep_view1 +GO + +DROP TABLE babel_4836_replace_image_UDT_t +GO + +DROP TABLE babel_4836_replace_var_UDT_t +GO + +DROP TYPE dbo.babel_4836_replace_varUDT +GO + +DROP TYPE dbo.babel_4836_replace_imageUDT +GO + +DROP TABLE babel_4836_replace_text +GO + +DROP TABLE babel_4836_replace_ntext +GO + +DROP TABLE babel_4836_replace_image +GO + +DROP TABLE babel_4836_replace_arabic_cs_as +GO + +DROP TABLE babel_4836_replace_arabic_ci_as +GO + +DROP TABLE babel_4836_replace_chinese_prc_cs_as +GO + +DROP TABLE babel_4836_replace_chinese_prc_ci_as +GO + +DROP TABLE babel_4836_replace_t5 +GO + +DROP TABLE babel_4836_replace_t4 +GO + +DROP TABLE babel_4836_replace_t3 +GO + +DROP TABLE babel_4836_replace_t2 +GO + +DROP TABLE babel_4836_replace_t1 +GO diff --git a/test/JDBC/expected/replace-before-15_8-or-16_4-vu-prepare.out b/test/JDBC/expected/replace-before-15_8-or-16_4-vu-prepare.out new file mode 100644 index 00000000000..60bab033a61 --- /dev/null +++ b/test/JDBC/expected/replace-before-15_8-or-16_4-vu-prepare.out @@ -0,0 +1,132 @@ +CREATE TABLE babel_4836_replace_t1(a NCHAR(50), b NCHAR(20), c NCHAR(20)) +GO +INSERT INTO babel_4836_replace_t1 VALUES(N' abc🙂defghi🙂🙂 ', N'🙂de', N'x🙂y') +INSERT INTO babel_4836_replace_t1 VALUES(N' 比尔·拉莫斯 ', N'拉莫', N'尔·比') +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_t2(a NVARCHAR(50), b NVARCHAR(20), c NVARCHAR(20)) +GO +INSERT INTO babel_4836_replace_t2 VALUES(N' abc🙂defghi🙂🙂 ', N'🙂de', N'x🙂y') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_t3(a VARCHAR(50), b VARCHAR(20), c VARCHAR(20)) +GO +INSERT INTO babel_4836_replace_t3 VALUES(' abc🙂defghi🙂🙂 ', '🙂de', 'x🙂y') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_t4(a BINARY(50), b BINARY(20), c BINARY(20)) +GO +INSERT INTO babel_4836_replace_t4 VALUES(0x6162636465, 0x6263, 0x747576) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_t5(a VARBINARY(50), b VARBINARY(20), c VARBINARY(20)) +GO +INSERT INTO babel_4836_replace_t5 VALUES(0x6162636465, 0x6263, 0x747576) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CI_AS, c VARCHAR(20) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4836_replace_chinese_prc_ci_as VALUES(N' 比尔·拉莫斯 ', N'拉莫', N'尔·比') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CS_AS, c VARCHAR(20) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4836_replace_chinese_prc_cs_as VALUES(N' 比尔·拉莫斯 ', N'拉莫', N'尔·比') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS, b VARCHAR(20) COLLATE ARABIC_CI_AS, c VARCHAR(20) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4836_replace_arabic_ci_as VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS, b VARCHAR(20) COLLATE ARABIC_CS_AS, c VARCHAR(20) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4836_replace_arabic_cs_as VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_image(a IMAGE) +GO +INSERT INTO babel_4836_replace_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_text(a TEXT, b TEXT, c TEXT) +GO +INSERT INTO babel_4836_replace_text VALUES (N' abc🙂defghi🙂🙂 ', N'🙂def', N'jhi🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_ntext(a NTEXT, b NTEXT, c NTEXT) +GO +INSERT INTO babel_4836_replace_ntext VALUES (N' abc🙂defghi🙂🙂 ', N'🙂def', N'jhi🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TYPE dbo.babel_4836_replace_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4836_replace_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4836_replace_image_UDT_t(a dbo.babel_4836_replace_imageUDT, b dbo.babel_4836_replace_imageUDT, c dbo.babel_4836_replace_imageUDT) +GO +INSERT INTO babel_4836_replace_image_UDT_t VALUES(CAST('abcdef' as dbo.babel_4836_replace_imageUDT), CAST('bc' as dbo.babel_4836_replace_imageUDT), CAST('gh' as dbo.babel_4836_replace_imageUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_var_UDT_t(a dbo.babel_4836_replace_imageUDT, b dbo.babel_4836_replace_varUDT, c dbo.babel_4836_replace_varUDT) +GO +INSERT INTO babel_4836_replace_var_UDT_t VALUES(CAST('abcdef' as dbo.babel_4836_replace_imageUDT), CAST('bc' as dbo.babel_4836_replace_varUDT), CAST('gh' as dbo.babel_4836_replace_varUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_4836_replace_dep_view AS + SELECT replace(a, b, c) as result FROM babel_4836_replace_t2 +GO + +CREATE VIEW babel_4836_replace_dep_view1 AS + SELECT replace(a, b, c) as result FROM babel_4836_replace_t3 +GO + +CREATE PROCEDURE babel_4836_replace_dep_proc AS + SELECT replace(a, b, c) as result FROM babel_4836_replace_t2 +GO + +CREATE FUNCTION babel_4836_replace_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 replace(a, b, c) FROM babel_4836_replace_t2) +END +GO + +CREATE FUNCTION babel_4836_replace_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT replace(a, b, c) as result FROM babel_4836_replace_t2) +GO diff --git a/test/JDBC/expected/replace-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/replace-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..da262f10016 --- /dev/null +++ b/test/JDBC/expected/replace-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,2853 @@ +declare @string1 nvarchar(30) = N'比尔·拉',@string2 nvarchar(30) = N'斯', @pat nvarchar(10) = N'尔' +select REPLACE(@string1, @pat, @string2) +GO +~~START~~ +nvarchar +比斯·拉 +~~END~~ + + +-- NULL +SELECT replace(NULL, 'acs', 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace('scd', NULL, 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace('scd', 'scd', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace(NULL, NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace(NULL, 'aces', 'scdwe') +GO +~~START~~ +varchar + +~~END~~ + + +-- different no. of arguments +SELECT replace('aceds', 'aces', 'scdwe', 'acsdes') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.replace function requires 3 arguments)~~ + + +SELECT replace('aces', 'scdwe') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.replace function requires 3 arguments)~~ + + +-- input type char +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +varchar +??·??? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +??·??? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +??·??·? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +??·??·? +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +varchar +??·?·?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +??·?·?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +??·?·?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_ci_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CI_AS FROM babel_4836_replace_chinese_prc_ci_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_cs_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CS_AS FROM babel_4836_replace_chinese_prc_cs_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_ci_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +SELECT replace(a, b, c) COLLATE ARABIC_CI_AS FROM babel_4836_replace_arabic_ci_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_cs_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +SELECT replace(a, b, c) COLLATE ARABIC_CS_AS FROM babel_4836_replace_arabic_cs_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +nvarchar +??·??? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·??? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??·??·? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·??·? +~~END~~ + + +-- with table column of type nchar +SELECT replace(a, b, c) FROM babel_4836_replace_t1 +GO +~~START~~ +nvarchar + abc🙂defghi🙂🙂 + 比尔·拉莫斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +DECLARE @inputString BINARY(10) = 0x61626364656667, @pattern BINARY(10) = 0x6364, @replacement BINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +-- with table column of type binary +SELECT replace(a, b, c) FROM babel_4836_replace_t4 +GO +~~START~~ +varchar +atuvde +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +DECLARE @inputString VARBINARY(10) = 0x61626364656667, @pattern VARBINARY(10) = 0x6364, @replacement VARBINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +-- with table column of type varbinary +SELECT replace(a, b, c) FROM babel_4836_replace_t5 +GO +~~START~~ +varchar +atuvde +~~END~~ + + + +-- input type text +SELECT replace(a, b, c) FROM babel_4836_replace_text +GO +~~START~~ +varchar + abcjhi?ghi?? +~~END~~ + + +DECLARE @pattern VARCHAR(20) = '?de', @replacement VARCHAR(10) = 'x?y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_text +GO +~~START~~ +varchar + abc?defghi?? +~~END~~ + + +-- input type ntext +SELECT replace(a, b, c) FROM babel_4836_replace_ntext +GO +~~START~~ +varchar + abcjhi?ghi?? +~~END~~ + + +DECLARE @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(10) = N'x🙂y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_ntext +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4836_replace_dep_view +GO +~~START~~ +text + abcx?yfghi?? +~~END~~ + + +SELECT * FROM babel_4836_replace_dep_view1 +GO +~~START~~ +text + abcx?yfghi?? +~~END~~ + + +EXEC babel_4836_replace_dep_proc +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_dep_func() +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_itvf_func() +GO +~~START~~ +text + abcx?yfghi?? +~~END~~ + + +-- different datatypes of inputString and pattern/replacement +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +??·??? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??·??·? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??·??? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?ywfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +??·??? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement)+ '|' +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??·??·? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??·??? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??·??? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'ABCDEF', @pattern BINARY(4) = 0x414243, @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +?·? DEF +~~END~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @pattern NCHAR(20) = N'尔·比', @replacement VARBINARY(2) = 0x4144 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +ABCD +~~END~~ + + +-- input type UDT +-- in table babel_4836_replace_image_UDT_t, col 'a', 'b' and 'c' has basetype image +SELECT replace(a, b, c) FROM babel_4836_replace_image_UDT_t +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +-- in table babel_4836_replace_var_UDT_t, col 'a', 'b' and 'c' has basetype varchar +SELECT replace(b, b, c) FROM babel_4836_replace_var_UDT_t +GO +~~START~~ +varchar +gh +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, '12', '06'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString date = '2016-12-21', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern date = '2016-12-21', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @replacement date = '2016-12-21'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @date date = '2016-12-21', @replacement VARCHAR(10) = '06'; +DECLARE @pattern datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @date date = '2016-12-21'; +DECLARE @replacement datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern smalldatetime = '2016-12-21 12:43:10', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern VARCHAR(30) = '2016-12-21 12:43:10', @replacement smalldatetime = '2016-12-21 12:43:10'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern time(4) = '12:10:05.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern VARCHAR(30) = '12:10:05.1237', @replacement time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @replacement datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern datetime2(4) = '1968-10-23 12:45:37.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1237', @replacement datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString decimal = 123456, @pattern decimal = 12, @replacement decimal = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern decimal = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement decimal = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString numeric = 12345.12, @pattern numeric = 12, @replacement numeric = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern numeric = 12.12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement numeric = 12.12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString float = 12345.1, @pattern float = 12, @replacement float = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern float = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement float = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString real = 12345.1, @pattern real = 12, @replacement real = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern real = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement real = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString bigint = 12345678, @pattern bigint = 12, @replacement bigint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bigint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bigint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString int = 12345678, @pattern int = 12, @replacement int = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern int = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement int = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smallint = 12356, @pattern smallint = 12, @replacement smallint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString tinyint = 235, @pattern tinyint = 12, @replacement tinyint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern tinyint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement tinyint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString money = 12356, @pattern money = 12, @replacement money = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern money = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement money = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smallmoney = 12356, @pattern smallmoney = 12, @replacement smallmoney = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallmoney = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallmoney = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString bit = 1, @pattern bit = 1, @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bit = 1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of replace function.)~~ + + +SELECT replace(a, a, a) FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +SELECT replace('a', a, 'a') FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of replace function.)~~ + + +SELECT replace('a', 'a', a) FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of replace function.)~~ + + +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(a, @pattern, @replacement) from babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern xml = CAST ('' AS xml), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geometry = geometry::STGeomFromText('POINT (1 2)', 0), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geography = geography::STGeomFromText('POINT (1 2)', 4326), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geography = geography::STGeomFromText('POINT (1 2)', 4326); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO +~~START~~ +varchar +5A9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(CAST (@inputString AS VARCHAR(50)), CAST (@pattern AS VARCHAR(50)), CAST (@replacement AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO +~~START~~ +varchar +POINT(4 5) +~~END~~ + diff --git a/test/JDBC/expected/replace-vu-cleanup.out b/test/JDBC/expected/replace-vu-cleanup.out new file mode 100644 index 00000000000..7d4228b5100 --- /dev/null +++ b/test/JDBC/expected/replace-vu-cleanup.out @@ -0,0 +1,62 @@ +DROP FUNCTION babel_4836_replace_itvf_func +GO + +DROP FUNCTION babel_4836_replace_dep_func +GO + +DROP PROCEDURE babel_4836_replace_dep_proc +GO + +DROP VIEW babel_4836_replace_dep_view +GO + +DROP VIEW babel_4836_replace_dep_view1 +GO + +DROP TABLE babel_4836_replace_image_UDT_t +GO + +DROP TABLE babel_4836_replace_var_UDT_t +GO + +DROP TYPE dbo.babel_4836_replace_varUDT +GO + +DROP TYPE dbo.babel_4836_replace_imageUDT +GO + +DROP TABLE babel_4836_replace_text +GO + +DROP TABLE babel_4836_replace_ntext +GO + +DROP TABLE babel_4836_replace_image +GO + +DROP TABLE babel_4836_replace_arabic_cs_as +GO + +DROP TABLE babel_4836_replace_arabic_ci_as +GO + +DROP TABLE babel_4836_replace_chinese_prc_cs_as +GO + +DROP TABLE babel_4836_replace_chinese_prc_ci_as +GO + +DROP TABLE babel_4836_replace_t5 +GO + +DROP TABLE babel_4836_replace_t4 +GO + +DROP TABLE babel_4836_replace_t3 +GO + +DROP TABLE babel_4836_replace_t2 +GO + +DROP TABLE babel_4836_replace_t1 +GO diff --git a/test/JDBC/expected/replace-vu-prepare.out b/test/JDBC/expected/replace-vu-prepare.out new file mode 100644 index 00000000000..60bab033a61 --- /dev/null +++ b/test/JDBC/expected/replace-vu-prepare.out @@ -0,0 +1,132 @@ +CREATE TABLE babel_4836_replace_t1(a NCHAR(50), b NCHAR(20), c NCHAR(20)) +GO +INSERT INTO babel_4836_replace_t1 VALUES(N' abc🙂defghi🙂🙂 ', N'🙂de', N'x🙂y') +INSERT INTO babel_4836_replace_t1 VALUES(N' 比尔·拉莫斯 ', N'拉莫', N'尔·比') +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_t2(a NVARCHAR(50), b NVARCHAR(20), c NVARCHAR(20)) +GO +INSERT INTO babel_4836_replace_t2 VALUES(N' abc🙂defghi🙂🙂 ', N'🙂de', N'x🙂y') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_t3(a VARCHAR(50), b VARCHAR(20), c VARCHAR(20)) +GO +INSERT INTO babel_4836_replace_t3 VALUES(' abc🙂defghi🙂🙂 ', '🙂de', 'x🙂y') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_t4(a BINARY(50), b BINARY(20), c BINARY(20)) +GO +INSERT INTO babel_4836_replace_t4 VALUES(0x6162636465, 0x6263, 0x747576) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_t5(a VARBINARY(50), b VARBINARY(20), c VARBINARY(20)) +GO +INSERT INTO babel_4836_replace_t5 VALUES(0x6162636465, 0x6263, 0x747576) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CI_AS, c VARCHAR(20) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4836_replace_chinese_prc_ci_as VALUES(N' 比尔·拉莫斯 ', N'拉莫', N'尔·比') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CS_AS, c VARCHAR(20) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4836_replace_chinese_prc_cs_as VALUES(N' 比尔·拉莫斯 ', N'拉莫', N'尔·比') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS, b VARCHAR(20) COLLATE ARABIC_CI_AS, c VARCHAR(20) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4836_replace_arabic_ci_as VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS, b VARCHAR(20) COLLATE ARABIC_CS_AS, c VARCHAR(20) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4836_replace_arabic_cs_as VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_image(a IMAGE) +GO +INSERT INTO babel_4836_replace_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_text(a TEXT, b TEXT, c TEXT) +GO +INSERT INTO babel_4836_replace_text VALUES (N' abc🙂defghi🙂🙂 ', N'🙂def', N'jhi🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_ntext(a NTEXT, b NTEXT, c NTEXT) +GO +INSERT INTO babel_4836_replace_ntext VALUES (N' abc🙂defghi🙂🙂 ', N'🙂def', N'jhi🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TYPE dbo.babel_4836_replace_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4836_replace_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4836_replace_image_UDT_t(a dbo.babel_4836_replace_imageUDT, b dbo.babel_4836_replace_imageUDT, c dbo.babel_4836_replace_imageUDT) +GO +INSERT INTO babel_4836_replace_image_UDT_t VALUES(CAST('abcdef' as dbo.babel_4836_replace_imageUDT), CAST('bc' as dbo.babel_4836_replace_imageUDT), CAST('gh' as dbo.babel_4836_replace_imageUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4836_replace_var_UDT_t(a dbo.babel_4836_replace_imageUDT, b dbo.babel_4836_replace_varUDT, c dbo.babel_4836_replace_varUDT) +GO +INSERT INTO babel_4836_replace_var_UDT_t VALUES(CAST('abcdef' as dbo.babel_4836_replace_imageUDT), CAST('bc' as dbo.babel_4836_replace_varUDT), CAST('gh' as dbo.babel_4836_replace_varUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_4836_replace_dep_view AS + SELECT replace(a, b, c) as result FROM babel_4836_replace_t2 +GO + +CREATE VIEW babel_4836_replace_dep_view1 AS + SELECT replace(a, b, c) as result FROM babel_4836_replace_t3 +GO + +CREATE PROCEDURE babel_4836_replace_dep_proc AS + SELECT replace(a, b, c) as result FROM babel_4836_replace_t2 +GO + +CREATE FUNCTION babel_4836_replace_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 replace(a, b, c) FROM babel_4836_replace_t2) +END +GO + +CREATE FUNCTION babel_4836_replace_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT replace(a, b, c) as result FROM babel_4836_replace_t2) +GO diff --git a/test/JDBC/expected/replace-vu-verify.out b/test/JDBC/expected/replace-vu-verify.out new file mode 100644 index 00000000000..42c396893ac --- /dev/null +++ b/test/JDBC/expected/replace-vu-verify.out @@ -0,0 +1,2853 @@ +declare @string1 nvarchar(30) = N'比尔·拉',@string2 nvarchar(30) = N'斯', @pat nvarchar(10) = N'尔' +select REPLACE(@string1, @pat, @string2) +GO +~~START~~ +nvarchar +比斯·拉 +~~END~~ + + +-- NULL +SELECT replace(NULL, 'acs', 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace('scd', NULL, 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace('scd', 'scd', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace(NULL, NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replace(NULL, 'aces', 'scdwe') +GO +~~START~~ +varchar + +~~END~~ + + +-- different no. of arguments +SELECT replace('aceds', 'aces', 'scdwe', 'acsdes') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.replace function requires 3 arguments)~~ + + +SELECT replace('aces', 'scdwe') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.replace function requires 3 arguments)~~ + + +-- input type char +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +varchar +??·??? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +??·??? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +??·??·? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +??·??·? +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +varchar +??·?·?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +??·?·?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +??·?·?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_ci_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CI_AS FROM babel_4836_replace_chinese_prc_ci_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_cs_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CS_AS FROM babel_4836_replace_chinese_prc_cs_as +GO +~~START~~ +varchar + 比尔·尔·比斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_ci_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +SELECT replace(a, b, c) COLLATE ARABIC_CI_AS FROM babel_4836_replace_arabic_ci_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_cs_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +SELECT replace(a, b, c) COLLATE ARABIC_CS_AS FROM babel_4836_replace_arabic_cs_as +GO +~~START~~ +varchar + الله مع المتقمع +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +nvarchar +??·??? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·??? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??·??·? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·??·? +~~END~~ + + +-- with table column of type nchar +SELECT replace(a, b, c) FROM babel_4836_replace_t1 +GO +~~START~~ +nvarchar + abc🙂defghi🙂🙂 + 比尔·拉莫斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +DECLARE @inputString BINARY(10) = 0x61626364656667, @pattern BINARY(10) = 0x6364, @replacement BINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +-- with table column of type binary +SELECT replace(a, b, c) FROM babel_4836_replace_t4 +GO +~~START~~ +varchar +atuvde +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +DECLARE @inputString VARBINARY(10) = 0x61626364656667, @pattern VARBINARY(10) = 0x6364, @replacement VARBINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abstuefg +~~END~~ + + +-- with table column of type varbinary +SELECT replace(a, b, c) FROM babel_4836_replace_t5 +GO +~~START~~ +varchar +atuvde +~~END~~ + + + +-- input type text +SELECT replace(a, b, c) FROM babel_4836_replace_text +GO +~~START~~ +varchar + abcjhi?ghi?? +~~END~~ + + +DECLARE @pattern VARCHAR(20) = '?de', @replacement VARCHAR(10) = 'x?y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_text +GO +~~START~~ +varchar + abc?defghi?? +~~END~~ + + +-- input type ntext +SELECT replace(a, b, c) FROM babel_4836_replace_ntext +GO +~~START~~ +varchar + abcjhi?ghi?? +~~END~~ + + +DECLARE @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(10) = N'x🙂y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_ntext +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4836_replace_dep_view +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_dep_view1 +GO +~~START~~ +varchar + abcx?yfghi?? +~~END~~ + + +EXEC babel_4836_replace_dep_proc +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_dep_func() +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4836_replace_itvf_func() +GO +~~START~~ +nvarchar + abcx🙂yfghi🙂🙂 +~~END~~ + + +-- different datatypes of inputString and pattern/replacement +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +??·??? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??·??·? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??·??? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?ywfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abcx?yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +??·??? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement)+ '|' +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??·??·? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??·??? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +??·??? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂ywfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx?yw fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abcx?y fghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abcx🙂yfghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc?defghi?? +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abcx🙂yfghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·尔·比斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +比尔·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N'ABCDEF', @pattern BINARY(4) = 0x414243, @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +?·? DEF +~~END~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @pattern NCHAR(20) = N'尔·比', @replacement VARBINARY(2) = 0x4144 +SELECT replace(@inputString, @pattern, @replacement) +GO +~~START~~ +nvarchar +ABCD +~~END~~ + + +-- input type UDT +-- in table babel_4836_replace_image_UDT_t, col 'a', 'b' and 'c' has basetype image +SELECT replace(a, b, c) FROM babel_4836_replace_image_UDT_t +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +-- in table babel_4836_replace_var_UDT_t, col 'a', 'b' and 'c' has basetype varchar +SELECT replace(b, b, c) FROM babel_4836_replace_var_UDT_t +GO +~~START~~ +varchar +gh +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, '12', '06'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString date = '2016-12-21', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern date = '2016-12-21', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @replacement date = '2016-12-21'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of replace function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @date date = '2016-12-21', @replacement VARCHAR(10) = '06'; +DECLARE @pattern datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @date date = '2016-12-21'; +DECLARE @replacement datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern smalldatetime = '2016-12-21 12:43:10', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern VARCHAR(30) = '2016-12-21 12:43:10', @replacement smalldatetime = '2016-12-21 12:43:10'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern time(4) = '12:10:05.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern VARCHAR(30) = '12:10:05.1237', @replacement time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @replacement datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern datetime2(4) = '1968-10-23 12:45:37.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1237', @replacement datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString decimal = 123456, @pattern decimal = 12, @replacement decimal = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern decimal = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement decimal = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString numeric = 12345.12, @pattern numeric = 12, @replacement numeric = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern numeric = 12.12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement numeric = 12.12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString float = 12345.1, @pattern float = 12, @replacement float = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern float = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement float = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString real = 12345.1, @pattern real = 12, @replacement real = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern real = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement real = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString bigint = 12345678, @pattern bigint = 12, @replacement bigint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bigint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bigint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString int = 12345678, @pattern int = 12, @replacement int = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern int = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement int = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smallint = 12356, @pattern smallint = 12, @replacement smallint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString tinyint = 235, @pattern tinyint = 12, @replacement tinyint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern tinyint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement tinyint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString money = 12356, @pattern money = 12, @replacement money = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern money = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement money = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString smallmoney = 12356, @pattern smallmoney = 12, @replacement smallmoney = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallmoney = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallmoney = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString bit = 1, @pattern bit = 1, @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bit = 1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of replace function.)~~ + + +SELECT replace(a, a, a) FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +SELECT replace('a', a, 'a') FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of replace function.)~~ + + +SELECT replace('a', 'a', a) FROM babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of replace function.)~~ + + +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(a, @pattern, @replacement) from babel_4836_replace_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern xml = CAST ('' AS xml), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geometry = geometry::STGeomFromText('POINT (1 2)', 0), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geography = geography::STGeomFromText('POINT (1 2)', 4326), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of replace function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geography = geography::STGeomFromText('POINT (1 2)', 4326); +SELECT replace(@inputString, @pattern, @replacement) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of replace function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT replace(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replace function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO +~~START~~ +varchar +5A9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(CAST (@inputString AS VARCHAR(50)), CAST (@pattern AS VARCHAR(50)), CAST (@replacement AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO +~~START~~ +varchar +POINT(4 5) +~~END~~ + diff --git a/test/JDBC/expected/replicate-before-15_8-or-16_4-vu-cleanup.out b/test/JDBC/expected/replicate-before-15_8-or-16_4-vu-cleanup.out new file mode 100644 index 00000000000..2e94ceb7b40 --- /dev/null +++ b/test/JDBC/expected/replicate-before-15_8-or-16_4-vu-cleanup.out @@ -0,0 +1,80 @@ +DROP FUNCTION babel_862_replicate_itvf_func +GO + +DROP FUNCTION babel_862_replicate_dep_func +GO + +DROP PROCEDURE babel_862_replicate_dep_proc +GO + +DROP VIEW babel_862_replicate_dep_view +GO + +DROP TABLE babel_862_replicate_UDT +GO + +DROP VIEW babel_862_replicate_dep_view_1 +GO + +DROP VIEW babel_862_replicate_dep_view_2 +GO + +DROP VIEW babel_862_replicate_dep_view_3 +GO + +DROP VIEW babel_862_replicate_dep_view_4 +GO + +DROP VIEW babel_862_replicate_dep_view_5 +GO + +DROP VIEW babel_862_replicate_dep_view_6 +GO + +DROP VIEW babel_862_replicate_dep_view_7 +GO + +DROP TYPE dbo.babel_862_replicate_varUDT +GO + +DROP TYPE dbo.babel_862_replicate_imageUDT +GO + +DROP TABLE babel_862_replicate_text +GO + +DROP TABLE babel_862_replicate_image +GO + +DROP TABLE babel_862_replicate_arabic_ci_ai +GO + +DROP TABLE babel_862_replicate_arabic_cs_as +GO + +DROP TABLE babel_862_replicate_arabic_ci_as +GO + +DROP TABLE babel_862_replicate_chinese_prc_ci_ai +GO + +DROP TABLE babel_862_replicate_chinese_prc_cs_as +GO + +DROP TABLE babel_862_replicate_chinese_prc_ci_as +GO + +DROP TABLE babel_862_replicate_t5 +GO + +DROP TABLE babel_862_replicate_t4 +GO + +DROP TABLE babel_862_replicate_t3 +GO + +DROP TABLE babel_862_replicate_t2 +GO + +DROP TABLE babel_862_replicate_t1 +GO diff --git a/test/JDBC/expected/replicate-before-15_8-or-16_4-vu-prepare.out b/test/JDBC/expected/replicate-before-15_8-or-16_4-vu-prepare.out new file mode 100644 index 00000000000..882a7d3f488 --- /dev/null +++ b/test/JDBC/expected/replicate-before-15_8-or-16_4-vu-prepare.out @@ -0,0 +1,156 @@ +CREATE TABLE babel_862_replicate_t1(a NCHAR(50)) +GO +INSERT INTO babel_862_replicate_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_862_replicate_t1 VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_862_replicate_t2 VALUES(N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_t3(a CHAR(50)) +GO +INSERT INTO babel_862_replicate_t3 VALUES('abcdefghi') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_t4(a VARCHAR(50)) +GO +INSERT INTO babel_862_replicate_t4 VALUES('abcdefghi') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_t5(a VARBINARY(50)) +GO +INSERT INTO babel_862_replicate_t5 VALUES(0x2020616263642020) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_862_replicate_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_862_replicate_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_862_replicate_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_862_replicate_arabic_ci_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_862_replicate_arabic_cs_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_862_replicate_arabic_ci_ai VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_image(a IMAGE) +GO +INSERT INTO babel_862_replicate_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_862_replicate_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TYPE dbo.babel_862_replicate_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_862_replicate_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_862_replicate_UDT(a dbo.babel_862_replicate_imageUDT, b dbo.babel_862_replicate_varUDT) +GO +INSERT INTO babel_862_replicate_UDT VALUES(CAST('abcdef' as dbo.babel_862_replicate_imageUDT), CAST('abcdef' as dbo.babel_862_replicate_varUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_862_replicate_dep_view AS + SELECT replicate(a, 4) as result from babel_862_replicate_t2 +GO + +CREATE PROCEDURE babel_862_replicate_dep_proc AS + SELECT replicate(a, 4) as result from babel_862_replicate_t2 +GO + +CREATE FUNCTION babel_862_replicate_dep_func() +RETURNS NVARCHAR(200) +AS +BEGIN +RETURN (SELECT TOP 1 replicate(a, 4) from babel_862_replicate_t2) +END +GO + +CREATE VIEW babel_862_replicate_dep_view_1 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_t1 +GO + +CREATE VIEW babel_862_replicate_dep_view_2 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_t2 +GO + +CREATE VIEW babel_862_replicate_dep_view_3 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_t3 +GO + +CREATE VIEW babel_862_replicate_dep_view_4 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_t4 +GO + +CREATE VIEW babel_862_replicate_dep_view_5 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_t5 +GO + +CREATE VIEW babel_862_replicate_dep_view_6 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_text +GO + +CREATE VIEW babel_862_replicate_dep_view_7 AS + SELECT replicate(b, 4) as result FROM babel_862_replicate_text +GO + +CREATE FUNCTION babel_862_replicate_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT replicate(a, 4) as result from babel_862_replicate_t2) +GO diff --git a/test/JDBC/expected/replicate-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/replicate-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..f8b80736135 --- /dev/null +++ b/test/JDBC/expected/replicate-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,658 @@ +-- NULL +SELECT replicate(NULL, -2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate(NULL, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate(NULL, 2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate('abc', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate(NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- edge case values for second parameter +SELECT replicate('AbdefGhi', -2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT '|' + replicate('AbdefGhi', 0) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT replicate('AbdefGhi', 2) +GO +~~START~~ +varchar +AbdefGhiAbdefGhi +~~END~~ + + +SELECT replicate('AbdefGhi', 1001) +GO +~~START~~ +varchar +AbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhi +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abc?defghi?? abc?defghi?? abc?defghi?? abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +??·??? ??·??? ??·??? ??·??? +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +??·??? ??·??? ??·??? ??·??? +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +??·?????·?????·?????·??? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_862_replicate_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_862_replicate_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_862_replicate_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_ci_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +SELECT replicate(a, 4) COLLATE ARABIC_CI_AS FROM babel_862_replicate_arabic_ci_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_cs_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +SELECT replicate(a, 4) COLLATE ARABIC_CS_AS FROM babel_862_replicate_arabic_cs_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_ci_ai +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +SELECT replicate(a, 4) COLLATE ARABIC_CI_AI FROM babel_862_replicate_arabic_ci_ai +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +abc?defghi?? abc?defghi?? abc?defghi?? abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +??·??? ??·??? ??·??? ??·??? +~~END~~ + + +-- with table column of type nchar +SELECT replicate(a, 4) FROM babel_862_replicate_t1 +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 +比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abcdefghabcdefghabcdefghabcdefgh +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abcdefghabcdefghabcdefghabcdefgh +~~END~~ + + +-- dependent objects +SELECT * FROM babel_862_replicate_dep_view +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +EXEC babel_862_replicate_dep_proc +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_func() +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_862_replicate_itvf_func() +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_1 +GO +~~START~~ +varchar +abc?defghi?? abc?defghi?? abc?defghi?? abc?defghi?? +??·??? ??·??? ??·??? ??·??? +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_2 +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_3 +GO +~~START~~ +varchar +abcdefghi abcdefghi abcdefghi abcdefghi +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_4 +GO +~~START~~ +varchar +abcdefghiabcdefghiabcdefghiabcdefghi +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_5 +GO +~~START~~ +varchar +0x20206162636420200x20206162636420200x20206162636420200x2020616263642020 +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_6 +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_7 +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +-- input type UDT +-- -- in table babel_862_replicate_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT replicate(a, 4) FROM babel_862_replicate_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replicate function.)~~ + + +SELECT replicate(b, 4) FROM babel_862_replicate_UDT +GO +~~START~~ +varchar +abcdefabcdefabcdefabcdef +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +2016-12-212016-12-212016-12-212016-12-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +2016-12-21 00:00:002016-12-21 00:00:002016-12-21 00:00:002016-12-21 00:00:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1955-12-13 12:43:001955-12-13 12:43:001955-12-13 12:43:001955-12-13 12:43:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12:10:05.123712:10:05.123712:10:05.123712:10:05.1237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:001968-10-23 12:45:37.1234 +10:001968-10-23 12:45:37.1234 +10:001968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1968-10-23 12:45:37.12371968-10-23 12:45:37.12371968-10-23 12:45:37.12371968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +123456123456123456123456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345123451234512345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345.112345.112345.112345.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345.112345.112345.112345.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345678123456781234567812345678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345678123456781234567812345678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12356123561235612356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +235235235235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12356.000012356.000012356.000012356.0000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12356.000012356.000012356.000012356.0000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1111 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +SELECT replicate(a, 4) from babel_862_replicate_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replicate function.)~~ + + +-- input datatype text +SELECT replicate(a, 4) FROM babel_862_replicate_text +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT replicate(b, 4) FROM babel_862_replicate_text +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO +~~START~~ +varchar +POINT(1 2)POINT(1 2)POINT(1 2)POINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/replicate-vu-cleanup.out b/test/JDBC/expected/replicate-vu-cleanup.out new file mode 100644 index 00000000000..2e94ceb7b40 --- /dev/null +++ b/test/JDBC/expected/replicate-vu-cleanup.out @@ -0,0 +1,80 @@ +DROP FUNCTION babel_862_replicate_itvf_func +GO + +DROP FUNCTION babel_862_replicate_dep_func +GO + +DROP PROCEDURE babel_862_replicate_dep_proc +GO + +DROP VIEW babel_862_replicate_dep_view +GO + +DROP TABLE babel_862_replicate_UDT +GO + +DROP VIEW babel_862_replicate_dep_view_1 +GO + +DROP VIEW babel_862_replicate_dep_view_2 +GO + +DROP VIEW babel_862_replicate_dep_view_3 +GO + +DROP VIEW babel_862_replicate_dep_view_4 +GO + +DROP VIEW babel_862_replicate_dep_view_5 +GO + +DROP VIEW babel_862_replicate_dep_view_6 +GO + +DROP VIEW babel_862_replicate_dep_view_7 +GO + +DROP TYPE dbo.babel_862_replicate_varUDT +GO + +DROP TYPE dbo.babel_862_replicate_imageUDT +GO + +DROP TABLE babel_862_replicate_text +GO + +DROP TABLE babel_862_replicate_image +GO + +DROP TABLE babel_862_replicate_arabic_ci_ai +GO + +DROP TABLE babel_862_replicate_arabic_cs_as +GO + +DROP TABLE babel_862_replicate_arabic_ci_as +GO + +DROP TABLE babel_862_replicate_chinese_prc_ci_ai +GO + +DROP TABLE babel_862_replicate_chinese_prc_cs_as +GO + +DROP TABLE babel_862_replicate_chinese_prc_ci_as +GO + +DROP TABLE babel_862_replicate_t5 +GO + +DROP TABLE babel_862_replicate_t4 +GO + +DROP TABLE babel_862_replicate_t3 +GO + +DROP TABLE babel_862_replicate_t2 +GO + +DROP TABLE babel_862_replicate_t1 +GO diff --git a/test/JDBC/expected/replicate-vu-prepare.out b/test/JDBC/expected/replicate-vu-prepare.out new file mode 100644 index 00000000000..882a7d3f488 --- /dev/null +++ b/test/JDBC/expected/replicate-vu-prepare.out @@ -0,0 +1,156 @@ +CREATE TABLE babel_862_replicate_t1(a NCHAR(50)) +GO +INSERT INTO babel_862_replicate_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_862_replicate_t1 VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_862_replicate_t2 VALUES(N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_t3(a CHAR(50)) +GO +INSERT INTO babel_862_replicate_t3 VALUES('abcdefghi') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_t4(a VARCHAR(50)) +GO +INSERT INTO babel_862_replicate_t4 VALUES('abcdefghi') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_t5(a VARBINARY(50)) +GO +INSERT INTO babel_862_replicate_t5 VALUES(0x2020616263642020) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_862_replicate_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_862_replicate_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_862_replicate_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_862_replicate_arabic_ci_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_862_replicate_arabic_cs_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_862_replicate_arabic_ci_ai VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_image(a IMAGE) +GO +INSERT INTO babel_862_replicate_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_862_replicate_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_862_replicate_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TYPE dbo.babel_862_replicate_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_862_replicate_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_862_replicate_UDT(a dbo.babel_862_replicate_imageUDT, b dbo.babel_862_replicate_varUDT) +GO +INSERT INTO babel_862_replicate_UDT VALUES(CAST('abcdef' as dbo.babel_862_replicate_imageUDT), CAST('abcdef' as dbo.babel_862_replicate_varUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_862_replicate_dep_view AS + SELECT replicate(a, 4) as result from babel_862_replicate_t2 +GO + +CREATE PROCEDURE babel_862_replicate_dep_proc AS + SELECT replicate(a, 4) as result from babel_862_replicate_t2 +GO + +CREATE FUNCTION babel_862_replicate_dep_func() +RETURNS NVARCHAR(200) +AS +BEGIN +RETURN (SELECT TOP 1 replicate(a, 4) from babel_862_replicate_t2) +END +GO + +CREATE VIEW babel_862_replicate_dep_view_1 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_t1 +GO + +CREATE VIEW babel_862_replicate_dep_view_2 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_t2 +GO + +CREATE VIEW babel_862_replicate_dep_view_3 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_t3 +GO + +CREATE VIEW babel_862_replicate_dep_view_4 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_t4 +GO + +CREATE VIEW babel_862_replicate_dep_view_5 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_t5 +GO + +CREATE VIEW babel_862_replicate_dep_view_6 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_text +GO + +CREATE VIEW babel_862_replicate_dep_view_7 AS + SELECT replicate(b, 4) as result FROM babel_862_replicate_text +GO + +CREATE FUNCTION babel_862_replicate_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT replicate(a, 4) as result from babel_862_replicate_t2) +GO diff --git a/test/JDBC/expected/replicate-vu-verify.out b/test/JDBC/expected/replicate-vu-verify.out new file mode 100644 index 00000000000..f454fa22a14 --- /dev/null +++ b/test/JDBC/expected/replicate-vu-verify.out @@ -0,0 +1,658 @@ +-- NULL +SELECT replicate(NULL, -2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate(NULL, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate(NULL, 2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate('abc', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT replicate(NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- edge case values for second parameter +SELECT replicate('AbdefGhi', -2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT '|' + replicate('AbdefGhi', 0) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT replicate('AbdefGhi', 2) +GO +~~START~~ +varchar +AbdefGhiAbdefGhi +~~END~~ + + +SELECT replicate('AbdefGhi', 1001) +GO +~~START~~ +varchar +AbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhiAbdefGhi +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abc?defghi?? abc?defghi?? abc?defghi?? abc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +??·??? ??·??? ??·??? ??·??? +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +??·??? ??·??? ??·??? ??·??? +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +??·?????·?????·?????·??? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_862_replicate_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_862_replicate_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_862_replicate_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_ci_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +SELECT replicate(a, 4) COLLATE ARABIC_CI_AS FROM babel_862_replicate_arabic_ci_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_cs_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +SELECT replicate(a, 4) COLLATE ARABIC_CS_AS FROM babel_862_replicate_arabic_cs_as +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_ci_ai +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +SELECT replicate(a, 4) COLLATE ARABIC_CI_AI FROM babel_862_replicate_arabic_ci_ai +GO +~~START~~ +varchar +الله مع المتقينالله مع المتقينالله مع المتقينالله مع المتقين +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +abc?defghi?? abc?defghi?? abc?defghi?? abc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +??·??? ??·??? ??·??? ??·??? +~~END~~ + + +-- with table column of type nchar +SELECT replicate(a, 4) FROM babel_862_replicate_t1 +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 +比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO +~~START~~ +nvarchar +比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯比尔·拉莫斯 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abcdefghabcdefghabcdefghabcdefgh +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +abcdefghabcdefghabcdefghabcdefgh +~~END~~ + + +-- dependent objects +SELECT * FROM babel_862_replicate_dep_view +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +EXEC babel_862_replicate_dep_proc +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_func() +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_862_replicate_itvf_func() +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_1 +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 abc🙂defghi🙂🙂 +比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 比尔·拉莫斯 +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_2 +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_3 +GO +~~START~~ +varchar +abcdefghi abcdefghi abcdefghi abcdefghi +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_4 +GO +~~START~~ +varchar +abcdefghiabcdefghiabcdefghiabcdefghi +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_5 +GO +~~START~~ +varchar + abcd abcd abcd abcd +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_6 +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +SELECT * FROM babel_862_replicate_dep_view_7 +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +-- input type UDT +-- -- in table babel_862_replicate_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT replicate(a, 4) FROM babel_862_replicate_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replicate function.)~~ + + +SELECT replicate(b, 4) FROM babel_862_replicate_UDT +GO +~~START~~ +varchar +abcdefabcdefabcdefabcdef +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +2016-12-212016-12-212016-12-212016-12-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +2016-12-21 00:00:002016-12-21 00:00:002016-12-21 00:00:002016-12-21 00:00:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1955-12-13 12:43:001955-12-13 12:43:001955-12-13 12:43:001955-12-13 12:43:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12:10:05.123712:10:05.123712:10:05.123712:10:05.1237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:001968-10-23 12:45:37.1234 +10:001968-10-23 12:45:37.1234 +10:001968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1968-10-23 12:45:37.12371968-10-23 12:45:37.12371968-10-23 12:45:37.12371968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +123456123456123456123456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345123451234512345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345.112345.112345.112345.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345.112345.112345.112345.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345678123456781234567812345678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12345678123456781234567812345678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12356123561235612356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +235235235235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12356.000012356.000012356.000012356.0000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +12356.000012356.000012356.000012356.0000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +1111 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT replicate(@inputString, 4) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +SELECT replicate(a, 4) from babel_862_replicate_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of replicate function.)~~ + + +-- input datatype text +SELECT replicate(a, 4) FROM babel_862_replicate_text +GO +~~START~~ +varchar +abc?defghi??abc?defghi??abc?defghi??abc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT replicate(b, 4) FROM babel_862_replicate_text +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT replicate(@inputString, 4) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of replicate function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO +~~START~~ +varchar +POINT(1 2)POINT(1 2)POINT(1 2)POINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/restrict_drop_user_role.out b/test/JDBC/expected/restrict_drop_user_role.out new file mode 100644 index 00000000000..fa3bcc04262 --- /dev/null +++ b/test/JDBC/expected/restrict_drop_user_role.out @@ -0,0 +1,302 @@ +-- tsql +create login no_priv_login1 with password = '12345678' +go + +create role dont_drop_role +go + +create login no_priv_login2 with password = '12345678' +go + +create user no_priv_user2 for login no_priv_login2 +go + +create login no_priv_login3 with password = '12345678' +go + +create user no_priv_user3 for login no_priv_login3 +go + +create role no_priv_role3; +go + +create database restrict_user_db1 +go + +use restrict_user_db1 +go + +create role dont_drop_role +go + +create user no_priv_user1 for login no_priv_login1 +go + +use master +go + +-- tsql user=no_priv_login1 password=12345678 +-- case-1 - when current user is guest +-- permission denied +select current_user,db_name() +go +~~START~~ +varchar#!#nvarchar +guest#!#master +~~END~~ + + +drop role dont_drop_role +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the role 'dont_drop_role', because it does not exist or you do not have permission.)~~ + + +drop user no_priv_user2 +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the user 'no_priv_user2', because it does not exist or you do not have permission.)~~ + + +-- tsql +select current_user,db_name() +go +~~START~~ +varchar#!#nvarchar +dbo#!#master +~~END~~ + + +create user no_priv_user1 for login no_priv_login1 +go + +-- tsql user=no_priv_login1 password=12345678 +-- case-2 - when current user has no privilege +-- permission denied +use master +go + +select current_user +go +~~START~~ +varchar +no_priv_user1 +~~END~~ + + +drop role dont_drop_role +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the role 'dont_drop_role', because it does not exist or you do not have permission.)~~ + + +drop user no_priv_user2 +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the user 'no_priv_user2', because it does not exist or you do not have permission.)~~ + + +-- tsql + +-- case-3 - when current login has privilege +-- 3.1 - when login is database owner +Alter authorization on database::restrict_user_db1 to no_priv_login2 +go + +-- tsql user=no_priv_login2 password=12345678 database=restrict_user_db1 +-- allowed +select current_user +go +~~START~~ +varchar +dbo +~~END~~ + + +drop role dont_drop_role +go + +drop user no_priv_user1 +go + +-- error +-- try to drop non existing role/user +drop role fake_role +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the role 'fake_role', because it does not exist or you do not have permission.)~~ + + +drop user fake_user; +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the user 'fake_user', because it does not exist or you do not have permission.)~~ + + +drop user db +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the user 'db', because it does not exist or you do not have permission.)~~ + + +drop role db_own +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the role 'db_own', because it does not exist or you do not have permission.)~~ + + +drop user dbo_u1 +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the user 'dbo_u1', because it does not exist or you do not have permission.)~~ + + +drop role db_owner_r1 +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the role 'db_owner_r1', because it does not exist or you do not have permission.)~~ + + +-- should deny +-- try to drop dbo user, db_owner role +drop role db_owner +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the role 'db_owner'.)~~ + + +drop user dbo +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the user 'dbo'.)~~ + + + +create role dont_drop_role +go + +create user no_priv_user1 for login no_priv_login1 +go + +-- tsql +-- 3.2 - when login is sysadmin +-- allowed +drop user no_priv_user1 +go + +drop user no_priv_user2 +go + +drop role dont_drop_role +go + +-- 3.3 - when drop user/role has IF EXISTS clause +-- Should not throw error for the case where IF EXISTS clause is included +drop role if exists fake_role; +go + +drop user if exists fake_user; +go + +-- both of the following statements should be executed successfully since user/role exists +drop user if exists no_priv_user3; +go + +drop user if exists no_priv_role3; +go + +select count(*) from sys.database_principals where name like '%no_priv_%3'; +go +~~START~~ +int +0 +~~END~~ + + +-- psql +-- 3.4 - Try dropping role created from PG role +create role master_pguser1; +go + +-- tsql +drop user pguser1; +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the user 'pguser1', because it does not exist or you do not have permission.)~~ + + +drop role pguser1; +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Cannot drop the role 'pguser1', because it does not exist or you do not have permission.)~~ + + +-- it will still try to drop it, but permission denied will be generated since +-- bbf_role_admin won't have privilege to drop non-babelfish roles +drop user if exists pguser1; +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: permission denied to drop role)~~ + + +drop role if exists pguser1; +go +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: permission denied to drop role)~~ + + +-- psql +drop role master_pguser1; +go + +-- Need to terminate active session before cleaning up the login +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'no_priv_login1' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +go +~~START~~ +bool +t +~~END~~ + + + +-- tsql +drop login no_priv_login1 +go + +-- psql +-- Need to terminate active session before cleaning up the login +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'no_priv_login2' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +go +~~START~~ +bool +t +~~END~~ + + +-- tsql +drop login no_priv_login2 +go + +drop login no_priv_login3 +go + +drop database restrict_user_db1 +go diff --git a/test/JDBC/expected/restricted_procedures-vu-cleanup.out b/test/JDBC/expected/restricted_procedures-vu-cleanup.out new file mode 100644 index 00000000000..c7be4764b33 --- /dev/null +++ b/test/JDBC/expected/restricted_procedures-vu-cleanup.out @@ -0,0 +1,106 @@ +REVOKE EXECUTE ON babel_4390_prepare_p1 TO guest; +GO + +REVOKE EXECUTE ON babel_4390_prepare_p3 TO guest; +GO + +REVOKE EXECUTE ON babel_4390_prepare_p4 TO guest; +GO + +REVOKE EXECUTE ON babel_4390_prepare_p5 TO guest; +GO + +REVOKE EXECUTE ON babel_4390_prepare_p6 TO guest; +GO + +REVOKE EXECUTE ON babel_4390_prepare_p7 TO guest; +GO + +REVOKE EXECUTE ON babel_4390_prepare_p8 TO guest; +GO + +REVOKE EXECUTE ON babel_4390_prepare_p9 TO guest; +GO + +DROP PROCEDURE IF EXISTS babel_4390_prepare_p1; +GO + +DROP PROCEDURE IF EXISTS babel_4390_prepare_p3; +GO + +DROP PROCEDURE IF EXISTS babel_4390_prepare_p4; +GO + +DROP PROCEDURE IF EXISTS babel_4390_prepare_p5; +GO + +DROP PROCEDURE IF EXISTS babel_4390_prepare_p6; +GO + +DROP PROCEDURE IF EXISTS babel_4390_prepare_p7; +GO + +DROP PROCEDURE IF EXISTS babel_4390_prepare_p8; +GO + +DROP PROCEDURE IF EXISTS babel_4390_prepare_p9; +GO + +-- tsql user=babel_4390_user_l1 password=abc +DROP PROCEDURE IF EXISTS babel_4390_test_schema_s1.xp_qv; +GO + +DROP PROCEDURE IF EXISTS babel_4390_test_schema_s1.sp_addlinkedsrvlogin; +GO + +-- tsql +DROP SCHEMA IF EXISTS babel_4390_test_schema_s1; +GO + +DROP USER IF EXISTS babel_4390_user_u1; +GO + +-- psql +-- Need to terminate active session before cleaning up the login +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'babel_4390_user_l1' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +GO +~~START~~ +bool +t +~~END~~ + + +-- Wait to sync with another session +SELECT pg_sleep(1); +GO +~~START~~ +void + +~~END~~ + + +-- Need to terminate active session before cleaning up the login +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'babel_4390_user_l2' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +GO +~~START~~ +bool +~~END~~ + + +-- Wait to sync with another session +SELECT pg_sleep(1); +GO +~~START~~ +void + +~~END~~ + + +-- tsql +DROP LOGIN babel_4390_user_l1; +GO + +DROP LOGIN babel_4390_user_l2; +GO diff --git a/test/JDBC/expected/restricted_procedures-vu-prepare.out b/test/JDBC/expected/restricted_procedures-vu-prepare.out new file mode 100644 index 00000000000..2064f0cd1bf --- /dev/null +++ b/test/JDBC/expected/restricted_procedures-vu-prepare.out @@ -0,0 +1,97 @@ +CREATE LOGIN babel_4390_user_l1 WITH PASSWORD = '12345678'; +GO + +CREATE USER babel_4390_user_u1 FOR LOGIN babel_4390_user_l1; +GO + +CREATE SCHEMA babel_4390_test_schema_s1 AUTHORIZATION babel_4390_user_u1; +GO + +CREATE LOGIN babel_4390_user_l2 WITH PASSWORD = '12345678'; +GO + +-- tsql user=babel_4390_user_l1 password=12345678 +CREATE PROCEDURE babel_4390_test_schema_s1.xp_qv AS +BEGIN + SELECT 1; +END +GO + +CREATE PROCEDURE babel_4390_test_schema_s1.sp_addlinkedsrvlogin AS +BEGIN + SELECT 1; +END +GO + +-- tsql +CREATE PROCEDURE babel_4390_prepare_p1 AS +BEGIN + EXEC('DROP PROCEDURE dbo.xp_qv'); +END +GO + +CREATE PROCEDURE babel_4390_prepare_p3 AS +BEGIN + EXEC('DROP PROCEDURE dbo.xp_instance_regread(sys.nvarchar, sys.sysname, sys.nvarchar, int)'); +END +GO + +CREATE PROCEDURE babel_4390_prepare_p4 AS +BEGIN + EXEC('DROP PROCEDURE dbo.xp_instance_regread(sys.nvarchar, sys.sysname, sys.nvarchar, sys.nvarchar)'); +END +GO + +CREATE PROCEDURE babel_4390_prepare_p5 AS +BEGIN + EXEC('DROP PROCEDURE dbo.sp_addlinkedsrvlogin'); +END +GO + +CREATE PROCEDURE babel_4390_prepare_p6 AS +BEGIN + EXEC('DROP PROCEDURE dbo.sp_droplinkedsrvlogin'); +END +GO + +CREATE PROCEDURE babel_4390_prepare_p7 AS +BEGIN + EXEC('DROP PROCEDURE dbo.sp_dropserver'); +END +GO + +CREATE PROCEDURE babel_4390_prepare_p8 AS +BEGIN + EXEC('DROP PROCEDURE dbo.sp_enum_oledb_providers'); +END +GO + +CREATE PROCEDURE babel_4390_prepare_p9 AS +BEGIN + EXEC('DROP PROCEDURE dbo.sp_testlinkedserver'); +END +GO + +GRANT EXECUTE ON babel_4390_prepare_p1 TO guest; +GO + +GRANT EXECUTE ON babel_4390_prepare_p3 TO guest; +GO + +GRANT EXECUTE ON babel_4390_prepare_p4 TO guest; +GO + +GRANT EXECUTE ON babel_4390_prepare_p5 TO guest; +GO + +GRANT EXECUTE ON babel_4390_prepare_p6 TO guest; +GO + +GRANT EXECUTE ON babel_4390_prepare_p7 TO guest; +GO + +GRANT EXECUTE ON babel_4390_prepare_p8 TO guest; +GO + +GRANT EXECUTE ON babel_4390_prepare_p9 TO guest; +GO diff --git a/test/JDBC/expected/restricted_procedures-vu-verify.out b/test/JDBC/expected/restricted_procedures-vu-verify.out new file mode 100644 index 00000000000..1ffd71568ba --- /dev/null +++ b/test/JDBC/expected/restricted_procedures-vu-verify.out @@ -0,0 +1,99 @@ +-- tsql +-- reset the login password +ALTER LOGIN babel_4390_user_l1 WITH PASSWORD = 'abc'; +GO + +ALTER LOGIN babel_4390_user_l2 WITH PASSWORD = 'abc'; +GO + +-- tsql user=babel_4390_user_l2 password=abc +-- should throw error +EXEC dbo.babel_4390_prepare_p1; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: must be owner of procedure xp_qv)~~ + + +EXEC dbo.babel_4390_prepare_p3; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: must be owner of procedure xp_instance_regread)~~ + + +EXEC dbo.babel_4390_prepare_p4; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: must be owner of procedure xp_instance_regread)~~ + + +BEGIN TRANSACTION; +EXEC dbo.babel_4390_prepare_p1; +ROLLBACK; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: must be owner of procedure xp_qv)~~ + + +DROP PROCEDURE dbo.xp_qv; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: must be owner of procedure xp_qv)~~ + + +EXEC dbo.babel_4390_prepare_p5; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: must be owner of procedure sp_addlinkedsrvlogin)~~ + + +EXEC dbo.babel_4390_prepare_p6; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: must be owner of procedure sp_droplinkedsrvlogin)~~ + + +EXEC dbo.babel_4390_prepare_p7; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: must be owner of procedure sp_dropserver)~~ + + +EXEC dbo.babel_4390_prepare_p8; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: must be owner of procedure sp_enum_oledb_providers)~~ + + +EXEC dbo.babel_4390_prepare_p9; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: must be owner of procedure sp_testlinkedserver)~~ + + +-- psql user=babel_4390_user_l2 password=abc +-- should throw error +DROP PROCEDURE master_dbo.xp_qv; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: must be owner of procedure xp_qv + Server SQLState: 42501)~~ + + +DROP PROCEDURE master_dbo.sp_addlinkedsrvlogin; +GO +~~ERROR (Code: 0)~~ + +~~ERROR (Message: ERROR: must be owner of procedure sp_addlinkedsrvlogin + Server SQLState: 42501)~~ + diff --git a/test/JDBC/expected/restricting_function_overloading-vu-cleanup.out b/test/JDBC/expected/restricting_function_overloading-vu-cleanup.out new file mode 100644 index 00000000000..461134e40db --- /dev/null +++ b/test/JDBC/expected/restricting_function_overloading-vu-cleanup.out @@ -0,0 +1,59 @@ +DROP FUNCTION IF EXISTS OverloadedFunction; +GO + +DROP FUNCTION IF EXISTS OverloadedFunction_2; +GO + +DROP FUNCTION IF EXISTS OverloadedFunction_3; +GO + +DROP FUNCTION IF EXISTS restrict_func_overloading_s1.overloaded_function; +GO + +DROP FUNCTION IF EXISTS restrict_func_overloading_s1.overloaded_object; +GO + +DROP FUNCTION IF EXISTS restrict_func_overloading_s2.overloaded_function; +GO + +DROP FUNCTION IF EXISTS dbo.overloaded_function; +GO + +DROP FUNCTION IF EXISTS dbo.to_date; +GO + +DROP FUNCTION IF EXISTS dbo.sysdatetime; +GO + +DROP FUNCTION IF EXISTS dbo.overloaded_function_f1; +GO + +DROP PROCEDURE IF EXISTS OverloadedObject; +GO + +DROP PROCEDURE IF EXISTS OverloadedFunction_1; +GO + +DROP PROCEDURE IF EXISTS OverloadedProcedure; +GO + +DROP PROCEDURE IF EXISTS restrict_func_overloading_s1.overloaded_proc; +GO + +DROP PROCEDURE IF EXISTS restrict_func_overloading_s2.overloaded_proc; +GO + +DROP PROCEDURE IF EXISTS dbo.overloaded_proc; +GO + +DROP PROCEDURE IF EXISTS dbo.sp_tables; +GO + +DROP TABLE IF EXISTS OverloadedObject; +GO + +DROP SCHEMA IF EXISTS restrict_func_overloading_s1; +GO + +DROP SCHEMA IF EXISTS restrict_func_overloading_s2; +GO diff --git a/test/JDBC/expected/restricting_function_overloading-vu-prepare.out b/test/JDBC/expected/restricting_function_overloading-vu-prepare.out new file mode 100644 index 00000000000..0c3e326d300 --- /dev/null +++ b/test/JDBC/expected/restricting_function_overloading-vu-prepare.out @@ -0,0 +1,6 @@ +CREATE SCHEMA restrict_func_overloading_s1; +GO + +CREATE SCHEMA restrict_func_overloading_s2; +GO + diff --git a/test/JDBC/expected/restricting_function_overloading.out b/test/JDBC/expected/restricting_function_overloading-vu-verify.out similarity index 53% rename from test/JDBC/expected/restricting_function_overloading.out rename to test/JDBC/expected/restricting_function_overloading-vu-verify.out index b16d0f9b015..c287ef4768e 100644 --- a/test/JDBC/expected/restricting_function_overloading.out +++ b/test/JDBC/expected/restricting_function_overloading-vu-verify.out @@ -17,9 +17,6 @@ GO ~~ERROR (Message: Function 'overloadedfunction' already exists with the same name)~~ -DROP FUNCTION OverloadedFunction; -GO - -- Overloaded function with same number of argument and same argument type CREATE PROCEDURE OverloadedFunction_1 @num1 INT AS BEGIN SELECT @num1 + 1 END GO @@ -38,9 +35,6 @@ GO ~~ERROR (Message: Function 'overloadedfunction_1' already exists with the same name)~~ -DROP PROCEDURE OverloadedFunction_1; -GO - -- Overloaded procedures CREATE PROCEDURE OverloadedProcedure AS BEGIN SELECT 1 END GO @@ -52,9 +46,6 @@ GO ~~ERROR (Message: Function 'overloadedprocedure' already exists with the same name)~~ -DROP PROCEDURE OverloadedProcedure; -GO - -- Objects with same name table, function and procedure CREATE TABLE OverloadedObject(a int); GO @@ -69,12 +60,6 @@ GO ~~ERROR (Message: Function 'overloadedobject' already exists with the same name)~~ -DROP TABLE OverloadedObject; -GO - -DROP PROCEDURE OverloadedObject; -GO - -- Overloaded function with different number of arguments CREATE FUNCTION OverloadedFunction_2(@num1 INT) RETURNS INT AS BEGIN RETURN @num1 + 1 END GO @@ -93,9 +78,6 @@ GO ~~ERROR (Message: Function 'overloadedfunction_2' already exists with the same name)~~ -DROP FUNCTION OverloadedFunction_2; -GO - -- Overloaded function with same number of arguments but different types CREATE FUNCTION OverloadedFunction_3(@num1 INT, @num2 INT) RETURNS INT AS BEGIN RETURN @num1 + @num2 END GO @@ -107,9 +89,6 @@ GO ~~ERROR (Message: Function 'overloadedfunction_3' already exists with the same name)~~ -DROP FUNCTION OverloadedFunction_3; -GO - -- psql -- Not restricting function overloading via PG port -- create Overloaded function with same number of arguments @@ -170,6 +149,23 @@ GO DROP FUNCTION OverloadedFunction(float, float); GO +SET search_path TO non_existent_schema, "$user", public; +GO + +CREATE OR REPLACE FUNCTION OverloadedFunction_f1() +RETURNS INT +AS +$$ +BEGIN +RETURN 1; +END; +$$ +LANGUAGE plpgsql; +GO + +SET search_path TO "$user", public; +GO + -- Overloaded procedures via PG port CREATE OR REPLACE PROCEDURE OverloadedProcedure(IN a FLOAT, IN b FLOAT, OUT c FLOAT) LANGUAGE plpgsql @@ -196,3 +192,146 @@ GO DROP PROCEDURE OverloadedProcedure(float, float); GO + +-- tsql +-- Case 1: Function/Procedure Overloading in different schemas +CREATE FUNCTION restrict_func_overloading_s1.overloaded_function() RETURNS INT AS BEGIN RETURN 1; END; +GO + +CREATE FUNCTION restrict_func_overloading_s2.overloaded_function() RETURNS INT AS BEGIN RETURN 2; END; +GO + +SELECT restrict_func_overloading_s1.overloaded_function(); +GO +~~START~~ +int +1 +~~END~~ + + +SELECT restrict_func_overloading_s2.overloaded_function(); +GO +~~START~~ +int +2 +~~END~~ + + +CREATE PROCEDURE restrict_func_overloading_s1.overloaded_proc AS BEGIN SELECT 'restrict_func_overloading_s1'; END; +GO + +CREATE PROCEDURE restrict_func_overloading_s2.overloaded_proc AS BEGIN SELECT 'restrict_func_overloading_s2'; END; +GO + +EXEC restrict_func_overloading_s1.overloaded_proc; +GO +~~START~~ +varchar +restrict_func_overloading_s1 +~~END~~ + + +EXEC restrict_func_overloading_s2.overloaded_proc; +GO +~~START~~ +varchar +restrict_func_overloading_s2 +~~END~~ + + +-- Case 2: Function/Procedure Overloading in the same schema is not allowed +-- should throw error +CREATE FUNCTION restrict_func_overloading_s1.overloaded_function(@a INT) RETURNS INT AS BEGIN RETURN @a; END; +GO +~~ERROR (Code: 2714)~~ + +~~ERROR (Message: Function 'overloaded_function' already exists with the same name)~~ + + +-- Case 3: Function/Procedure Creation Without specifying schema defaults to current schema i.e. dbo +CREATE FUNCTION overloaded_function() RETURNS INT AS BEGIN RETURN 4; END; +GO + +CREATE PROCEDURE overloaded_proc AS BEGIN SELECT 'overloaded proc'; END; +GO + +-- should return 4 +SELECT dbo.overloaded_function(); +GO +~~START~~ +int +4 +~~END~~ + + +EXEC dbo.overloaded_proc; +GO +~~START~~ +varchar +overloaded proc +~~END~~ + + +-- Case 4: Same object name during Function/Procedure creation is not allowed +CREATE FUNCTION restrict_func_overloading_s1.overloaded_object() RETURNS INT AS BEGIN RETURN 6; END; +GO + +-- should throw error since same name object already exist in the schema +CREATE PROCEDURE restrict_func_overloading_s1.overloaded_object AS BEGIN SELECT 'same object name'; END; +GO +~~ERROR (Code: 2714)~~ + +~~ERROR (Message: Function 'overloaded_object' already exists with the same name)~~ + + +-- Case 5: Function/Procedure creation with name similar to sys or pg_catalog objects +-- creates function in default schema i.e. dbo +CREATE FUNCTION to_date() RETURNS INT AS BEGIN RETURN 1; END; +GO + +SELECT to_date(); +GO +~~START~~ +int +1 +~~END~~ + + +SELECT pg_catalog.to_date('20170103','YYYYMMDD'); +GO +~~START~~ +date +2017-01-03 +~~END~~ + + +-- Case 6: When current default schema in the search path is invalid +SELECT CURRENT_SETTING('search_path'); +GO +~~START~~ +text +master_dbo, "$user", sys, pg_catalog +~~END~~ + + +-- Making a non existent schema as current default schema +SELECT SET_CONFIG('search_path', 'master_non_existent_schema, master_dbo, "$user", sys, pg_catalog', false); +GO +~~START~~ +text +master_non_existent_schema, master_dbo, "$user", sys, pg_catalog +~~END~~ + + +-- should create the function in next valid schema in the search path i.e. dbo +CREATE FUNCTION overloaded_function_f1() RETURNS INT AS BEGIN RETURN 1; END +GO + +-- Reset search path +SELECT SET_CONFIG('search_path', 'master_dbo, "$user", sys, pg_catalog', false); +GO +~~START~~ +text +master_dbo, "$user", sys, pg_catalog +~~END~~ + diff --git a/test/JDBC/expected/reverse-before-15_8-or-16_4-vu-cleanup.out b/test/JDBC/expected/reverse-before-15_8-or-16_4-vu-cleanup.out new file mode 100644 index 00000000000..b48d463a0ea --- /dev/null +++ b/test/JDBC/expected/reverse-before-15_8-or-16_4-vu-cleanup.out @@ -0,0 +1,80 @@ +DROP FUNCTION babel_4839_reverse_itvf_func +GO + +DROP FUNCTION babel_4839_reverse_dep_func +GO + +DROP PROCEDURE babel_4839_reverse_dep_proc +GO + +DROP VIEW babel_4839_reverse_dep_view +GO + +DROP TABLE babel_4839_reverse_UDT +GO + +DROP VIEW babel_4839_reverse_dep_view_1 +GO + +DROP VIEW babel_4839_reverse_dep_view_2 +GO + +DROP VIEW babel_4839_reverse_dep_view_3 +GO + +DROP VIEW babel_4839_reverse_dep_view_4 +GO + +DROP VIEW babel_4839_reverse_dep_view_5 +GO + +DROP VIEW babel_4839_reverse_dep_view_6 +GO + +DROP VIEW babel_4839_reverse_dep_view_7 +GO + +DROP TYPE dbo.babel_4839_reverse_varUDT +GO + +DROP TYPE dbo.babel_4839_reverse_imageUDT +GO + +DROP TABLE babel_4839_reverse_text +GO + +DROP TABLE babel_4839_reverse_image +GO + +DROP TABLE babel_4839_reverse_arabic_ci_ai +GO + +DROP TABLE babel_4839_reverse_arabic_cs_as +GO + +DROP TABLE babel_4839_reverse_arabic_ci_as +GO + +DROP TABLE babel_4839_reverse_chinese_prc_ci_ai +GO + +DROP TABLE babel_4839_reverse_chinese_prc_cs_as +GO + +DROP TABLE babel_4839_reverse_chinese_prc_ci_as +GO + +DROP TABLE babel_4839_reverse_t5 +GO + +DROP TABLE babel_4839_reverse_t4 +GO + +DROP TABLE babel_4839_reverse_t3 +GO + +DROP TABLE babel_4839_reverse_t2 +GO + +DROP TABLE babel_4839_reverse_t1 +GO diff --git a/test/JDBC/expected/reverse-before-15_8-or-16_4-vu-prepare.out b/test/JDBC/expected/reverse-before-15_8-or-16_4-vu-prepare.out new file mode 100644 index 00000000000..e9835fceab6 --- /dev/null +++ b/test/JDBC/expected/reverse-before-15_8-or-16_4-vu-prepare.out @@ -0,0 +1,156 @@ +CREATE TABLE babel_4839_reverse_t1(a NCHAR(50)) +GO +INSERT INTO babel_4839_reverse_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_4839_reverse_t1 VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4839_reverse_t2 VALUES(N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_t3(a CHAR(50)) +GO +INSERT INTO babel_4839_reverse_t3 VALUES('abcdefghi') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4839_reverse_t4 VALUES('abcdefghi') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4839_reverse_t5 VALUES(0x2020616263642020) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4839_reverse_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4839_reverse_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4839_reverse_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4839_reverse_arabic_ci_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4839_reverse_arabic_cs_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4839_reverse_arabic_ci_ai VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_image(a IMAGE) +GO +INSERT INTO babel_4839_reverse_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4839_reverse_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TYPE dbo.babel_4839_reverse_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4839_reverse_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4839_reverse_UDT(a dbo.babel_4839_reverse_imageUDT, b dbo.babel_4839_reverse_varUDT) +GO +INSERT INTO babel_4839_reverse_UDT VALUES(CAST('abcdef' as dbo.babel_4839_reverse_imageUDT), CAST('abcdef' as dbo.babel_4839_reverse_varUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_4839_reverse_dep_view AS + SELECT reverse(a) as result from babel_4839_reverse_t2 +GO + +CREATE PROCEDURE babel_4839_reverse_dep_proc AS + SELECT reverse(a) as result from babel_4839_reverse_t2 +GO + +CREATE FUNCTION babel_4839_reverse_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 reverse(a) from babel_4839_reverse_t2) +END +GO + +CREATE VIEW babel_4839_reverse_dep_view_1 AS + SELECT reverse(a) as result FROM babel_4839_reverse_t1 +GO + +CREATE VIEW babel_4839_reverse_dep_view_2 AS + SELECT reverse(a) as result FROM babel_4839_reverse_t2 +GO + +CREATE VIEW babel_4839_reverse_dep_view_3 AS + SELECT reverse(a) as result FROM babel_4839_reverse_t3 +GO + +CREATE VIEW babel_4839_reverse_dep_view_4 AS + SELECT reverse(a) as result FROM babel_4839_reverse_t4 +GO + +CREATE VIEW babel_4839_reverse_dep_view_5 AS + SELECT reverse(a) as result FROM babel_4839_reverse_t5 +GO + +CREATE VIEW babel_4839_reverse_dep_view_6 AS + SELECT reverse(a) as result FROM babel_4839_reverse_text +GO + +CREATE VIEW babel_4839_reverse_dep_view_7 AS + SELECT reverse(b) as result FROM babel_4839_reverse_text +GO + +CREATE FUNCTION babel_4839_reverse_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT reverse(a) as result from babel_4839_reverse_t2) +GO diff --git a/test/JDBC/expected/reverse-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/reverse-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..e9ab22a8618 --- /dev/null +++ b/test/JDBC/expected/reverse-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,602 @@ +-- NULL +SELECT reverse(NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- empty string +SELECT reverse('') +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +varchar + ??ihgfed?cba +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +varchar + ???·?? +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + ???·?? +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +varchar +??ihgfed?cba +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +varchar +???·?? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_ci_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +SELECT reverse(a) COLLATE CHINESE_PRC_CI_AS FROM babel_4839_reverse_chinese_prc_ci_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_cs_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +SELECT reverse(a) COLLATE CHINESE_PRC_CS_AS FROM babel_4839_reverse_chinese_prc_cs_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_ci_ai +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +SELECT reverse(a) COLLATE CHINESE_PRC_CI_AI FROM babel_4839_reverse_chinese_prc_ci_ai +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT reverse(a) FROM babel_4839_reverse_arabic_ci_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +SELECT reverse(a) COLLATE ARABIC_CI_AS FROM babel_4839_reverse_arabic_ci_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT reverse(a) FROM babel_4839_reverse_arabic_cs_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +SELECT reverse(a) COLLATE ARABIC_CS_AS FROM babel_4839_reverse_arabic_cs_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT reverse(a) FROM babel_4839_reverse_arabic_ci_ai +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +SELECT reverse(a) COLLATE ARABIC_CI_AI FROM babel_4839_reverse_arabic_ci_ai +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar + ??ihgfed?cba +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar + ???·?? +~~END~~ + + +-- with table column of type nchar +SELECT reverse(a) FROM babel_4839_reverse_t1 +GO +~~START~~ +nvarchar + 🙂🙂ihgfed🙂cba + 斯莫拉·尔比 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar +斯莫拉·尔比 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT reverse(@inputString) +GO +~~START~~ +varchar +hgfedcba +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT reverse(@inputString) +GO +~~START~~ +varchar +hgfedcba +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4839_reverse_dep_view +GO +~~START~~ +text +??ihgfed?cba +~~END~~ + + +EXEC babel_4839_reverse_dep_proc +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_func() +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_itvf_func() +GO +~~START~~ +text +??ihgfed?cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_1 +GO +~~START~~ +text + ??ihgfed?cba + ???·?? +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_2 +GO +~~START~~ +text +??ihgfed?cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_3 +GO +~~START~~ +text + ihgfedcba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_4 +GO +~~START~~ +text +ihgfedcba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_5 +GO +~~START~~ +text +0202463626160202x0 +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_6 +GO +~~START~~ +text +??ihgfed?cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_7 +GO +~~START~~ +text +??ihgfed?cba +~~END~~ + + +-- input type UDT +-- -- in table babel_4839_reverse_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT reverse(a) FROM babel_4839_reverse_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of reverse function.)~~ + + +SELECT reverse(b) FROM babel_4839_reverse_UDT +GO +~~START~~ +varchar +fedcba +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +12-21-6102 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +00:00:00 12-21-6102 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +00:34:21 31-21-5591 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +7321.50:01:21 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +00:01+ 4321.73:54:21 32-01-8691 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +7321.73:54:21 32-01-8691 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +654321 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +54321 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +1.54321 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +1.54321 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +87654321 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +87654321 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +65321 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +532 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +0000.65321 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +0000.65321 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT reverse(@inputString) +GO +~~START~~ +varchar +FF469CF40C00-D24B-110D-68B8-FF9169F6 +~~END~~ + + +SELECT reverse(a) from babel_4839_reverse_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of reverse function.)~~ + + +-- input datatype text +SELECT reverse(a) FROM babel_4839_reverse_text +GO +~~START~~ +varchar +??ihgfed?cba +~~END~~ + + +-- input datatype ntext +SELECT reverse(b) FROM babel_4839_reverse_text +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +FF469CF40C00-D24B-110D-68B8-FF9169F6 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +>ydob/<>/tiurf<>ydob< +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +)2 1(TNIOP +~~END~~ + diff --git a/test/JDBC/expected/reverse-vu-cleanup.out b/test/JDBC/expected/reverse-vu-cleanup.out new file mode 100644 index 00000000000..b48d463a0ea --- /dev/null +++ b/test/JDBC/expected/reverse-vu-cleanup.out @@ -0,0 +1,80 @@ +DROP FUNCTION babel_4839_reverse_itvf_func +GO + +DROP FUNCTION babel_4839_reverse_dep_func +GO + +DROP PROCEDURE babel_4839_reverse_dep_proc +GO + +DROP VIEW babel_4839_reverse_dep_view +GO + +DROP TABLE babel_4839_reverse_UDT +GO + +DROP VIEW babel_4839_reverse_dep_view_1 +GO + +DROP VIEW babel_4839_reverse_dep_view_2 +GO + +DROP VIEW babel_4839_reverse_dep_view_3 +GO + +DROP VIEW babel_4839_reverse_dep_view_4 +GO + +DROP VIEW babel_4839_reverse_dep_view_5 +GO + +DROP VIEW babel_4839_reverse_dep_view_6 +GO + +DROP VIEW babel_4839_reverse_dep_view_7 +GO + +DROP TYPE dbo.babel_4839_reverse_varUDT +GO + +DROP TYPE dbo.babel_4839_reverse_imageUDT +GO + +DROP TABLE babel_4839_reverse_text +GO + +DROP TABLE babel_4839_reverse_image +GO + +DROP TABLE babel_4839_reverse_arabic_ci_ai +GO + +DROP TABLE babel_4839_reverse_arabic_cs_as +GO + +DROP TABLE babel_4839_reverse_arabic_ci_as +GO + +DROP TABLE babel_4839_reverse_chinese_prc_ci_ai +GO + +DROP TABLE babel_4839_reverse_chinese_prc_cs_as +GO + +DROP TABLE babel_4839_reverse_chinese_prc_ci_as +GO + +DROP TABLE babel_4839_reverse_t5 +GO + +DROP TABLE babel_4839_reverse_t4 +GO + +DROP TABLE babel_4839_reverse_t3 +GO + +DROP TABLE babel_4839_reverse_t2 +GO + +DROP TABLE babel_4839_reverse_t1 +GO diff --git a/test/JDBC/expected/reverse-vu-prepare.out b/test/JDBC/expected/reverse-vu-prepare.out new file mode 100644 index 00000000000..e9835fceab6 --- /dev/null +++ b/test/JDBC/expected/reverse-vu-prepare.out @@ -0,0 +1,156 @@ +CREATE TABLE babel_4839_reverse_t1(a NCHAR(50)) +GO +INSERT INTO babel_4839_reverse_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_4839_reverse_t1 VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4839_reverse_t2 VALUES(N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_t3(a CHAR(50)) +GO +INSERT INTO babel_4839_reverse_t3 VALUES('abcdefghi') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4839_reverse_t4 VALUES('abcdefghi') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4839_reverse_t5 VALUES(0x2020616263642020) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4839_reverse_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4839_reverse_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4839_reverse_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4839_reverse_arabic_ci_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4839_reverse_arabic_cs_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4839_reverse_arabic_ci_ai VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_image(a IMAGE) +GO +INSERT INTO babel_4839_reverse_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4839_reverse_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4839_reverse_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TYPE dbo.babel_4839_reverse_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4839_reverse_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4839_reverse_UDT(a dbo.babel_4839_reverse_imageUDT, b dbo.babel_4839_reverse_varUDT) +GO +INSERT INTO babel_4839_reverse_UDT VALUES(CAST('abcdef' as dbo.babel_4839_reverse_imageUDT), CAST('abcdef' as dbo.babel_4839_reverse_varUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_4839_reverse_dep_view AS + SELECT reverse(a) as result from babel_4839_reverse_t2 +GO + +CREATE PROCEDURE babel_4839_reverse_dep_proc AS + SELECT reverse(a) as result from babel_4839_reverse_t2 +GO + +CREATE FUNCTION babel_4839_reverse_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 reverse(a) from babel_4839_reverse_t2) +END +GO + +CREATE VIEW babel_4839_reverse_dep_view_1 AS + SELECT reverse(a) as result FROM babel_4839_reverse_t1 +GO + +CREATE VIEW babel_4839_reverse_dep_view_2 AS + SELECT reverse(a) as result FROM babel_4839_reverse_t2 +GO + +CREATE VIEW babel_4839_reverse_dep_view_3 AS + SELECT reverse(a) as result FROM babel_4839_reverse_t3 +GO + +CREATE VIEW babel_4839_reverse_dep_view_4 AS + SELECT reverse(a) as result FROM babel_4839_reverse_t4 +GO + +CREATE VIEW babel_4839_reverse_dep_view_5 AS + SELECT reverse(a) as result FROM babel_4839_reverse_t5 +GO + +CREATE VIEW babel_4839_reverse_dep_view_6 AS + SELECT reverse(a) as result FROM babel_4839_reverse_text +GO + +CREATE VIEW babel_4839_reverse_dep_view_7 AS + SELECT reverse(b) as result FROM babel_4839_reverse_text +GO + +CREATE FUNCTION babel_4839_reverse_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT reverse(a) as result from babel_4839_reverse_t2) +GO diff --git a/test/JDBC/expected/reverse-vu-verify.out b/test/JDBC/expected/reverse-vu-verify.out new file mode 100644 index 00000000000..3687359bdb7 --- /dev/null +++ b/test/JDBC/expected/reverse-vu-verify.out @@ -0,0 +1,602 @@ +-- NULL +SELECT reverse(NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- empty string +SELECT reverse('') +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +varchar + ??ihgfed?cba +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +varchar + ???·?? +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + ???·?? +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +varchar +??ihgfed?cba +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +varchar +???·?? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_ci_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +SELECT reverse(a) COLLATE CHINESE_PRC_CI_AS FROM babel_4839_reverse_chinese_prc_ci_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_cs_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +SELECT reverse(a) COLLATE CHINESE_PRC_CS_AS FROM babel_4839_reverse_chinese_prc_cs_as +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_ci_ai +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +SELECT reverse(a) COLLATE CHINESE_PRC_CI_AI FROM babel_4839_reverse_chinese_prc_ci_ai +GO +~~START~~ +varchar +斯莫拉·尔比 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT reverse(a) FROM babel_4839_reverse_arabic_ci_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +SELECT reverse(a) COLLATE ARABIC_CI_AS FROM babel_4839_reverse_arabic_ci_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT reverse(a) FROM babel_4839_reverse_arabic_cs_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +SELECT reverse(a) COLLATE ARABIC_CS_AS FROM babel_4839_reverse_arabic_cs_as +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT reverse(a) FROM babel_4839_reverse_arabic_ci_ai +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +SELECT reverse(a) COLLATE ARABIC_CI_AI FROM babel_4839_reverse_arabic_ci_ai +GO +~~START~~ +varchar +نيقتملا عم هللا +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar + ??ihgfed?cba +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar + ???·?? +~~END~~ + + +-- with table column of type nchar +SELECT reverse(a) FROM babel_4839_reverse_t1 +GO +~~START~~ +nvarchar + 🙂🙂ihgfed🙂cba + 斯莫拉·尔比 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT reverse(@inputString) +GO +~~START~~ +nvarchar +斯莫拉·尔比 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT reverse(@inputString) +GO +~~START~~ +varchar +hgfedcba +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT reverse(@inputString) +GO +~~START~~ +varchar +hgfedcba +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4839_reverse_dep_view +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +EXEC babel_4839_reverse_dep_proc +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_func() +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_itvf_func() +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_1 +GO +~~START~~ +nvarchar + 🙂🙂ihgfed🙂cba + 斯莫拉·尔比 +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_2 +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_3 +GO +~~START~~ +varchar + ihgfedcba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_4 +GO +~~START~~ +varchar +ihgfedcba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_5 +GO +~~START~~ +varchar + dcba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_6 +GO +~~START~~ +varchar +??ihgfed?cba +~~END~~ + + +SELECT * FROM babel_4839_reverse_dep_view_7 +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +-- input type UDT +-- -- in table babel_4839_reverse_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT reverse(a) FROM babel_4839_reverse_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of reverse function.)~~ + + +SELECT reverse(b) FROM babel_4839_reverse_UDT +GO +~~START~~ +varchar +fedcba +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +12-21-6102 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +00:00:00 12-21-6102 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +00:34:21 31-21-5591 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +7321.50:01:21 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +00:01+ 4321.73:54:21 32-01-8691 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +7321.73:54:21 32-01-8691 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +654321 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +54321 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +1.54321 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +1.54321 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +87654321 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +87654321 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +65321 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +532 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +0000.65321 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +0000.65321 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT reverse(@inputString) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT reverse(@inputString) +GO +~~START~~ +varchar +FF469CF40C00-D24B-110D-68B8-FF9169F6 +~~END~~ + + +SELECT reverse(a) from babel_4839_reverse_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of reverse function.)~~ + + +-- input datatype text +SELECT reverse(a) FROM babel_4839_reverse_text +GO +~~START~~ +varchar +??ihgfed?cba +~~END~~ + + +-- input datatype ntext +SELECT reverse(b) FROM babel_4839_reverse_text +GO +~~START~~ +nvarchar +🙂🙂ihgfed🙂cba +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT reverse(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of reverse function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +FF469CF40C00-D24B-110D-68B8-FF9169F6 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +>ydob/<>/tiurf<>ydob< +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +)2 1(TNIOP +~~END~~ + diff --git a/test/JDBC/expected/right-before-15_8-or-16_4-vu-cleanup.out b/test/JDBC/expected/right-before-15_8-or-16_4-vu-cleanup.out new file mode 100644 index 00000000000..f3aad52c027 --- /dev/null +++ b/test/JDBC/expected/right-before-15_8-or-16_4-vu-cleanup.out @@ -0,0 +1,80 @@ +DROP FUNCTION babel_4489_right_itvf_func +GO + +DROP FUNCTION babel_4489_right_dep_func +GO + +DROP PROCEDURE babel_4489_right_dep_proc +GO + +DROP VIEW babel_4489_right_dep_view +GO + +DROP TABLE babel_4489_right_UDT +GO + +DROP VIEW babel_4489_right_dep_view_1 +GO + +DROP VIEW babel_4489_right_dep_view_2 +GO + +DROP VIEW babel_4489_right_dep_view_3 +GO + +DROP VIEW babel_4489_right_dep_view_4 +GO + +DROP VIEW babel_4489_right_dep_view_5 +GO + +DROP VIEW babel_4489_right_dep_view_6 +GO + +DROP VIEW babel_4489_right_dep_view_7 +GO + +DROP TYPE dbo.babel_4489_right_varUDT +GO + +DROP TYPE dbo.babel_4489_right_imageUDT +GO + +DROP TABLE babel_4489_right_text +GO + +DROP TABLE babel_4489_right_image +GO + +DROP TABLE babel_4489_right_arabic_ci_ai +GO + +DROP TABLE babel_4489_right_arabic_cs_as +GO + +DROP TABLE babel_4489_right_arabic_ci_as +GO + +DROP TABLE babel_4489_right_chinese_prc_ci_ai +GO + +DROP TABLE babel_4489_right_chinese_prc_cs_as +GO + +DROP TABLE babel_4489_right_chinese_prc_ci_as +GO + +DROP TABLE babel_4489_right_t5 +GO + +DROP TABLE babel_4489_right_t4 +GO + +DROP TABLE babel_4489_right_t3 +GO + +DROP TABLE babel_4489_right_t2 +GO + +DROP TABLE babel_4489_right_t1 +GO diff --git a/test/JDBC/expected/right-before-15_8-or-16_4-vu-prepare.out b/test/JDBC/expected/right-before-15_8-or-16_4-vu-prepare.out new file mode 100644 index 00000000000..b352b44be5a --- /dev/null +++ b/test/JDBC/expected/right-before-15_8-or-16_4-vu-prepare.out @@ -0,0 +1,156 @@ +CREATE TABLE babel_4489_right_t1(a NCHAR(15)) +GO +INSERT INTO babel_4489_right_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_4489_right_t1 VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4489_right_t2 VALUES(N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_t3(a CHAR(50)) +GO +INSERT INTO babel_4489_right_t3 VALUES(' abcdefghi ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4489_right_t4 VALUES(' abcdefghi ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4489_right_t5 VALUES(0x2020616263642020) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4489_right_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4489_right_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4489_right_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4489_right_arabic_ci_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4489_right_arabic_cs_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4489_right_arabic_ci_ai VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_image(a IMAGE) +GO +INSERT INTO babel_4489_right_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4489_right_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TYPE dbo.babel_4489_right_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4489_right_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4489_right_UDT(a dbo.babel_4489_right_imageUDT, b dbo.babel_4489_right_varUDT) +GO +INSERT INTO babel_4489_right_UDT VALUES(CAST('abcdef' as dbo.babel_4489_right_imageUDT), CAST('abcdef' as dbo.babel_4489_right_varUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_4489_right_dep_view AS + SELECT RIGHT(a, 5) as result from babel_4489_right_t2 +GO + +CREATE PROCEDURE babel_4489_right_dep_proc AS + SELECT RIGHT(a, 5) as result from babel_4489_right_t2 +GO + +CREATE FUNCTION babel_4489_right_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 RIGHT(a, 5) from babel_4489_right_t2) +END +GO + +CREATE VIEW babel_4489_right_dep_view_1 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_t1 +GO + +CREATE VIEW babel_4489_right_dep_view_2 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_t2 +GO + +CREATE VIEW babel_4489_right_dep_view_3 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_t3 +GO + +CREATE VIEW babel_4489_right_dep_view_4 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_t4 +GO + +CREATE VIEW babel_4489_right_dep_view_5 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_t5 +GO + +CREATE VIEW babel_4489_right_dep_view_6 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_text +GO + +CREATE VIEW babel_4489_right_dep_view_7 AS + SELECT RIGHT(b, 5) as result FROM babel_4489_right_text +GO + +CREATE FUNCTION babel_4489_right_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT RIGHT(a, 5) as result from babel_4489_right_t2) +GO diff --git a/test/JDBC/expected/right-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/right-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..47d6111894f --- /dev/null +++ b/test/JDBC/expected/right-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,716 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(25) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT RIGHT(NULL, -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the right function.)~~ + + +SELECT RIGHT(NULL, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT RIGHT(NULL, 2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT RIGHT('abc', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT RIGHT(NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- edge case values for second parameter +SELECT RIGHT('AbdefGhi', -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the right function.)~~ + + +SELECT '|' + RIGHT('AbdefGhi', 0) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT RIGHT('AbdefGhi', 2) +GO +~~START~~ +varchar +hi +~~END~~ + + +SELECT RIGHT('AbdefGhi', 2147483646) +GO +~~START~~ +varchar +AbdefGhi +~~END~~ + + +SELECT RIGHT('AbdefGhi', 2147483650) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- input type char +DECLARE @inputString CHAR(15) = 'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 8) + '|' +GO +~~START~~ +varchar +|ghi?? | +~~END~~ + + +DECLARE @inputString CHAR(15) = '比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) + '|' +GO +~~START~~ +varchar +|·??? | +~~END~~ + + +DECLARE @inputString CHAR(15) = '比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|·??? | +~~END~~ + + +DECLARE @inputString CHAR(15) = 'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 50) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 5) +GO +~~START~~ +varchar +ghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +varchar +·??? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 50) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_ci_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_4489_right_chinese_prc_ci_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_cs_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_4489_right_chinese_prc_cs_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_ci_ai +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_4489_right_chinese_prc_ci_ai +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_ci_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE ARABIC_CI_AS FROM babel_4489_right_arabic_ci_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_cs_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE ARABIC_CS_AS FROM babel_4489_right_arabic_cs_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_ci_ai +GO +~~START~~ +varchar +تقين +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE ARABIC_CI_AI FROM babel_4489_right_arabic_ci_ai +GO +~~START~~ +varchar +تقين +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(15) = N'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 8) + '|' +GO +~~START~~ +nvarchar +|ghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(15) = N'比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) + '|' +GO +~~START~~ +nvarchar +|·??? | +~~END~~ + + +DECLARE @inputString NCHAR(15) = N'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 50) + '|' +GO +~~START~~ +nvarchar +|abc?defghi?? | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + RIGHT(a, 13) + '|' FROM babel_4489_right_t1 +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂 | +|·拉莫斯 | +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 5) +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +nvarchar +·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 50) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +varchar +efgh +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +varchar +efgh +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_right_dep_view +GO +~~START~~ +text +ghi?? +~~END~~ + + +EXEC babel_4489_right_dep_proc +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4489_right_dep_func() +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4489_right_itvf_func() +GO +~~START~~ +text +ghi?? +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_1 +GO +~~START~~ +text +?? + +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_2 +GO +~~START~~ +text +ghi?? +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_3 +GO +~~START~~ +text + +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_4 +GO +~~START~~ +text +i +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_5 +GO +~~START~~ +text +42020 +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_6 +GO +~~START~~ +text +ghi?? +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_7 +GO +~~START~~ +text +ghi?? +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_right_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT RIGHT(a, 3) FROM babel_4489_right_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of right function.)~~ + + +SELECT RIGHT(b, 3) FROM babel_4489_right_UDT +GO +~~START~~ +varchar +def +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +5.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +5.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +4FF +~~END~~ + + +SELECT RIGHT(a, 5) from babel_4489_right_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of right function.)~~ + + +-- input datatype text +SELECT RIGHT(a, 5) FROM babel_4489_right_text +GO +~~START~~ +varchar +ghi?? +~~END~~ + + +-- input datatype ntext +SELECT RIGHT(b, 5) FROM babel_4489_right_text +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar +4FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar +dy> +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar + 2) +~~END~~ + diff --git a/test/JDBC/expected/right-vu-cleanup.out b/test/JDBC/expected/right-vu-cleanup.out new file mode 100644 index 00000000000..f3aad52c027 --- /dev/null +++ b/test/JDBC/expected/right-vu-cleanup.out @@ -0,0 +1,80 @@ +DROP FUNCTION babel_4489_right_itvf_func +GO + +DROP FUNCTION babel_4489_right_dep_func +GO + +DROP PROCEDURE babel_4489_right_dep_proc +GO + +DROP VIEW babel_4489_right_dep_view +GO + +DROP TABLE babel_4489_right_UDT +GO + +DROP VIEW babel_4489_right_dep_view_1 +GO + +DROP VIEW babel_4489_right_dep_view_2 +GO + +DROP VIEW babel_4489_right_dep_view_3 +GO + +DROP VIEW babel_4489_right_dep_view_4 +GO + +DROP VIEW babel_4489_right_dep_view_5 +GO + +DROP VIEW babel_4489_right_dep_view_6 +GO + +DROP VIEW babel_4489_right_dep_view_7 +GO + +DROP TYPE dbo.babel_4489_right_varUDT +GO + +DROP TYPE dbo.babel_4489_right_imageUDT +GO + +DROP TABLE babel_4489_right_text +GO + +DROP TABLE babel_4489_right_image +GO + +DROP TABLE babel_4489_right_arabic_ci_ai +GO + +DROP TABLE babel_4489_right_arabic_cs_as +GO + +DROP TABLE babel_4489_right_arabic_ci_as +GO + +DROP TABLE babel_4489_right_chinese_prc_ci_ai +GO + +DROP TABLE babel_4489_right_chinese_prc_cs_as +GO + +DROP TABLE babel_4489_right_chinese_prc_ci_as +GO + +DROP TABLE babel_4489_right_t5 +GO + +DROP TABLE babel_4489_right_t4 +GO + +DROP TABLE babel_4489_right_t3 +GO + +DROP TABLE babel_4489_right_t2 +GO + +DROP TABLE babel_4489_right_t1 +GO diff --git a/test/JDBC/expected/right-vu-prepare.out b/test/JDBC/expected/right-vu-prepare.out new file mode 100644 index 00000000000..b352b44be5a --- /dev/null +++ b/test/JDBC/expected/right-vu-prepare.out @@ -0,0 +1,156 @@ +CREATE TABLE babel_4489_right_t1(a NCHAR(15)) +GO +INSERT INTO babel_4489_right_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_4489_right_t1 VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4489_right_t2 VALUES(N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_t3(a CHAR(50)) +GO +INSERT INTO babel_4489_right_t3 VALUES(' abcdefghi ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4489_right_t4 VALUES(' abcdefghi ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4489_right_t5 VALUES(0x2020616263642020) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4489_right_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4489_right_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4489_right_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4489_right_arabic_ci_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4489_right_arabic_cs_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4489_right_arabic_ci_ai VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_image(a IMAGE) +GO +INSERT INTO babel_4489_right_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_right_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4489_right_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TYPE dbo.babel_4489_right_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4489_right_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4489_right_UDT(a dbo.babel_4489_right_imageUDT, b dbo.babel_4489_right_varUDT) +GO +INSERT INTO babel_4489_right_UDT VALUES(CAST('abcdef' as dbo.babel_4489_right_imageUDT), CAST('abcdef' as dbo.babel_4489_right_varUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_4489_right_dep_view AS + SELECT RIGHT(a, 5) as result from babel_4489_right_t2 +GO + +CREATE PROCEDURE babel_4489_right_dep_proc AS + SELECT RIGHT(a, 5) as result from babel_4489_right_t2 +GO + +CREATE FUNCTION babel_4489_right_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 RIGHT(a, 5) from babel_4489_right_t2) +END +GO + +CREATE VIEW babel_4489_right_dep_view_1 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_t1 +GO + +CREATE VIEW babel_4489_right_dep_view_2 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_t2 +GO + +CREATE VIEW babel_4489_right_dep_view_3 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_t3 +GO + +CREATE VIEW babel_4489_right_dep_view_4 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_t4 +GO + +CREATE VIEW babel_4489_right_dep_view_5 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_t5 +GO + +CREATE VIEW babel_4489_right_dep_view_6 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_text +GO + +CREATE VIEW babel_4489_right_dep_view_7 AS + SELECT RIGHT(b, 5) as result FROM babel_4489_right_text +GO + +CREATE FUNCTION babel_4489_right_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT RIGHT(a, 5) as result from babel_4489_right_t2) +GO diff --git a/test/JDBC/expected/right-vu-verify.out b/test/JDBC/expected/right-vu-verify.out new file mode 100644 index 00000000000..8f10999211a --- /dev/null +++ b/test/JDBC/expected/right-vu-verify.out @@ -0,0 +1,716 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(25) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT RIGHT(NULL, -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the right function.)~~ + + +SELECT RIGHT(NULL, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT RIGHT(NULL, 2) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT RIGHT('abc', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT RIGHT(NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- edge case values for second parameter +SELECT RIGHT('AbdefGhi', -2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Invalid length parameter passed to the right function.)~~ + + +SELECT '|' + RIGHT('AbdefGhi', 0) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT RIGHT('AbdefGhi', 2) +GO +~~START~~ +varchar +hi +~~END~~ + + +SELECT RIGHT('AbdefGhi', 2147483646) +GO +~~START~~ +varchar +AbdefGhi +~~END~~ + + +SELECT RIGHT('AbdefGhi', 2147483650) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- input type char +DECLARE @inputString CHAR(15) = 'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 8) + '|' +GO +~~START~~ +varchar +|ghi?? | +~~END~~ + + +DECLARE @inputString CHAR(15) = '比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) + '|' +GO +~~START~~ +varchar +|·??? | +~~END~~ + + +DECLARE @inputString CHAR(15) = '比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|·??? | +~~END~~ + + +DECLARE @inputString CHAR(15) = 'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 50) + '|' +GO +~~START~~ +varchar +|abc?defghi?? | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 5) +GO +~~START~~ +varchar +ghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +varchar +·??? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 50) +GO +~~START~~ +varchar +abc?defghi?? +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_ci_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_4489_right_chinese_prc_ci_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_cs_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_4489_right_chinese_prc_cs_as +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_ci_ai +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_4489_right_chinese_prc_ci_ai +GO +~~START~~ +varchar +·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_ci_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE ARABIC_CI_AS FROM babel_4489_right_arabic_ci_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_cs_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE ARABIC_CS_AS FROM babel_4489_right_arabic_cs_as +GO +~~START~~ +varchar +تقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_ci_ai +GO +~~START~~ +varchar +تقين +~~END~~ + + +SELECT RIGHT(a, 4) COLLATE ARABIC_CI_AI FROM babel_4489_right_arabic_ci_ai +GO +~~START~~ +varchar +تقين +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(15) = N'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 8) + '|' +GO +~~START~~ +nvarchar +|ghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(15) = N'比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) + '|' +GO +~~START~~ +nvarchar +|·??? | +~~END~~ + + +DECLARE @inputString NCHAR(15) = N'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 50) + '|' +GO +~~START~~ +nvarchar +|abc?defghi?? | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + RIGHT(a, 13) + '|' FROM babel_4489_right_t1 +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂 | +|·拉莫斯 | +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 5) +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +nvarchar +·拉莫斯 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 50) +GO +~~START~~ +nvarchar +abc🙂defghi🙂🙂 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +varchar +efgh +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT RIGHT(@inputString, 4) +GO +~~START~~ +varchar +efgh +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_right_dep_view +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +EXEC babel_4489_right_dep_proc +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4489_right_dep_func() +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4489_right_itvf_func() +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_1 +GO +~~START~~ +nvarchar +🙂🙂 + +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_2 +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_3 +GO +~~START~~ +varchar + +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_4 +GO +~~START~~ +varchar +i +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_5 +GO +~~START~~ +varchar +bcd +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_6 +GO +~~START~~ +varchar +ghi?? +~~END~~ + + +SELECT * FROM babel_4489_right_dep_view_7 +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_right_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT RIGHT(a, 3) FROM babel_4489_right_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of right function.)~~ + + +SELECT RIGHT(b, 3) FROM babel_4489_right_UDT +GO +~~START~~ +varchar +def +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +5.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +5.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT RIGHT(@inputString, 3) +GO +~~START~~ +varchar +4FF +~~END~~ + + +SELECT RIGHT(a, 5) from babel_4489_right_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of right function.)~~ + + +-- input datatype text +SELECT RIGHT(a, 5) FROM babel_4489_right_text +GO +~~START~~ +varchar +ghi?? +~~END~~ + + +-- input datatype ntext +SELECT RIGHT(b, 5) FROM babel_4489_right_text +GO +~~START~~ +nvarchar +ghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT RIGHT(@inputString, 3) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of right function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar +4FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar +dy> +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO +~~START~~ +varchar + 2) +~~END~~ + diff --git a/test/JDBC/expected/rtrim-before-15_8-or-16_4-vu-cleanup.out b/test/JDBC/expected/rtrim-before-15_8-or-16_4-vu-cleanup.out new file mode 100644 index 00000000000..e9c3c566bdb --- /dev/null +++ b/test/JDBC/expected/rtrim-before-15_8-or-16_4-vu-cleanup.out @@ -0,0 +1,80 @@ +DROP FUNCTION babel_4489_rtrim_itvf_func +GO + +DROP FUNCTION babel_4489_rtrim_dep_func +GO + +DROP PROCEDURE babel_4489_rtrim_dep_proc +GO + +DROP VIEW babel_4489_rtrim_dep_view +GO + +DROP VIEW babel_4489_rtrim_dep_view_1 +GO + +DROP VIEW babel_4489_rtrim_dep_view_2 +GO + +DROP VIEW babel_4489_rtrim_dep_view_3 +GO + +DROP VIEW babel_4489_rtrim_dep_view_4 +GO + +DROP VIEW babel_4489_rtrim_dep_view_5 +GO + +DROP VIEW babel_4489_rtrim_dep_view_6 +GO + +DROP VIEW babel_4489_rtrim_dep_view_7 +GO + +DROP TABLE babel_4489_rtrim_UDT +GO + +DROP TYPE dbo.babel_4489_rtrim_varUDT +GO + +DROP TYPE dbo.babel_4489_rtrim_imageUDT +GO + +DROP TABLE babel_4489_rtrim_text +GO + +DROP TABLE babel_4489_rtrim_image +GO + +DROP TABLE babel_4489_rtrim_arabic_ci_ai +GO + +DROP TABLE babel_4489_rtrim_arabic_cs_as +GO + +DROP TABLE babel_4489_rtrim_arabic_ci_as +GO + +DROP TABLE babel_4489_rtrim_chinese_prc_ci_ai +GO + +DROP TABLE babel_4489_rtrim_chinese_prc_cs_as +GO + +DROP TABLE babel_4489_rtrim_chinese_prc_ci_as +GO + +DROP TABLE babel_4489_rtrim_t5 +GO + +DROP TABLE babel_4489_rtrim_t4 +GO + +DROP TABLE babel_4489_rtrim_t3 +GO + +DROP TABLE babel_4489_rtrim_t2 +GO + +DROP TABLE babel_4489_rtrim_t1 +GO diff --git a/test/JDBC/expected/rtrim-before-15_8-or-16_4-vu-prepare.out b/test/JDBC/expected/rtrim-before-15_8-or-16_4-vu-prepare.out new file mode 100644 index 00000000000..87af3cec2e7 --- /dev/null +++ b/test/JDBC/expected/rtrim-before-15_8-or-16_4-vu-prepare.out @@ -0,0 +1,156 @@ +CREATE TABLE babel_4489_rtrim_t1(a NCHAR(50)) +GO +INSERT INTO babel_4489_rtrim_t1 VALUES(N' abc🙂defghi🙂🙂 ') +INSERT INTO babel_4489_rtrim_t1 VALUES(N' 比尔·拉莫斯 ') +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4489_rtrim_t2 VALUES(N' abc🙂defghi🙂🙂 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_t3(a CHAR(50)) +GO +INSERT INTO babel_4489_rtrim_t3 VALUES(' abcdefghi ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4489_rtrim_t4 VALUES(' abcdefghi ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4489_rtrim_t5 VALUES(0x2020616263642020) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4489_rtrim_chinese_prc_ci_as VALUES(N' 比尔·拉莫斯 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4489_rtrim_chinese_prc_cs_as VALUES(N' 比尔·拉莫斯 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4489_rtrim_chinese_prc_ci_ai VALUES(N' 比尔·拉莫斯 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4489_rtrim_arabic_ci_as VALUES(N' الله مع المتقين ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4489_rtrim_arabic_cs_as VALUES(N' الله مع المتقين ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4489_rtrim_arabic_ci_ai VALUES(N' الله مع المتقين ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_image(a IMAGE) +GO +INSERT INTO babel_4489_rtrim_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4489_rtrim_text VALUES (N' abc🙂defghi🙂🙂 ', N' abc🙂defghi🙂🙂 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TYPE dbo.babel_4489_rtrim_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4489_rtrim_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4489_rtrim_UDT(a dbo.babel_4489_rtrim_imageUDT, b dbo.babel_4489_rtrim_varUDT) +GO +INSERT INTO babel_4489_rtrim_UDT VALUES(CAST('abcdef' as dbo.babel_4489_rtrim_imageUDT), CAST('abcdef' as dbo.babel_4489_rtrim_varUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_4489_rtrim_dep_view AS + SELECT ('|' + RTRIM(a) + '|') as result from babel_4489_rtrim_t2 +GO + +CREATE PROCEDURE babel_4489_rtrim_dep_proc AS + SELECT ('|' + RTRIM(a) + '|') as result from babel_4489_rtrim_t2 +GO + +CREATE FUNCTION babel_4489_rtrim_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 ('|' + RTRIM(a) + '|') FROM babel_4489_rtrim_t2) +END +GO + +CREATE VIEW babel_4489_rtrim_dep_view_1 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t1 +GO + +CREATE VIEW babel_4489_rtrim_dep_view_2 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t2 +GO + +CREATE VIEW babel_4489_rtrim_dep_view_3 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t3 +GO + +CREATE VIEW babel_4489_rtrim_dep_view_4 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t4 +GO + +CREATE VIEW babel_4489_rtrim_dep_view_5 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t5 +GO + +CREATE VIEW babel_4489_rtrim_dep_view_6 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_text +GO + +CREATE VIEW babel_4489_rtrim_dep_view_7 AS + SELECT ('|' + RTRIM(b) + '|') as result FROM babel_4489_rtrim_text +GO + +CREATE FUNCTION babel_4489_rtrim_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t2) +GO diff --git a/test/JDBC/expected/rtrim-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/rtrim-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..7c340544854 --- /dev/null +++ b/test/JDBC/expected/rtrim-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,610 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(50) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT RTRIM(NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| ??·???| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| ??·???| +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| ??·???| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_ci_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_rtrim_chinese_prc_ci_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_cs_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_rtrim_chinese_prc_cs_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_rtrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_rtrim_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_rtrim_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_rtrim_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| abc?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| ??·???| +~~END~~ + + +-- with table column of type nchar +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_t1 +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +| 比尔·拉莫斯| +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯| +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x202061626364656667682020 +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abcdefgh| +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x202061626364656667682020 +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abcdefgh| +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_rtrim_dep_view +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +EXEC babel_4489_rtrim_dep_proc +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_func() +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_itvf_func() +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_1 +GO +~~START~~ +varchar +| abc?defghi??| +| ??·???| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_2 +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_3 +GO +~~START~~ +varchar +| abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_4 +GO +~~START~~ +varchar +| abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_5 +GO +~~START~~ +varchar +|0x2020616263642020| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_6 +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_7 +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_rtrim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT RTRIM(a) FROM babel_4489_rtrim_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of rtrim function.)~~ + + +SELECT RTRIM(b) FROM babel_4489_rtrim_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12:10:05.1237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +123456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +SELECT RTRIM(a) from babel_4489_rtrim_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of rtrim function.)~~ + + +-- input datatype text +SELECT RTRIM(a) FROM babel_4489_rtrim_text +GO +~~START~~ +varchar + abc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT RTRIM(b) FROM babel_4489_rtrim_text +GO +~~START~~ +nvarchar + abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +POINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/rtrim-vu-cleanup.out b/test/JDBC/expected/rtrim-vu-cleanup.out new file mode 100644 index 00000000000..e9c3c566bdb --- /dev/null +++ b/test/JDBC/expected/rtrim-vu-cleanup.out @@ -0,0 +1,80 @@ +DROP FUNCTION babel_4489_rtrim_itvf_func +GO + +DROP FUNCTION babel_4489_rtrim_dep_func +GO + +DROP PROCEDURE babel_4489_rtrim_dep_proc +GO + +DROP VIEW babel_4489_rtrim_dep_view +GO + +DROP VIEW babel_4489_rtrim_dep_view_1 +GO + +DROP VIEW babel_4489_rtrim_dep_view_2 +GO + +DROP VIEW babel_4489_rtrim_dep_view_3 +GO + +DROP VIEW babel_4489_rtrim_dep_view_4 +GO + +DROP VIEW babel_4489_rtrim_dep_view_5 +GO + +DROP VIEW babel_4489_rtrim_dep_view_6 +GO + +DROP VIEW babel_4489_rtrim_dep_view_7 +GO + +DROP TABLE babel_4489_rtrim_UDT +GO + +DROP TYPE dbo.babel_4489_rtrim_varUDT +GO + +DROP TYPE dbo.babel_4489_rtrim_imageUDT +GO + +DROP TABLE babel_4489_rtrim_text +GO + +DROP TABLE babel_4489_rtrim_image +GO + +DROP TABLE babel_4489_rtrim_arabic_ci_ai +GO + +DROP TABLE babel_4489_rtrim_arabic_cs_as +GO + +DROP TABLE babel_4489_rtrim_arabic_ci_as +GO + +DROP TABLE babel_4489_rtrim_chinese_prc_ci_ai +GO + +DROP TABLE babel_4489_rtrim_chinese_prc_cs_as +GO + +DROP TABLE babel_4489_rtrim_chinese_prc_ci_as +GO + +DROP TABLE babel_4489_rtrim_t5 +GO + +DROP TABLE babel_4489_rtrim_t4 +GO + +DROP TABLE babel_4489_rtrim_t3 +GO + +DROP TABLE babel_4489_rtrim_t2 +GO + +DROP TABLE babel_4489_rtrim_t1 +GO diff --git a/test/JDBC/expected/rtrim-vu-prepare.out b/test/JDBC/expected/rtrim-vu-prepare.out new file mode 100644 index 00000000000..87af3cec2e7 --- /dev/null +++ b/test/JDBC/expected/rtrim-vu-prepare.out @@ -0,0 +1,156 @@ +CREATE TABLE babel_4489_rtrim_t1(a NCHAR(50)) +GO +INSERT INTO babel_4489_rtrim_t1 VALUES(N' abc🙂defghi🙂🙂 ') +INSERT INTO babel_4489_rtrim_t1 VALUES(N' 比尔·拉莫斯 ') +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4489_rtrim_t2 VALUES(N' abc🙂defghi🙂🙂 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_t3(a CHAR(50)) +GO +INSERT INTO babel_4489_rtrim_t3 VALUES(' abcdefghi ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4489_rtrim_t4 VALUES(' abcdefghi ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4489_rtrim_t5 VALUES(0x2020616263642020) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4489_rtrim_chinese_prc_ci_as VALUES(N' 比尔·拉莫斯 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4489_rtrim_chinese_prc_cs_as VALUES(N' 比尔·拉莫斯 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4489_rtrim_chinese_prc_ci_ai VALUES(N' 比尔·拉莫斯 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4489_rtrim_arabic_ci_as VALUES(N' الله مع المتقين ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4489_rtrim_arabic_cs_as VALUES(N' الله مع المتقين ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4489_rtrim_arabic_ci_ai VALUES(N' الله مع المتقين ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_image(a IMAGE) +GO +INSERT INTO babel_4489_rtrim_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_rtrim_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4489_rtrim_text VALUES (N' abc🙂defghi🙂🙂 ', N' abc🙂defghi🙂🙂 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TYPE dbo.babel_4489_rtrim_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4489_rtrim_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4489_rtrim_UDT(a dbo.babel_4489_rtrim_imageUDT, b dbo.babel_4489_rtrim_varUDT) +GO +INSERT INTO babel_4489_rtrim_UDT VALUES(CAST('abcdef' as dbo.babel_4489_rtrim_imageUDT), CAST('abcdef' as dbo.babel_4489_rtrim_varUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_4489_rtrim_dep_view AS + SELECT ('|' + RTRIM(a) + '|') as result from babel_4489_rtrim_t2 +GO + +CREATE PROCEDURE babel_4489_rtrim_dep_proc AS + SELECT ('|' + RTRIM(a) + '|') as result from babel_4489_rtrim_t2 +GO + +CREATE FUNCTION babel_4489_rtrim_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 ('|' + RTRIM(a) + '|') FROM babel_4489_rtrim_t2) +END +GO + +CREATE VIEW babel_4489_rtrim_dep_view_1 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t1 +GO + +CREATE VIEW babel_4489_rtrim_dep_view_2 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t2 +GO + +CREATE VIEW babel_4489_rtrim_dep_view_3 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t3 +GO + +CREATE VIEW babel_4489_rtrim_dep_view_4 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t4 +GO + +CREATE VIEW babel_4489_rtrim_dep_view_5 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t5 +GO + +CREATE VIEW babel_4489_rtrim_dep_view_6 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_text +GO + +CREATE VIEW babel_4489_rtrim_dep_view_7 AS + SELECT ('|' + RTRIM(b) + '|') as result FROM babel_4489_rtrim_text +GO + +CREATE FUNCTION babel_4489_rtrim_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t2) +GO diff --git a/test/JDBC/expected/rtrim-vu-verify.out b/test/JDBC/expected/rtrim-vu-verify.out new file mode 100644 index 00000000000..0a1d5f82034 --- /dev/null +++ b/test/JDBC/expected/rtrim-vu-verify.out @@ -0,0 +1,610 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(50) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT RTRIM(NULL) +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| ??·???| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| ??·???| +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| ??·???| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_ci_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_rtrim_chinese_prc_ci_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_cs_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_rtrim_chinese_prc_cs_as +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_rtrim_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 比尔·拉莫斯| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_rtrim_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_rtrim_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_rtrim_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقين| +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| abc?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| ??·???| +~~END~~ + + +-- with table column of type nchar +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_t1 +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +| 比尔·拉莫斯| +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯| +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x202061626364656667682020 +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abcdefgh| +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x202061626364656667682020 +SELECT '|' + RTRIM(@inputString) + '|' +GO +~~START~~ +varchar +| abcdefgh| +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_rtrim_dep_view +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +EXEC babel_4489_rtrim_dep_proc +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_func() +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_itvf_func() +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_1 +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +| 比尔·拉莫斯| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_2 +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_3 +GO +~~START~~ +varchar +| abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_4 +GO +~~START~~ +varchar +| abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_5 +GO +~~START~~ +varchar +| abcd| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_6 +GO +~~START~~ +varchar +| abc?defghi??| +~~END~~ + + +SELECT * FROM babel_4489_rtrim_dep_view_7 +GO +~~START~~ +nvarchar +| abc🙂defghi🙂🙂| +~~END~~ + + +-- input type UDT +-- -- in table babel_4489_rtrim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT RTRIM(a) FROM babel_4489_rtrim_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of rtrim function.)~~ + + +SELECT RTRIM(b) FROM babel_4489_rtrim_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 +~~END~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12:10:05.1237 +~~END~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @inputString decimal = 123456; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +123456 +~~END~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345 +~~END~~ + + +DECLARE @inputString float = 12345.1; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString real = 12345.1; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @inputString bigint = 12345678; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString int = 12345678; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12345678 +~~END~~ + + +DECLARE @inputString smallint = 12356; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12356 +~~END~~ + + +DECLARE @inputString tinyint = 235; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +235 +~~END~~ + + +DECLARE @inputString money = 12356; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +12356.0000 +~~END~~ + + +DECLARE @inputString bit = 1; +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT RTRIM(@inputString) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +SELECT RTRIM(a) from babel_4489_rtrim_image; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of rtrim function.)~~ + + +-- input datatype text +SELECT RTRIM(a) FROM babel_4489_rtrim_text +GO +~~START~~ +varchar + abc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT RTRIM(b) FROM babel_4489_rtrim_text +GO +~~START~~ +nvarchar + abc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT RTRIM(@inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of rtrim function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +POINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/space-vu-cleanup.out b/test/JDBC/expected/space-vu-cleanup.out new file mode 100644 index 00000000000..d6e4646bfd9 --- /dev/null +++ b/test/JDBC/expected/space-vu-cleanup.out @@ -0,0 +1,50 @@ +DROP FUNCTION babel_4811_vu_prepare_f1 +GO + +DROP FUNCTION babel_4811_vu_prepare_f2 +GO + +DROP FUNCTION babel_4811_vu_prepare_f3 +GO + +DROP PROCEDURE babel_4811_vu_prepare_p1 +GO + +DROP PROCEDURE babel_4811_vu_prepare_p2 +GO + +DROP VIEW babel_4811_vu_prepare_v1 +GO + +DROP VIEW babel_4811_vu_prepare_v2 +GO + +DROP VIEW babel_4811_vu_prepare_v3 +GO + +DROP VIEW babel_4811_vu_prepare_v4 +GO + +DROP VIEW babel_4811_vu_prepare_v5 +GO + +DROP VIEW babel_4811_vu_prepare_v6 +GO + +DROP VIEW babel_4811_vu_prepare_v7 +GO + +DROP VIEW babel_4811_vu_prepare_v8 +GO + +DROP VIEW babel_4811_vu_prepare_v9 +GO + +DROP TABLE babel_4811_vu_prepare_t1 +GO + +DROP TABLE babel_4811_vu_prepare_t2 +GO + +DROP TABLE babel_4811_vu_prepare_t3 +GO diff --git a/test/JDBC/expected/space-vu-prepare.out b/test/JDBC/expected/space-vu-prepare.out new file mode 100644 index 00000000000..5614773b026 --- /dev/null +++ b/test/JDBC/expected/space-vu-prepare.out @@ -0,0 +1,91 @@ +CREATE TABLE babel_4811_vu_prepare_t1(number int) +GO +INSERT INTO babel_4811_vu_prepare_t1 VALUES(5) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4811_vu_prepare_t2(number int) +GO +INSERT INTO babel_4811_vu_prepare_t2 VALUES(-10) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4811_vu_prepare_t3(number int) +GO +INSERT INTO babel_4811_vu_prepare_t3 VALUES(0) +GO +~~ROW COUNT: 1~~ + + +CREATE FUNCTION babel_4811_vu_prepare_f1(@number int) +returns int +BEGIN + RETURN DATALENGTH(SPACE(@number)) +END +GO + +CREATE FUNCTION babel_4811_vu_prepare_f2(@number int) +returns varchar(20) +BEGIN + RETURN '|' + SPACE(@number) + '|' +END +GO + +CREATE FUNCTION babel_4811_vu_prepare_f3() +returns table +AS + RETURN (select '|' + SPACE(number) + '|' as result from babel_4811_vu_prepare_t1) +GO + +CREATE PROCEDURE babel_4811_vu_prepare_p1 (@number AS INT) +AS +BEGIN +SELECT DATALENGTH(SPACE(@number)) +END; +GO + +CREATE PROCEDURE babel_4811_vu_prepare_p2 (@number AS INT) +AS +BEGIN +SELECT '|' + SPACE(@number) + '|' AS result +END; +GO + +CREATE VIEW babel_4811_vu_prepare_v1 AS +SELECT DATALENGTH(SPACE(10)) as result +GO + + +CREATE VIEW babel_4811_vu_prepare_v2 AS +SELECT DATALENGTH(SPACE(0)) as result +GO + +CREATE VIEW babel_4811_vu_prepare_v3 AS +SELECT DATALENGTH(SPACE(-10)) as result +GO + +CREATE VIEW babel_4811_vu_prepare_v4 AS + SELECT DATALENGTH(SPACE(number)) as result FROM babel_4811_vu_prepare_t1 +GO + +CREATE VIEW babel_4811_vu_prepare_v5 AS + SELECT DATALENGTH(SPACE(number)) as result FROM babel_4811_vu_prepare_t2 +GO + +CREATE VIEW babel_4811_vu_prepare_v6 AS + SELECT DATALENGTH(SPACE(number)) as result FROM babel_4811_vu_prepare_t3 +GO + +CREATE VIEW babel_4811_vu_prepare_v7 AS +SELECT '|' + SPACE(10) + '|' AS result +GO + +CREATE VIEW babel_4811_vu_prepare_v8 AS +SELECT '|' + SPACE(0) + '|' AS result +GO + +CREATE VIEW babel_4811_vu_prepare_v9 AS +SELECT '|' + SPACE(-10) + '|' AS result +GO diff --git a/test/JDBC/expected/space-vu-verify.out b/test/JDBC/expected/space-vu-verify.out new file mode 100644 index 00000000000..fb3d249950f --- /dev/null +++ b/test/JDBC/expected/space-vu-verify.out @@ -0,0 +1,283 @@ +-- test SPACE function +SELECT SPACE(NULL); +GO +~~START~~ +varchar + +~~END~~ + + +SELECT SPACE(2); +GO +~~START~~ +varchar + +~~END~~ + + +SELECT LEN(SPACE(5)); +GO +~~START~~ +int +0 +~~END~~ + + +SELECT DATALENGTH(SPACE(5)); +GO +~~START~~ +int +5 +~~END~~ + + +SELECT SPACE(-10); +GO +~~START~~ +varchar + +~~END~~ + + +SELECT SPACE(0); +GO +~~START~~ +varchar + +~~END~~ + + +SELECT LEN(SPACE(-10)); +GO +~~START~~ +int + +~~END~~ + + +SELECT DATALENGTH(SPACE(-10)); +GO +~~START~~ +int + +~~END~~ + + +SELECT LEN(SPACE(0)); +GO +~~START~~ +int +0 +~~END~~ + + +SELECT DATALENGTH(SPACE(0)); +GO +~~START~~ +int +0 +~~END~~ + + +-- INT_MAX +SELECT datalength(SPACE(2147483647)) +GO +~~START~~ +int +8000 +~~END~~ + + +-- INT_MAX/2 +SELECT datalength(SPACE(1073741823)) +GO +~~START~~ +int +8000 +~~END~~ + + +-- INT_MIN +SELECT datalength(SPACE(-2147483648)) +GO +~~START~~ +int + +~~END~~ + + +SELECT dbo.babel_4811_vu_prepare_f1(5); +GO +~~START~~ +int +5 +~~END~~ + + +SELECT dbo.babel_4811_vu_prepare_f1(-10); +GO +~~START~~ +int + +~~END~~ + + +SELECT dbo.babel_4811_vu_prepare_f1(0); +GO +~~START~~ +int +0 +~~END~~ + + +SELECT dbo.babel_4811_vu_prepare_f2(5); +GO +~~START~~ +varchar +| | +~~END~~ + + +SELECT dbo.babel_4811_vu_prepare_f2(-10); +GO +~~START~~ +varchar + +~~END~~ + + +SELECT dbo.babel_4811_vu_prepare_f2(0); +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT * from babel_4811_vu_prepare_f3(); +GO +~~START~~ +varchar +| | +~~END~~ + + +EXEC babel_4811_vu_prepare_p1 @number = 5; +GO +~~START~~ +int +5 +~~END~~ + + +EXEC babel_4811_vu_prepare_p1 @number = -10; +GO +~~START~~ +int + +~~END~~ + + +EXEC babel_4811_vu_prepare_p1 @number = 0; +GO +~~START~~ +int +0 +~~END~~ + + +EXEC babel_4811_vu_prepare_p2 @number = 5; +GO +~~START~~ +varchar +| | +~~END~~ + + +EXEC babel_4811_vu_prepare_p2 @number = -10; +GO +~~START~~ +varchar + +~~END~~ + + +EXEC babel_4811_vu_prepare_p2 @number = 0; +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT * from babel_4811_vu_prepare_v1; +GO +~~START~~ +int +10 +~~END~~ + + +SELECT * from babel_4811_vu_prepare_v2; +GO +~~START~~ +int +0 +~~END~~ + + +SELECT * from babel_4811_vu_prepare_v3; +GO +~~START~~ +int + +~~END~~ + + +SELECT * from babel_4811_vu_prepare_v4; +GO +~~START~~ +int +5 +~~END~~ + + +SELECT * from babel_4811_vu_prepare_v5; +GO +~~START~~ +int + +~~END~~ + + +SELECT * from babel_4811_vu_prepare_v6; +GO +~~START~~ +int +0 +~~END~~ + + +SELECT * from babel_4811_vu_prepare_v7; +GO +~~START~~ +varchar +| | +~~END~~ + + +SELECT * from babel_4811_vu_prepare_v8; +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT * from babel_4811_vu_prepare_v9; +GO +~~START~~ +varchar + +~~END~~ + diff --git a/test/JDBC/expected/string_agg-vu-cleanup.out b/test/JDBC/expected/string_agg-vu-cleanup.out new file mode 100644 index 00000000000..de3bb6c6e39 --- /dev/null +++ b/test/JDBC/expected/string_agg-vu-cleanup.out @@ -0,0 +1,44 @@ +DROP TRIGGER string_agg_tr_concat_student_names +GO + +DROP TABLE string_agg_school_details +GO + +DROP VIEW string_agg_dep_v3 +GO + +DROP PROCEDURE string_agg_dep_p3 +GO + +DROP FUNCTION string_agg_dep_f3 +GO + +DROP VIEW string_agg_dep_v2 +GO + +DROP PROCEDURE string_agg_dep_p2 +GO + +DROP FUNCTION string_agg_dep_f2 +GO + +DROP VIEW string_agg_dep_v1 +GO + +DROP PROCEDURE string_agg_dep_p1 +GO + +DROP FUNCTION string_agg_dep_f1 +GO + +DROP TABLE string_agg_multibyte_t +GO + +DROP TABLE string_agg_chinese_prc_ci_as +GO + +DROP TABLE string_agg_t2 +GO + +DROP TABLE string_agg_t +GO diff --git a/test/JDBC/expected/string_agg-vu-prepare.out b/test/JDBC/expected/string_agg-vu-prepare.out new file mode 100644 index 00000000000..b6b589e2884 --- /dev/null +++ b/test/JDBC/expected/string_agg-vu-prepare.out @@ -0,0 +1,133 @@ +CREATE TABLE string_agg_t (id int, a varchar(10), b varchar(10), g int, sbid int) +go + +INSERT INTO string_agg_t values +(3,'c','x',1,4), +(2,'b','y',2,6), +(2,'g','u',2,5), +(1,'a','z',1,7), +(5,'e','v',2,1), +(4,'d','w',1,3), +(4,'h','t',1,2), +(NULL,NULL,'s',2,NULL) +go +~~ROW COUNT: 8~~ + + +CREATE TABLE string_agg_t2 (id int, a varchar(10), g1 int, g2 int) +go + +INSERT INTO string_agg_t2 values +(1,'b',2,1), +(2,'g',2,1), +(3,'e',2,1), +(1,'a',1,2), +(2,'c',1,2), +(3,'d',1,2), +(4,'h',1,2), +(1,'d',3,1), +(2,'h',3,1) +go +~~ROW COUNT: 9~~ + + +CREATE TABLE string_agg_multibyte_t (id int, a nvarchar(10), g int, sbid int) +go +INSERT INTO string_agg_multibyte_t VALUES +(3,N'😎',1,4), +(2,N'莫',2,6), +(2,N'😇',2,5), +(1,N'尔',1,7), +(5,N'莫',2,1) +GO +~~ROW COUNT: 5~~ + + +CREATE TABLE string_agg_chinese_prc_ci_as(id int, a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS, g int, sbid int) +GO +INSERT INTO string_agg_chinese_prc_ci_as VALUES +(1,N'莫',1,5), +(2,N'尔',2,4), +(2,N'拉',2,3), +(3,N'比',1,2), +(5,N'斯',2,1) +GO +~~ROW COUNT: 5~~ + + +CREATE VIEW string_agg_dep_v1 AS + SELECT STRING_AGG (a, '-') as result FROM string_agg_t +GO + +CREATE PROCEDURE string_agg_dep_p1 AS + SELECT STRING_AGG (a, '-') FROM string_agg_t +GO + +CREATE FUNCTION string_agg_dep_f1() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT STRING_AGG (a, '-') FROM string_agg_t) +END +GO + +CREATE VIEW string_agg_dep_v2 AS + SELECT STRING_AGG (a, '-') as result FROM string_agg_t GROUP BY g +GO + +CREATE PROCEDURE string_agg_dep_p2 AS + SELECT STRING_AGG (a, '-') FROM string_agg_t GROUP BY g +GO + +CREATE FUNCTION string_agg_dep_f2() +RETURNS TABLE +AS +RETURN (SELECT STRING_AGG (a, '-') as result FROM string_agg_t GROUP BY g) +GO + +CREATE VIEW string_agg_dep_v3 AS + SELECT STRING_AGG (a, '-') WITHIN GROUP (ORDER BY sbid) as result FROM string_agg_t GROUP BY g +GO + +CREATE PROCEDURE string_agg_dep_p3 AS + SELECT STRING_AGG (a, '-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g +GO + +CREATE FUNCTION string_agg_dep_f3() +RETURNS TABLE +AS +RETURN (SELECT STRING_AGG (a, '-') WITHIN GROUP (ORDER BY sbid) as result FROM string_agg_t GROUP BY g) +GO + +-- Create a table to test the trigger +CREATE TABLE string_agg_school_details ( + classID INT, + rollID INT, + studentName VARCHAR(50) +); +GO + +INSERT INTO string_agg_school_details (classID, rollID, studentName) +VALUES + (1, 2, 'StudentB'), + (1, 1, 'StudentA'), + (1, 3, 'StudentC'), + (2, 2, 'StudentE'), + (2, 1, 'StudentD') +GO +~~ROW COUNT: 5~~ + + +-- Create a trigger to display classID, list of student names seperated by ', ' +CREATE TRIGGER string_agg_tr_concat_student_names +ON string_agg_school_details +AFTER INSERT, UPDATE, DELETE +AS +BEGIN + SELECT classID, STRING_AGG(studentName, ', ') + WITHIN GROUP (ORDER BY rollID) + FROM string_agg_school_details + GROUP BY classID + ORDER BY classID; +END; +GO diff --git a/test/JDBC/expected/string_agg-vu-verify.out b/test/JDBC/expected/string_agg-vu-verify.out new file mode 100644 index 00000000000..a7ab6809426 --- /dev/null +++ b/test/JDBC/expected/string_agg-vu-verify.out @@ -0,0 +1,696 @@ +-- expression as column +SELECT STRING_AGG(a,'-') FROM string_agg_t +GO +~~START~~ +text +c-b-g-a-e-d-h +~~END~~ + + +SELECT STRING_AGG(a,'-') FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +c-a-d-h +b-g-e +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +h-d-c-a +e-g-b +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +h-d-c-a +e-g-b +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +a-c-d-h +b-g-e +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +a-c-h-d +g-b-e +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +a-c-d-h +b-g-e +~~END~~ + + +-- expression as expression of multiple columns +SELECT STRING_AGG(a+b,'-') FROM string_agg_t +GO +~~START~~ +text +cx-by-gu-az-ev-dw-ht +~~END~~ + + +SELECT STRING_AGG(a+b,'-') FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +cx-az-dw-ht +by-gu-ev +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +ht-dw-cx-az +ev-gu-by +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +ht-dw-cx-az +ev-gu-by +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-dw-ht +by-gu-ev +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-ht-dw +gu-by-ev +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-dw-ht +by-gu-ev +~~END~~ + + +-- expression as function +SELECT STRING_AGG(concat(a,b),'-') FROM string_agg_t +GO +~~START~~ +text +cx-by-gu-az-ev-dw-ht-s +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +cx-az-dw-ht +by-gu-ev-s +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +ht-dw-cx-az +s-ev-gu-by +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +ht-dw-cx-az +s-ev-gu-by +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-dw-ht +by-gu-ev-s +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-ht-dw +s-gu-by-ev +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-dw-ht +s-by-gu-ev +~~END~~ + + +-- Delimeter as a function +SELECT STRING_AGG(a, char(10)) FROM string_agg_t +GO +~~START~~ +text +cbgaedh +~~END~~ + + +SELECT STRING_AGG(a, char(10)) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +cadh +bge +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +hdca +egb +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +hdca +egb +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +acdh +bge +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +achd +gbe +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +acdh +bge +~~END~~ + + +-- order by clause on string column +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY a ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +a-c-d-h +b-e-g +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY a DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +h-d-c-a +g-e-b +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY a+b ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-dw-ht +by-ev-gu +~~END~~ + + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY a+b DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +ht-dw-cx-az +gu-ev-by +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY concat(a,b) ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +az-cx-dw-ht +by-ev-gu-s +~~END~~ + + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY concat(a,b) DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +ht-dw-cx-az +s-gu-ev-by +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY a ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +acdh +beg +~~END~~ + + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY a DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +hdca +geb +~~END~~ + + +-- Batch statements +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g ORDER BY g +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO +~~START~~ +text +hdca +egb +~~END~~ + +~~START~~ +text +hdca +egb +~~END~~ + +~~START~~ +text +acdh +bge +~~END~~ + +~~START~~ +text +achd +gbe +~~END~~ + +~~START~~ +text +acdh +bge +~~END~~ + + +-- expression as column with multibyte characters +SELECT STRING_AGG(a,'-') FROM string_agg_multibyte_t +GO +~~START~~ +text +?-?-?-?-? +~~END~~ + + +SELECT STRING_AGG(a,'-') FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +text +?-? +?-?-? +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +text +?-? +?-?-? +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +text +?-? +?-?-? +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +text +?-? +?-?-? +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +text +?-? +?-?-? +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +text +?-? +?-?-? +~~END~~ + + +-- casting result to NVARCHAR to verify the output +SELECT CAST(STRING_AGG(a,'-') AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t +GO +~~START~~ +nvarchar +😎-莫-😇-尔-莫 +~~END~~ + + +SELECT CAST(STRING_AGG(a,'-') AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +nvarchar +😎-尔 +莫-😇-莫 +~~END~~ + + +SELECT CAST(STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid) AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +nvarchar +😎-尔 +莫-😇-莫 +~~END~~ + + +SELECT CAST(STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid ASC) AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +nvarchar +😎-尔 +莫-😇-莫 +~~END~~ + + +SELECT CAST(STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid DESC) AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +nvarchar +尔-😎 +莫-😇-莫 +~~END~~ + + +SELECT CAST(STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid ASC) AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +nvarchar +尔-😎 +😇-莫-莫 +~~END~~ + + +SELECT CAST(STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid DESC) AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO +~~START~~ +nvarchar +尔-😎 +莫-😇-莫 +~~END~~ + + +-- expression as column with chinese characters +SELECT STRING_AGG(a,'-') FROM string_agg_chinese_prc_ci_as +GO +~~START~~ +text +莫-尔-拉-比-斯 +~~END~~ + + +SELECT STRING_AGG(a,'-') FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO +~~START~~ +text +莫-比 +尔-拉-斯 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO +~~START~~ +text +比-莫 +斯-拉-尔 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO +~~START~~ +text +比-莫 +斯-拉-尔 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO +~~START~~ +text +莫-比 +尔-拉-斯 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO +~~START~~ +text +莫-比 +拉-尔-斯 +~~END~~ + + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO +~~START~~ +text +莫-比 +尔-拉-斯 +~~END~~ + + +-- expression from a column of a subquery +SELECT STRING_AGG(sbq.b,'-') WITHIN GROUP (ORDER BY g1) FROM (SELECT g1, g2, STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id) as 'b' FROM string_agg_t2 GROUP BY g1, g2) as sbq GROUP BY g2 ORDER BY g2 +GO +~~START~~ +text +b-g-e-d-h +a-c-d-h +~~END~~ + + +SELECT STRING_AGG(sbq.b,'-') WITHIN GROUP (ORDER BY g1 ASC) FROM (SELECT g1, g2, STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id ASC) as 'b' FROM string_agg_t2 GROUP BY g1, g2) as sbq GROUP BY g2 ORDER BY g2 +GO +~~START~~ +text +b-g-e-d-h +a-c-d-h +~~END~~ + + +SELECT STRING_AGG(sbq.b,'-') WITHIN GROUP (ORDER BY g1 DESC) FROM (SELECT g1, g2, STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id DESC) as 'b' FROM string_agg_t2 GROUP BY g1, g2) as sbq GROUP BY g2 ORDER BY g2 +GO +~~START~~ +text +h-d-e-g-b +h-d-c-a +~~END~~ + + +-- Dependent objects +SELECT * FROM string_agg_dep_v1 +GO +~~START~~ +text +c-b-g-a-e-d-h +~~END~~ + + +EXEC string_agg_dep_p1 +GO +~~START~~ +text +c-b-g-a-e-d-h +~~END~~ + + +SELECT dbo.string_agg_dep_f1() +GO +~~START~~ +nvarchar +c-b-g-a-e-d-h +~~END~~ + + +SELECT * FROM string_agg_dep_v2 +GO +~~START~~ +text +b-g-e +c-a-d-h +~~END~~ + + +EXEC string_agg_dep_p2 +GO +~~START~~ +text +b-g-e +c-a-d-h +~~END~~ + + +SELECT * FROM dbo.string_agg_dep_f2() +GO +~~START~~ +text +b-g-e +c-a-d-h +~~END~~ + + +SELECT * FROM string_agg_dep_v3 +GO +~~START~~ +text +h-d-c-a +e-g-b +~~END~~ + + +EXEC string_agg_dep_p3 +GO +~~START~~ +text +h-d-c-a +e-g-b +~~END~~ + + +SELECT * FROM dbo.string_agg_dep_f3() +GO +~~START~~ +text +h-d-c-a +e-g-b +~~END~~ + + +-- dependent object trigger +INSERT INTO string_agg_school_details (classID, rollID, studentName) +VALUES (2, 3, 'StudentF'); +GO +~~START~~ +int#!#text +1#!#StudentA, StudentB, StudentC +2#!#StudentD, StudentE, StudentF +~~END~~ + +~~ROW COUNT: 1~~ + + +UPDATE string_agg_school_details +SET studentName = 'StudentG' +WHERE classID = 2 AND rollID = 3; +GO +~~START~~ +int#!#text +1#!#StudentA, StudentB, StudentC +2#!#StudentD, StudentE, StudentG +~~END~~ + +~~ROW COUNT: 1~~ + + +DELETE FROM string_agg_school_details +WHERE classID = 1 AND rollID = 2; +GO +~~START~~ +int#!#text +1#!#StudentA, StudentC +2#!#StudentD, StudentE, StudentG +~~END~~ + +~~ROW COUNT: 1~~ + diff --git a/test/JDBC/expected/stuff-before-15_8-or-16_4-vu-cleanup.out b/test/JDBC/expected/stuff-before-15_8-or-16_4-vu-cleanup.out new file mode 100644 index 00000000000..7a86f289238 --- /dev/null +++ b/test/JDBC/expected/stuff-before-15_8-or-16_4-vu-cleanup.out @@ -0,0 +1,74 @@ +DROP FUNCTION babel_4838_stuff_itvf_func +GO + +DROP FUNCTION babel_4838_stuff_dep_func +GO + +DROP PROCEDURE babel_4838_stuff_dep_proc +GO + +DROP VIEW babel_4838_stuff_dep_view +GO + +DROP TABLE babel_4838_stuff_UDT +GO + +DROP VIEW babel_4838_stuff_dep_view_1 +GO + +DROP VIEW babel_4838_stuff_dep_view_2 +GO + +DROP VIEW babel_4838_stuff_dep_view_3 +GO + +DROP VIEW babel_4838_stuff_dep_view_4 +GO + +DROP VIEW babel_4838_stuff_dep_view_5 +GO + +DROP TYPE dbo.babel_4838_stuff_varUDT +GO + +DROP TYPE dbo.babel_4838_stuff_imageUDT +GO + +DROP TABLE babel_4838_stuff_text +GO + +DROP TABLE babel_4838_stuff_image +GO + +DROP TABLE babel_4838_stuff_arabic_ci_ai +GO + +DROP TABLE babel_4838_stuff_arabic_cs_as +GO + +DROP TABLE babel_4838_stuff_arabic_ci_as +GO + +DROP TABLE babel_4838_stuff_chinese_prc_ci_ai +GO + +DROP TABLE babel_4838_stuff_chinese_prc_cs_as +GO + +DROP TABLE babel_4838_stuff_chinese_prc_ci_as +GO + +DROP TABLE babel_4838_stuff_t5 +GO + +DROP TABLE babel_4838_stuff_t4 +GO + +DROP TABLE babel_4838_stuff_t3 +GO + +DROP TABLE babel_4838_stuff_t2 +GO + +DROP TABLE babel_4838_stuff_t1 +GO diff --git a/test/JDBC/expected/stuff-before-15_8-or-16_4-vu-prepare.out b/test/JDBC/expected/stuff-before-15_8-or-16_4-vu-prepare.out new file mode 100644 index 00000000000..eb20ce5f6bf --- /dev/null +++ b/test/JDBC/expected/stuff-before-15_8-or-16_4-vu-prepare.out @@ -0,0 +1,148 @@ +CREATE TABLE babel_4838_stuff_t1(a NCHAR(50)) +GO +INSERT INTO babel_4838_stuff_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_4838_stuff_t1 VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4838_stuff_t2 VALUES(N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_t3(a CHAR(50)) +GO +INSERT INTO babel_4838_stuff_t3 VALUES('abcdefghi') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4838_stuff_t4 VALUES('abcdefghi') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4838_stuff_t5 VALUES(0x2020616263642020) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4838_stuff_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4838_stuff_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4838_stuff_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4838_stuff_arabic_ci_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4838_stuff_arabic_cs_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4838_stuff_arabic_ci_ai VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_image(a IMAGE) +GO +INSERT INTO babel_4838_stuff_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4838_stuff_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TYPE dbo.babel_4838_stuff_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4838_stuff_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4838_stuff_UDT(a dbo.babel_4838_stuff_imageUDT, b dbo.babel_4838_stuff_varUDT) +GO +INSERT INTO babel_4838_stuff_UDT VALUES(CAST('abcdef' as dbo.babel_4838_stuff_imageUDT), CAST('abcdef' as dbo.babel_4838_stuff_varUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_4838_stuff_dep_view AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result from babel_4838_stuff_t2 +GO + +CREATE PROCEDURE babel_4838_stuff_dep_proc AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result from babel_4838_stuff_t2 +GO + +CREATE FUNCTION babel_4838_stuff_dep_func() +RETURNS NVARCHAR(200) +AS +BEGIN +RETURN (SELECT TOP 1 stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') from babel_4838_stuff_t2) +END +GO + +CREATE VIEW babel_4838_stuff_dep_view_1 AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result FROM babel_4838_stuff_t1 +GO + +CREATE VIEW babel_4838_stuff_dep_view_2 AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result FROM babel_4838_stuff_t2 +GO + +CREATE VIEW babel_4838_stuff_dep_view_3 AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result FROM babel_4838_stuff_t3 +GO + +CREATE VIEW babel_4838_stuff_dep_view_4 AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result FROM babel_4838_stuff_t4 +GO + +CREATE VIEW babel_4838_stuff_dep_view_5 AS + SELECT stuff(a, 4, 2, 0x6566) as result FROM babel_4838_stuff_t5 +GO + +CREATE FUNCTION babel_4838_stuff_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result from babel_4838_stuff_t2) +GO diff --git a/test/JDBC/expected/stuff-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/stuff-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..154ac0c45b2 --- /dev/null +++ b/test/JDBC/expected/stuff-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,2691 @@ +-- NULL +SELECT stuff(NULL, 2, 1, 'ab') +GO +~~START~~ +varchar + +~~END~~ + +SELECT stuff('ab', 2, 1, NULL) +GO +~~START~~ +varchar +a +~~END~~ + +SELECT stuff('ab', NULL, 1, 'bc') +GO +~~START~~ +varchar + +~~END~~ + +SELECT stuff('ab', 2, NULL, 'bc') +GO +~~START~~ +varchar + +~~END~~ + +SELECT stuff('ab', NULL, '1', 'bc') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('ab', '2', NULL, 'bc') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('ab', NULL, NULL, 'bc') +GO +~~START~~ +varchar + +~~END~~ + + +-- Different no. of arguments +SELECT stuff('abc', 1, 2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The stuff function requires 4 arguments)~~ + + +SELECT stuff('abc', 1, 1, 'xy', 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The stuff function requires 4 arguments)~~ + + +-- edge case values for second parameter +SELECT stuff('AbdefGhi', 0, 1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT '|' + stuff('AbdefGhi', -1, 1, 'xy') + '|' +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 1, 1, 'xy') +GO +~~START~~ +varchar +xybdefGhi +~~END~~ + + +SELECT stuff('AbdefGhi', 8, 1, 'xy') +GO +~~START~~ +varchar +AbdefGhxy +~~END~~ + + +SELECT stuff('AbdefGhi', 9, 1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 2147483648, 1, 'xy') +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- edge case values for third parameter +SELECT stuff('AbdefGhi', 1, 0, 'xy') +GO +~~START~~ +varchar +xyAbdefGhi +~~END~~ + + +SELECT stuff('AbdefGhi', 8, 0, 'xy') +GO +~~START~~ +varchar +AbdefGhxyi +~~END~~ + + +SELECT stuff('AbdefGhi', 1, -1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 8, -1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 2, 9, 'xy') +GO +~~START~~ +varchar +Axy +~~END~~ + + +SELECT stuff('AbdefGhi', 2, 2147483648, 'xy') +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +axyz??wuytgdy? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +??·?·? ? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +??·?·? ? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +??·拉·比? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +??·?·?? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +??·ef? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +??·ef? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varchar +??·?·?? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +varchar +??·? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +??·?·? ? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·?·? ? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·拉·比? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +??·拉·比? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +??·ef? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +??·ef? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +??·拉·比? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +?拉·比 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi🙂🙂 +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +SELECT stuff('abc🙂defghi🙂🙂', 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +axyz??wuytgdy? +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +??·?·? ? +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·?·? 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +??·?·?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +??·ef? +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +??·ef? +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varchar +??·?·?? +~~END~~ + +SELECT stuff('比尔·拉莫斯', 4, 2, '拉·比') +GO +~~START~~ +varchar +??·?·?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +varchar +??·? +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·?·? 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·?·? 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +SELECT stuff('比尔·拉莫斯', 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比拉·比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CI_AS FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CS_AS FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CS_AS FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CI_AI FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AI FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CI_AS FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CI_AS FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CS_AS FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CS_AS FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CI_AI FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CI_AI FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +axyz🙂🙂wuytgdy🙂 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +??·?·? ? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +??·?·? ? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +??·拉·比? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +??·拉·比? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +??·ef? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +??·ef? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +nvarchar +??·拉·比? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +nvarchar +?拉·比 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·?·? ? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·?·? ? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·拉·比? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·拉·比? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·ef? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·ef? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·拉·比? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +?拉·比 +~~END~~ + + +-- with table column of type nchar +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_t1 +GO +~~START~~ +nvarchar +abcabc🙂defghi🙂🙂 efghi🙂🙂 +比尔·比尔·拉莫斯 斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +axyz🙂🙂wuytgdy🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·?·? 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·?·? 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +nvarchar +比拉·比 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·?·? 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·?·? 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比拉·比 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, 0x6566) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varbinary +6162633FB73F666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: collations are not supported by type varbinary)~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 0, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 13, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, -1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, 15, 0x6566) +GO +~~START~~ +varbinary +616566 +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, 0x6566) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varbinary +6162633FB73F666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: collations are not supported by type varbinary)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 0, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 13, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, -1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, 15, 0x6566) +GO +~~START~~ +varbinary +616566 +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4838_stuff_dep_view +GO +~~START~~ +text +abcxyz??wuytgdy?efghi?? +~~END~~ + + +EXEC babel_4838_stuff_dep_proc +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_func() +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4838_stuff_itvf_func() +GO +~~START~~ +text +abcxyz??wuytgdy?efghi?? +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_1 +GO +~~START~~ +text +abcxyz??wuytgdy?efghi?? +??·xyz??wuytgdy?? +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_2 +GO +~~START~~ +text +abcxyz??wuytgdy?efghi?? +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_3 +GO +~~START~~ +text +abcxyz??wuytgdy?fghi +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_4 +GO +~~START~~ +text +abcxyz??wuytgdy?fghi +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_5 +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: return type mismatch in function declared to return varbinary)~~ + + +-- input type UDT +-- in table babel_4838_stuff_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_UDT +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of stuff function.)~~ + + +SELECT stuff(b, 4, 2, b) FROM babel_4838_stuff_UDT +GO +~~START~~ +varchar +abcabcdeff +~~END~~ + + +-- other different datatypes, should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 4 of stuff function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of stuff function.)~~ + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of stuff function.)~~ + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of stuff function.)~~ + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString decimal = 123456; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString decimal = 123456; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString decimal = 123456; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString decimal = 123456; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString numeric = 12345.12; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString numeric = 12345.12; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString numeric = 12345.12; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString float = 12345.1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString float = 12345.1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString float = 12345.1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString float = 12345.1; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString real = 12345.1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString real = 12345.1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString real = 12345.1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString real = 12345.1; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString bigint = 12345678; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString bigint = 12345678; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString bigint = 12345678; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString bigint = 12345678; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString int = 12345678; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString int = 12345678; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 4 of stuff function.)~~ + +DECLARE @inputString int = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar +abcdysd +~~END~~ + +DECLARE @inputString int = 12345678; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString CHAR(25) = 'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bpchar is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString CHAR(25) = 'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bpchar is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString VARCHAR(25) = 'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString VARCHAR(25) = 'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 3 of stuff function.)~~ + + +DECLARE @inputString smallint = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString smallint = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 4 of stuff function.)~~ + +DECLARE @inputString smallint = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar +abcdysd +~~END~~ + +DECLARE @inputString smallint = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString NCHAR(25) = N'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "nchar" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString NCHAR(25) = N'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "nchar" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString NVARCHAR(25) = N'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type nvarchar is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString NVARCHAR(25) = N'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type nvarchar is invalid for argument 3 of stuff function.)~~ + + +DECLARE @inputString tinyint = 235; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString tinyint = 235; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 4 of stuff function.)~~ + +DECLARE @inputString tinyint = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar +abcdysd +~~END~~ + +DECLARE @inputString tinyint = 235; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 3 of stuff function.)~~ + + +DECLARE @inputString money = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString money = 12356; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString money = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString money = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString smallmoney = 12356; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString smallmoney = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString smallmoney = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString bit = 1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString bit = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString bit = 1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString bit = 1; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 4 of stuff function.)~~ + + +SELECT stuff(a, 4, 2, 'abcd') from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of stuff function.)~~ + +SELECT stuff('abcd', a, 2, 'abcd') from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('abcd', 4, a, 'abcd') from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('abcd', 4, 2, a) from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 4 of stuff function.)~~ + + +-- input datatype text +SELECT stuff(a, 4, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~START~~ +varchar +abcabcdefghi?? +~~END~~ + +SELECT stuff('abcd', a, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('abcd', 4, a, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('abcd', 4, 2, a) FROM babel_4838_stuff_text +GO +~~START~~ +varchar +abcabc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT stuff(b, 4, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~START~~ +nvarchar +abcabcdefghi🙂🙂 +~~END~~ + +SELECT stuff('abcd', b, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type ntext is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('abcd', 4, b, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type ntext is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('abcd', 4, 2, b) FROM babel_4838_stuff_text +GO +~~START~~ +nvarchar +abcabc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +~~START~~ +varchar +6F9abcd19FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +abc6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +abc +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +~~START~~ +varchar +POIabcdT(1 2) +~~END~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +abcPOINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/stuff-vu-cleanup.out b/test/JDBC/expected/stuff-vu-cleanup.out new file mode 100644 index 00000000000..7a86f289238 --- /dev/null +++ b/test/JDBC/expected/stuff-vu-cleanup.out @@ -0,0 +1,74 @@ +DROP FUNCTION babel_4838_stuff_itvf_func +GO + +DROP FUNCTION babel_4838_stuff_dep_func +GO + +DROP PROCEDURE babel_4838_stuff_dep_proc +GO + +DROP VIEW babel_4838_stuff_dep_view +GO + +DROP TABLE babel_4838_stuff_UDT +GO + +DROP VIEW babel_4838_stuff_dep_view_1 +GO + +DROP VIEW babel_4838_stuff_dep_view_2 +GO + +DROP VIEW babel_4838_stuff_dep_view_3 +GO + +DROP VIEW babel_4838_stuff_dep_view_4 +GO + +DROP VIEW babel_4838_stuff_dep_view_5 +GO + +DROP TYPE dbo.babel_4838_stuff_varUDT +GO + +DROP TYPE dbo.babel_4838_stuff_imageUDT +GO + +DROP TABLE babel_4838_stuff_text +GO + +DROP TABLE babel_4838_stuff_image +GO + +DROP TABLE babel_4838_stuff_arabic_ci_ai +GO + +DROP TABLE babel_4838_stuff_arabic_cs_as +GO + +DROP TABLE babel_4838_stuff_arabic_ci_as +GO + +DROP TABLE babel_4838_stuff_chinese_prc_ci_ai +GO + +DROP TABLE babel_4838_stuff_chinese_prc_cs_as +GO + +DROP TABLE babel_4838_stuff_chinese_prc_ci_as +GO + +DROP TABLE babel_4838_stuff_t5 +GO + +DROP TABLE babel_4838_stuff_t4 +GO + +DROP TABLE babel_4838_stuff_t3 +GO + +DROP TABLE babel_4838_stuff_t2 +GO + +DROP TABLE babel_4838_stuff_t1 +GO diff --git a/test/JDBC/expected/stuff-vu-prepare.out b/test/JDBC/expected/stuff-vu-prepare.out new file mode 100644 index 00000000000..eb20ce5f6bf --- /dev/null +++ b/test/JDBC/expected/stuff-vu-prepare.out @@ -0,0 +1,148 @@ +CREATE TABLE babel_4838_stuff_t1(a NCHAR(50)) +GO +INSERT INTO babel_4838_stuff_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_4838_stuff_t1 VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4838_stuff_t2 VALUES(N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_t3(a CHAR(50)) +GO +INSERT INTO babel_4838_stuff_t3 VALUES('abcdefghi') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4838_stuff_t4 VALUES('abcdefghi') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4838_stuff_t5 VALUES(0x2020616263642020) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4838_stuff_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4838_stuff_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4838_stuff_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4838_stuff_arabic_ci_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4838_stuff_arabic_cs_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4838_stuff_arabic_ci_ai VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_image(a IMAGE) +GO +INSERT INTO babel_4838_stuff_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4838_stuff_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4838_stuff_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TYPE dbo.babel_4838_stuff_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4838_stuff_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4838_stuff_UDT(a dbo.babel_4838_stuff_imageUDT, b dbo.babel_4838_stuff_varUDT) +GO +INSERT INTO babel_4838_stuff_UDT VALUES(CAST('abcdef' as dbo.babel_4838_stuff_imageUDT), CAST('abcdef' as dbo.babel_4838_stuff_varUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_4838_stuff_dep_view AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result from babel_4838_stuff_t2 +GO + +CREATE PROCEDURE babel_4838_stuff_dep_proc AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result from babel_4838_stuff_t2 +GO + +CREATE FUNCTION babel_4838_stuff_dep_func() +RETURNS NVARCHAR(200) +AS +BEGIN +RETURN (SELECT TOP 1 stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') from babel_4838_stuff_t2) +END +GO + +CREATE VIEW babel_4838_stuff_dep_view_1 AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result FROM babel_4838_stuff_t1 +GO + +CREATE VIEW babel_4838_stuff_dep_view_2 AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result FROM babel_4838_stuff_t2 +GO + +CREATE VIEW babel_4838_stuff_dep_view_3 AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result FROM babel_4838_stuff_t3 +GO + +CREATE VIEW babel_4838_stuff_dep_view_4 AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result FROM babel_4838_stuff_t4 +GO + +CREATE VIEW babel_4838_stuff_dep_view_5 AS + SELECT stuff(a, 4, 2, 0x6566) as result FROM babel_4838_stuff_t5 +GO + +CREATE FUNCTION babel_4838_stuff_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result from babel_4838_stuff_t2) +GO diff --git a/test/JDBC/expected/stuff-vu-verify.out b/test/JDBC/expected/stuff-vu-verify.out new file mode 100644 index 00000000000..0be2102e056 --- /dev/null +++ b/test/JDBC/expected/stuff-vu-verify.out @@ -0,0 +1,2692 @@ +-- NULL +SELECT stuff(NULL, 2, 1, 'ab') +GO +~~START~~ +varchar + +~~END~~ + +SELECT stuff('ab', 2, 1, NULL) +GO +~~START~~ +varchar +a +~~END~~ + +SELECT stuff('ab', NULL, 1, 'bc') +GO +~~START~~ +varchar + +~~END~~ + +SELECT stuff('ab', 2, NULL, 'bc') +GO +~~START~~ +varchar + +~~END~~ + +SELECT stuff('ab', NULL, '1', 'bc') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('ab', '2', NULL, 'bc') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('ab', NULL, NULL, 'bc') +GO +~~START~~ +varchar + +~~END~~ + + +-- Different no. of arguments +SELECT stuff('abc', 1, 2) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The stuff function requires 4 arguments)~~ + + +SELECT stuff('abc', 1, 1, 'xy', 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The stuff function requires 4 arguments)~~ + + +-- edge case values for second parameter +SELECT stuff('AbdefGhi', 0, 1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT '|' + stuff('AbdefGhi', -1, 1, 'xy') + '|' +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 1, 1, 'xy') +GO +~~START~~ +varchar +xybdefGhi +~~END~~ + + +SELECT stuff('AbdefGhi', 8, 1, 'xy') +GO +~~START~~ +varchar +AbdefGhxy +~~END~~ + + +SELECT stuff('AbdefGhi', 9, 1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 2147483648, 1, 'xy') +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- edge case values for third parameter +SELECT stuff('AbdefGhi', 1, 0, 'xy') +GO +~~START~~ +varchar +xyAbdefGhi +~~END~~ + + +SELECT stuff('AbdefGhi', 8, 0, 'xy') +GO +~~START~~ +varchar +AbdefGhxyi +~~END~~ + + +SELECT stuff('AbdefGhi', 1, -1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 8, -1, 'xy') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT stuff('AbdefGhi', 2, 9, 'xy') +GO +~~START~~ +varchar +Axy +~~END~~ + + +SELECT stuff('AbdefGhi', 2, 2147483648, 'xy') +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +axyz??wuytgdy? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +??·?·? ? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +??·?·? ? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +??·拉·比? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +??·?·?? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +??·ef? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +??·ef? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varchar +??·?·?? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +varchar +??·? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +??·?·? ? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·?·? ? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·拉·比? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +??·拉·比? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +??·ef? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +??·ef? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +??·拉·比? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +?拉·比 +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi🙂🙂 +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +abcefefghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +SELECT stuff('abc🙂defghi🙂🙂', 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +abcxyz??wuytgdy?efghi?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +varchar +axyz??wuytgdy? +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +??·?·? ? +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·?·? 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +??·?·?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +??·ef? +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varchar +??·ef? +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varchar +??·?·?? +~~END~~ + +SELECT stuff('比尔·拉莫斯', 4, 2, '拉·比') +GO +~~START~~ +varchar +??·?·?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +varchar +??·? +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·?·? 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·?·? 斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +SELECT stuff('比尔·拉莫斯', 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +比拉·比 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CI_AS FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS FROM babel_4838_stuff_chinese_prc_ci_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CS_AS FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CS_AS FROM babel_4838_stuff_chinese_prc_cs_as +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CI_AI FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·比尔·拉莫斯斯 +~~END~~ + +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AI FROM babel_4838_stuff_chinese_prc_ci_ai +GO +~~START~~ +varchar +比尔·拉·比斯 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CI_AS FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CI_AS FROM babel_4838_stuff_arabic_ci_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CS_AS FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CS_AS FROM babel_4838_stuff_arabic_cs_as +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CI_AI FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللالله مع المتقينمع المتقين +~~END~~ + +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CI_AI FROM babel_4838_stuff_arabic_ci_ai +GO +~~START~~ +varchar +اللمعقيالمع المتقين +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +axyz🙂🙂wuytgdy🙂 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +??·?·? ? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +??·?·? ? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +??·拉·比? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +??·拉·比? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +??·ef? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +??·ef? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +nvarchar +??·拉·比? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +nvarchar +?拉·比 +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·?·? ? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·?·? ? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·拉·比? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·拉·比? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·ef? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·ef? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +??·拉·比? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +?拉·比 +~~END~~ + + +-- with table column of type nchar +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_t1 +GO +~~START~~ +nvarchar +abcabc🙂defghi🙂🙂 efghi🙂🙂 +比尔·比尔·拉莫斯 斯 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz??wuytgdy? efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +abcefefghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +~~START~~ +nvarchar +axyz🙂🙂wuytgdy🙂 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·?·? 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·?·? 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +~~START~~ +nvarchar +比拉·比 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·?·? 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·?·? 斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·ef斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比尔·拉·比斯 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +nvarchar +比拉·比 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, 0x6566) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varbinary +6162633FB73F666768 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: collations are not supported by type varbinary)~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 0, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 13, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, -1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, 15, 0x6566) +GO +~~START~~ +varbinary +616566 +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F202020202020202020202020666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +61626378797A3F3F777579746764793F666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, 0x6566) +GO +~~START~~ +varbinary +6162636566666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +~~START~~ +varbinary +6162633FB73F666768 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: collations are not supported by type varbinary)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 0, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 13, 1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, -1, 0x6566) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, 15, 0x6566) +GO +~~START~~ +varbinary +616566 +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4838_stuff_dep_view +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +EXEC babel_4838_stuff_dep_proc +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_func() +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4838_stuff_itvf_func() +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_1 +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +比尔·xyz🙂🙂wuytgdy🙂斯 +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_2 +GO +~~START~~ +nvarchar +abcxyz🙂🙂wuytgdy🙂efghi🙂🙂 +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_3 +GO +~~START~~ +varchar +abcxyz??wuytgdy?fghi +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_4 +GO +~~START~~ +varchar +abcxyz??wuytgdy?fghi +~~END~~ + + +SELECT * FROM babel_4838_stuff_dep_view_5 +GO +~~START~~ +varbinary +2020616566642020 +~~END~~ + + +-- input type UDT +-- in table babel_4838_stuff_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_UDT +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of stuff function.)~~ + + +SELECT stuff(b, 4, 2, b) FROM babel_4838_stuff_UDT +GO +~~START~~ +varchar +abcabcdeff +~~END~~ + + +-- other different datatypes, should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 4 of stuff function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of stuff function.)~~ + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of stuff function.)~~ + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of stuff function.)~~ + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString decimal = 123456; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString decimal = 123456; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString decimal = 123456; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString decimal = 123456; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString numeric = 12345.12; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString numeric = 12345.12; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString numeric = 12345.12; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString float = 12345.1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString float = 12345.1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString float = 12345.1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString float = 12345.1; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString real = 12345.1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString real = 12345.1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString real = 12345.1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString real = 12345.1; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString bigint = 12345678; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString bigint = 12345678; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString bigint = 12345678; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString bigint = 12345678; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString int = 12345678; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString int = 12345678; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 4 of stuff function.)~~ + +DECLARE @inputString int = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar +abcdysd +~~END~~ + +DECLARE @inputString int = 12345678; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString CHAR(25) = 'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bpchar is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString CHAR(25) = 'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bpchar is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString VARCHAR(25) = 'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString VARCHAR(25) = 'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "varchar" is invalid for argument 3 of stuff function.)~~ + + +DECLARE @inputString smallint = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString smallint = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 4 of stuff function.)~~ + +DECLARE @inputString smallint = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar +abcdysd +~~END~~ + +DECLARE @inputString smallint = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString NCHAR(25) = N'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "nchar" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString NCHAR(25) = N'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "nchar" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString NVARCHAR(25) = N'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type nvarchar is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString NVARCHAR(25) = N'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type nvarchar is invalid for argument 3 of stuff function.)~~ + + +DECLARE @inputString tinyint = 235; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString tinyint = 235; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 4 of stuff function.)~~ + +DECLARE @inputString tinyint = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~START~~ +varchar +abcdysd +~~END~~ + +DECLARE @inputString tinyint = 235; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~START~~ +varchar +abcd +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 3 of stuff function.)~~ + + +DECLARE @inputString money = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString money = 12356; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString money = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString money = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString smallmoney = 12356; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString smallmoney = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString smallmoney = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString bit = 1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString bit = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString bit = 1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString bit = 1; +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 4 of stuff function.)~~ + + +SELECT stuff(a, 4, 2, 'abcd') from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of stuff function.)~~ + +SELECT stuff('abcd', a, 2, 'abcd') from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('abcd', 4, a, 'abcd') from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('abcd', 4, 2, a) from babel_4838_stuff_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 4 of stuff function.)~~ + + +-- input datatype text +SELECT stuff(a, 4, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~START~~ +varchar +abcabcdefghi?? +~~END~~ + +SELECT stuff('abcd', a, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('abcd', 4, a, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('abcd', 4, 2, a) FROM babel_4838_stuff_text +GO +~~START~~ +varchar +abcabc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT stuff(b, 4, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~START~~ +nvarchar +abcabcdefghi🙂🙂 +~~END~~ + +SELECT stuff('abcd', b, 2, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type ntext is invalid for argument 2 of stuff function.)~~ + +SELECT stuff('abcd', 4, b, 'abcd') FROM babel_4838_stuff_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type ntext is invalid for argument 3 of stuff function.)~~ + +SELECT stuff('abcd', 4, 2, b) FROM babel_4838_stuff_text +GO +~~START~~ +nvarchar +abcabc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of stuff function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of stuff function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of stuff function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('abcd', 4, 1, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 4 of stuff function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +~~START~~ +varchar +6F9abcd19FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +abc6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +abc +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +~~START~~ +varchar +POIabcdT(1 2) +~~END~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +abcPOINT(1 2) +~~END~~ + diff --git a/test/JDBC/expected/substring-before-15_8-or-16_4-vu-cleanup.out b/test/JDBC/expected/substring-before-15_8-or-16_4-vu-cleanup.out new file mode 100644 index 00000000000..86cd915f860 --- /dev/null +++ b/test/JDBC/expected/substring-before-15_8-or-16_4-vu-cleanup.out @@ -0,0 +1,86 @@ +DROP FUNCTION babel_3658_substring_itvf_func +GO + +DROP FUNCTION babel_3658_substring_dep_func +GO + +DROP PROCEDURE babel_3658_substring_dep_proc +GO + +DROP VIEW babel_3658_substring_dep_view +GO + +DROP TABLE babel_3658_substring_UDT +GO + +DROP VIEW babel_3658_substring_dep_view_1 +GO + +DROP VIEW babel_3658_substring_dep_view_2 +GO + +DROP VIEW babel_3658_substring_dep_view_3 +GO + +DROP VIEW babel_3658_substring_dep_view_4 +GO + +DROP VIEW babel_3658_substring_dep_view_5 +GO + +DROP VIEW babel_3658_substring_dep_view_6 +GO + +DROP VIEW babel_3658_substring_dep_view_7 +GO + +DROP VIEW babel_3658_substring_dep_view_8 +GO + +DROP TYPE dbo.babel_3658_substring_varUDT +GO + +DROP TYPE dbo.babel_3658_substring_imageUDT +GO + +DROP TABLE babel_3658_substring_text +GO + +DROP TABLE babel_3658_substring_image +GO + +DROP TABLE babel_3658_substring_arabic_ci_ai +GO + +DROP TABLE babel_3658_substring_arabic_cs_as +GO + +DROP TABLE babel_3658_substring_arabic_ci_as +GO + +DROP TABLE babel_3658_substring_chinese_prc_ci_ai +GO + +DROP TABLE babel_3658_substring_chinese_prc_cs_as +GO + +DROP TABLE babel_3658_substring_chinese_prc_ci_as +GO + +DROP TABLE babel_3658_substring_t6 +GO + +DROP TABLE babel_3658_substring_t5 +GO + +DROP TABLE babel_3658_substring_t4 +GO + +DROP TABLE babel_3658_substring_t3 +GO + +DROP TABLE babel_3658_substring_t2 +GO + +DROP TABLE babel_3658_substring_t1 +GO diff --git a/test/JDBC/expected/substring-before-15_8-or-16_4-vu-prepare.out b/test/JDBC/expected/substring-before-15_8-or-16_4-vu-prepare.out new file mode 100644 index 00000000000..5eba59a30e9 --- /dev/null +++ b/test/JDBC/expected/substring-before-15_8-or-16_4-vu-prepare.out @@ -0,0 +1,167 @@ +CREATE TABLE babel_3658_substring_t1(a NCHAR(50)) +GO +INSERT INTO babel_3658_substring_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_3658_substring_t1 VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_3658_substring_t2 VALUES(N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_t3(a CHAR(50)) +GO +INSERT INTO babel_3658_substring_t3 VALUES('abcdefghi') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_t4(a VARCHAR(50)) +GO +INSERT INTO babel_3658_substring_t4 VALUES('abcdefghi') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_t5(a VARBINARY(50)) +GO +INSERT INTO babel_3658_substring_t5 VALUES(0x2020616263642020) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_t6(a BINARY(50)) +GO +INSERT INTO babel_3658_substring_t6 VALUES(0x2020616263642020) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_3658_substring_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_3658_substring_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_3658_substring_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_3658_substring_arabic_ci_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_3658_substring_arabic_cs_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_3658_substring_arabic_ci_ai VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_image(a IMAGE) +GO +INSERT INTO babel_3658_substring_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_3658_substring_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TYPE dbo.babel_3658_substring_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_3658_substring_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_3658_substring_UDT(a dbo.babel_3658_substring_imageUDT, b dbo.babel_3658_substring_varUDT) +GO +INSERT INTO babel_3658_substring_UDT VALUES(CAST('abcdef' as dbo.babel_3658_substring_imageUDT), CAST('abcdef' as dbo.babel_3658_substring_varUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_3658_substring_dep_view AS + SELECT substring(a, 4, 1) as result from babel_3658_substring_t2 +GO + +CREATE PROCEDURE babel_3658_substring_dep_proc AS + SELECT substring(a, 4, 1) as result from babel_3658_substring_t2 +GO + +CREATE FUNCTION babel_3658_substring_dep_func() +RETURNS NVARCHAR(200) +AS +BEGIN +RETURN (SELECT TOP 1 substring(a, 4, 1) from babel_3658_substring_t2) +END +GO + +CREATE VIEW babel_3658_substring_dep_view_1 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t1 +GO + +CREATE VIEW babel_3658_substring_dep_view_2 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t2 +GO + +CREATE VIEW babel_3658_substring_dep_view_3 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t3 +GO + +CREATE VIEW babel_3658_substring_dep_view_4 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t4 +GO + +CREATE VIEW babel_3658_substring_dep_view_5 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t5 +GO + +CREATE VIEW babel_3658_substring_dep_view_6 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_text +GO + +CREATE VIEW babel_3658_substring_dep_view_7 AS + SELECT substring(b, 4, 1) as result FROM babel_3658_substring_text +GO + +CREATE VIEW babel_3658_substring_dep_view_8 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t6 +GO + +CREATE FUNCTION babel_3658_substring_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT substring(a, 4, 1) as result from babel_3658_substring_t2) +GO diff --git a/test/JDBC/expected/substring-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/substring-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..acae233ba00 --- /dev/null +++ b/test/JDBC/expected/substring-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,1113 @@ +-- NULL +SELECT substring(NULL, 2, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +SELECT substring(CAST(NULL AS int), 2, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type int is invalid for argument 1 of substring function.)~~ + + +SELECT substring(CAST(NULL AS varbinary), 2, 1) +GO +~~START~~ +varbinary + +~~END~~ + + +SELECT substring(CAST(NULL AS decimal), 2, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type decimal is invalid for argument 1 of substring function.)~~ + + +SELECT substring('abc', NULL, 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', CAST(NULL AS text), 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 2 of substring function.)~~ + + +SELECT substring('abc', CAST(NULL AS varchar), 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', CAST(NULL AS int), 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', 2, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', 2, CAST(NULL AS text)) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 3 of substring function.)~~ + + +SELECT substring('abc', 2, CAST(NULL AS varchar)) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', 2, CAST(NULL AS int)) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring(NULL, 2, NULL) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +SELECT substring('abc', NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring(NULL, NULL, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +SELECT substring(NULL, NULL, NULL) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +-- Different no. of arguments +SELECT substring('abc', 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.substring function requires 3 arguments)~~ + + +SELECT substring('abc', 1, 1, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.substring function requires 3 arguments)~~ + + +-- edge case values for second parameter +SELECT substring('AbdefGhi', 0, 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT '|' + substring('AbdefGhi', -1, 1) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT substring('AbdefGhi', 1, 1) +GO +~~START~~ +varchar +A +~~END~~ + + +SELECT substring('AbdefGhi', 8, 1) +GO +~~START~~ +varchar +i +~~END~~ + + +SELECT substring('AbdefGhi', 9, 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('AbdefGhi', 2147483648, 1) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- edge case values for third parameter +SELECT substring('AbdefGhi', 1, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('AbdefGhi', 8, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('AbdefGhi', 1, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +SELECT substring('AbdefGhi', 8, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +SELECT substring('AbdefGhi', 2, 9) +GO +~~START~~ +varchar +bdefGhi +~~END~~ + + +SELECT substring('AbdefGhi', 2, 2147483648) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +?d +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +?? +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 0, 1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 13, 1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 2, 15) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +?? +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +?d +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +?? +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 0, 1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 13, 1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 2, 15) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +拉莫 +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_ci_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CI_AS FROM babel_3658_substring_chinese_prc_ci_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_cs_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CS_AS FROM babel_3658_substring_chinese_prc_cs_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_ci_ai +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CI_AI FROM babel_3658_substring_chinese_prc_ci_ai +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_ci_as +GO +~~START~~ +varchar +ه +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE ARABIC_CI_AS FROM babel_3658_substring_arabic_ci_as +GO +~~START~~ +varchar +ه +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_cs_as +GO +~~START~~ +varchar +ه +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE ARABIC_CS_AS FROM babel_3658_substring_arabic_cs_as +GO +~~START~~ +varchar +ه +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_ci_ai +GO +~~START~~ +varchar +ه +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE ARABIC_CI_AI FROM babel_3658_substring_arabic_ci_ai +GO +~~START~~ +varchar +ه +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +?d +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +?? +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +-- with table column of type nchar +SELECT substring(a, 4, 2) FROM babel_3658_substring_t1 +GO +~~START~~ +nvarchar +🙂d +拉莫 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +🙂d +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +拉莫 +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~START~~ +nvarchar + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varbinary +6465 +~~END~~ + +~~START~~ +varbinary + +~~END~~ + +~~START~~ +varbinary + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varbinary +6465 +~~END~~ + +~~START~~ +varbinary + +~~END~~ + +~~START~~ +varbinary + +~~END~~ + +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +SELECT substring(0x0a0b0c, 1,2), substring(0x0a0b0c,2,1) +GO +~~START~~ +varbinary#!#varbinary +0A0B#!#0B +~~END~~ + + +-- dependent objects +SELECT * FROM babel_3658_substring_dep_view +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +EXEC babel_3658_substring_dep_proc +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_func() +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_itvf_func() +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_1 +GO +~~START~~ +nvarchar +🙂 +拉 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_2 +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_3 +GO +~~START~~ +varchar +d +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_4 +GO +~~START~~ +varchar +d +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_5 +GO +~~START~~ +varchar +0 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_6 +GO +~~START~~ +varchar +? +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_7 +GO +~~START~~ +varchar +? +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_8 +GO +~~START~~ +varchar +0 +~~END~~ + + +-- input type UDT +-- in table babel_3658_substring_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT substring(a, 4, 2) FROM babel_3658_substring_UDT +GO +~~START~~ +varbinary +6465 +~~END~~ + + +SELECT substring(b, 4, 2) FROM babel_3658_substring_UDT +GO +~~START~~ +varchar +de +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of substring function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString decimal = 123456; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type decimal is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString float = 12345.1; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type float is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString real = 12345.1; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString bigint = 12345678; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString int = 12345678; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type int is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString smallint = 12356; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString tinyint = 235; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString money = 12356; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString bit = 1; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bit is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of substring function.)~~ + + +SELECT substring(a, 4, 2) from babel_3658_substring_image; +GO +~~START~~ +varbinary +3631 +~~END~~ + +SELECT substring(a, 0, 1) from babel_3658_substring_image; +GO +~~START~~ +varbinary + +~~END~~ + +SELECT substring(a, 13, 1) from babel_3658_substring_image; +GO +~~START~~ +varbinary +36 +~~END~~ + +SELECT substring(a, 2, -1) from babel_3658_substring_image; +GO +~~START~~ +varbinary +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +SELECT substring(a, 2, 15) from babel_3658_substring_image; +GO +~~START~~ +varbinary +463936313946462D384238362D4430 +~~END~~ + + +-- input datatype text +SELECT substring(a, 4, 2) FROM babel_3658_substring_text +GO +~~START~~ +varchar +?d +~~END~~ + +SELECT substring(a, 0, 1) from babel_3658_substring_text; +GO +~~START~~ +varchar + +~~END~~ + +SELECT substring(a, 13, 1) from babel_3658_substring_text; +GO +~~START~~ +varchar + +~~END~~ + +SELECT substring(a, 2, -1) from babel_3658_substring_text; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +SELECT substring(a, 2, 15) from babel_3658_substring_text; +GO +~~START~~ +varchar +bc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT substring(b, 4, 2) FROM babel_3658_substring_text +GO +~~START~~ +nvarchar +🙂d +~~END~~ + +SELECT substring(b, 0, 1) from babel_3658_substring_text; +GO +~~START~~ +nvarchar + +~~END~~ + +SELECT substring(b, 13, 1) from babel_3658_substring_text; +GO +~~START~~ +nvarchar + +~~END~~ + +SELECT substring(b, 2, -1) from babel_3658_substring_text; +GO +~~START~~ +nvarchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +SELECT substring(b, 2, 15) from babel_3658_substring_text; +GO +~~START~~ +nvarchar +bc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO +~~START~~ +varchar +6 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO +~~START~~ +varchar +d +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO +~~START~~ +varchar +N +~~END~~ + diff --git a/test/JDBC/expected/substring-vu-cleanup.out b/test/JDBC/expected/substring-vu-cleanup.out new file mode 100644 index 00000000000..86cd915f860 --- /dev/null +++ b/test/JDBC/expected/substring-vu-cleanup.out @@ -0,0 +1,86 @@ +DROP FUNCTION babel_3658_substring_itvf_func +GO + +DROP FUNCTION babel_3658_substring_dep_func +GO + +DROP PROCEDURE babel_3658_substring_dep_proc +GO + +DROP VIEW babel_3658_substring_dep_view +GO + +DROP TABLE babel_3658_substring_UDT +GO + +DROP VIEW babel_3658_substring_dep_view_1 +GO + +DROP VIEW babel_3658_substring_dep_view_2 +GO + +DROP VIEW babel_3658_substring_dep_view_3 +GO + +DROP VIEW babel_3658_substring_dep_view_4 +GO + +DROP VIEW babel_3658_substring_dep_view_5 +GO + +DROP VIEW babel_3658_substring_dep_view_6 +GO + +DROP VIEW babel_3658_substring_dep_view_7 +GO + +DROP VIEW babel_3658_substring_dep_view_8 +GO + +DROP TYPE dbo.babel_3658_substring_varUDT +GO + +DROP TYPE dbo.babel_3658_substring_imageUDT +GO + +DROP TABLE babel_3658_substring_text +GO + +DROP TABLE babel_3658_substring_image +GO + +DROP TABLE babel_3658_substring_arabic_ci_ai +GO + +DROP TABLE babel_3658_substring_arabic_cs_as +GO + +DROP TABLE babel_3658_substring_arabic_ci_as +GO + +DROP TABLE babel_3658_substring_chinese_prc_ci_ai +GO + +DROP TABLE babel_3658_substring_chinese_prc_cs_as +GO + +DROP TABLE babel_3658_substring_chinese_prc_ci_as +GO + +DROP TABLE babel_3658_substring_t6 +GO + +DROP TABLE babel_3658_substring_t5 +GO + +DROP TABLE babel_3658_substring_t4 +GO + +DROP TABLE babel_3658_substring_t3 +GO + +DROP TABLE babel_3658_substring_t2 +GO + +DROP TABLE babel_3658_substring_t1 +GO diff --git a/test/JDBC/expected/substring-vu-prepare.out b/test/JDBC/expected/substring-vu-prepare.out new file mode 100644 index 00000000000..5eba59a30e9 --- /dev/null +++ b/test/JDBC/expected/substring-vu-prepare.out @@ -0,0 +1,167 @@ +CREATE TABLE babel_3658_substring_t1(a NCHAR(50)) +GO +INSERT INTO babel_3658_substring_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_3658_substring_t1 VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_3658_substring_t2 VALUES(N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_t3(a CHAR(50)) +GO +INSERT INTO babel_3658_substring_t3 VALUES('abcdefghi') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_t4(a VARCHAR(50)) +GO +INSERT INTO babel_3658_substring_t4 VALUES('abcdefghi') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_t5(a VARBINARY(50)) +GO +INSERT INTO babel_3658_substring_t5 VALUES(0x2020616263642020) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_t6(a BINARY(50)) +GO +INSERT INTO babel_3658_substring_t6 VALUES(0x2020616263642020) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_3658_substring_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_3658_substring_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_3658_substring_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_3658_substring_arabic_ci_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_3658_substring_arabic_cs_as VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_3658_substring_arabic_ci_ai VALUES(N'الله مع المتقين') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_image(a IMAGE) +GO +INSERT INTO babel_3658_substring_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_3658_substring_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_3658_substring_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO +~~ROW COUNT: 1~~ + + +CREATE TYPE dbo.babel_3658_substring_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_3658_substring_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_3658_substring_UDT(a dbo.babel_3658_substring_imageUDT, b dbo.babel_3658_substring_varUDT) +GO +INSERT INTO babel_3658_substring_UDT VALUES(CAST('abcdef' as dbo.babel_3658_substring_imageUDT), CAST('abcdef' as dbo.babel_3658_substring_varUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_3658_substring_dep_view AS + SELECT substring(a, 4, 1) as result from babel_3658_substring_t2 +GO + +CREATE PROCEDURE babel_3658_substring_dep_proc AS + SELECT substring(a, 4, 1) as result from babel_3658_substring_t2 +GO + +CREATE FUNCTION babel_3658_substring_dep_func() +RETURNS NVARCHAR(200) +AS +BEGIN +RETURN (SELECT TOP 1 substring(a, 4, 1) from babel_3658_substring_t2) +END +GO + +CREATE VIEW babel_3658_substring_dep_view_1 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t1 +GO + +CREATE VIEW babel_3658_substring_dep_view_2 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t2 +GO + +CREATE VIEW babel_3658_substring_dep_view_3 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t3 +GO + +CREATE VIEW babel_3658_substring_dep_view_4 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t4 +GO + +CREATE VIEW babel_3658_substring_dep_view_5 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t5 +GO + +CREATE VIEW babel_3658_substring_dep_view_6 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_text +GO + +CREATE VIEW babel_3658_substring_dep_view_7 AS + SELECT substring(b, 4, 1) as result FROM babel_3658_substring_text +GO + +CREATE VIEW babel_3658_substring_dep_view_8 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t6 +GO + +CREATE FUNCTION babel_3658_substring_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT substring(a, 4, 1) as result from babel_3658_substring_t2) +GO diff --git a/test/JDBC/expected/substring-vu-verify.out b/test/JDBC/expected/substring-vu-verify.out new file mode 100644 index 00000000000..7eac10f0fcf --- /dev/null +++ b/test/JDBC/expected/substring-vu-verify.out @@ -0,0 +1,1269 @@ +-- NULL +SELECT substring(NULL, 2, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +SELECT substring(CAST(NULL AS int), 2, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type int is invalid for argument 1 of substring function.)~~ + + +SELECT substring(CAST(NULL AS varbinary), 2, 1) +GO +~~START~~ +varbinary + +~~END~~ + + +SELECT substring(CAST(NULL AS decimal), 2, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type decimal is invalid for argument 1 of substring function.)~~ + + +SELECT substring('abc', NULL, 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', CAST(NULL AS text), 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 2 of substring function.)~~ + + +SELECT substring('abc', CAST(NULL AS varchar), 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', CAST(NULL AS int), 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', 2, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', 2, CAST(NULL AS text)) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type text is invalid for argument 3 of substring function.)~~ + + +SELECT substring('abc', 2, CAST(NULL AS varchar)) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('abc', 2, CAST(NULL AS int)) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring(NULL, 2, NULL) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +SELECT substring('abc', NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring(NULL, NULL, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +SELECT substring(NULL, NULL, NULL) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type NULL is invalid for argument 1 of substring function)~~ + + +-- Different no. of arguments +SELECT substring('abc', 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.substring function requires 3 arguments)~~ + + +SELECT substring('abc', 1, 1, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.substring function requires 3 arguments)~~ + + +-- edge case values for second parameter +SELECT substring('AbdefGhi', 0, 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT '|' + substring('AbdefGhi', -1, 1) + '|' +GO +~~START~~ +varchar +|| +~~END~~ + + +SELECT substring('AbdefGhi', 1, 1) +GO +~~START~~ +varchar +A +~~END~~ + + +SELECT substring('AbdefGhi', 8, 1) +GO +~~START~~ +varchar +i +~~END~~ + + +SELECT substring('AbdefGhi', 9, 1) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('AbdefGhi', 2147483648, 1) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- edge case values for third parameter +SELECT substring('AbdefGhi', 1, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('AbdefGhi', 8, 0) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT substring('AbdefGhi', 1, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +SELECT substring('AbdefGhi', 8, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + + +SELECT substring('AbdefGhi', 2, 9) +GO +~~START~~ +varchar +bdefGhi +~~END~~ + + +SELECT substring('AbdefGhi', 2, 2147483648) +GO +~~ERROR (Code: 8115)~~ + +~~ERROR (Message: integer out of range)~~ + + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +varchar +?d +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +bc?defghi?? +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +varchar +?? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +?·??? +~~END~~ + + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +?? +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +?·??? +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +varchar +?d +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +bc?defghi?? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +varchar +?? +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varchar +?·??? +~~END~~ + + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +拉莫 +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar + +~~END~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) COLLATE CHINESE_PRC_CI_AS +GO +~~START~~ +varchar +尔·拉莫斯 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_ci_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CI_AS FROM babel_3658_substring_chinese_prc_ci_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_cs_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CS_AS FROM babel_3658_substring_chinese_prc_cs_as +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_ci_ai +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CI_AI FROM babel_3658_substring_chinese_prc_ci_ai +GO +~~START~~ +varchar +拉莫 +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_ci_as +GO +~~START~~ +varchar +ه +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE ARABIC_CI_AS FROM babel_3658_substring_arabic_ci_as +GO +~~START~~ +varchar +ه +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_cs_as +GO +~~START~~ +varchar +ه +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE ARABIC_CS_AS FROM babel_3658_substring_arabic_cs_as +GO +~~START~~ +varchar +ه +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_ci_ai +GO +~~START~~ +varchar +ه +~~END~~ + + +SELECT substring(a, 4, 2) COLLATE ARABIC_CI_AI FROM babel_3658_substring_arabic_ci_ai +GO +~~START~~ +varchar +ه +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +nvarchar +?d +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +bc?defghi?? +~~END~~ + + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +nvarchar +?? +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +?·??? +~~END~~ + + +-- with table column of type nchar +SELECT substring(a, 4, 2) FROM babel_3658_substring_t1 +GO +~~START~~ +nvarchar +🙂d +拉莫 +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +nvarchar +🙂d +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +bc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +nvarchar +拉莫 +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +nvarchar + +~~END~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +nvarchar +尔·拉莫斯 +~~END~~ + + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +varbinary +6465 +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varbinary +626364656667680000 +~~END~~ + + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 4, 2) +GO +~~START~~ +varbinary +6465 +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 0, 1) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 13, 1) +GO +~~START~~ +varbinary + +~~END~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 2, -1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 2, 15) +GO +~~START~~ +varbinary +62636465666768 +~~END~~ + + +SELECT substring(0x0a0b0c, 1,2), substring(0x0a0b0c,2,1) +GO +~~START~~ +varbinary#!#varbinary +0A0B#!#0B +~~END~~ + + +-- dependent objects +SELECT * FROM babel_3658_substring_dep_view +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +EXEC babel_3658_substring_dep_proc +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_func() +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_itvf_func() +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_1 +GO +~~START~~ +nvarchar +🙂 +拉 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_2 +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_3 +GO +~~START~~ +varchar +d +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_4 +GO +~~START~~ +varchar +d +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_5 +GO +~~START~~ +varbinary +62 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_6 +GO +~~START~~ +varchar +? +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_7 +GO +~~START~~ +nvarchar +🙂 +~~END~~ + + +SELECT * FROM babel_3658_substring_dep_view_8 +GO +~~START~~ +varbinary +62 +~~END~~ + + +-- input type UDT +-- in table babel_3658_substring_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT substring(a, 4, 2) FROM babel_3658_substring_UDT +GO +~~START~~ +varbinary +6465 +~~END~~ + + +SELECT substring(b, 4, 2) FROM babel_3658_substring_UDT +GO +~~START~~ +varchar +de +~~END~~ + + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of substring function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString decimal = 123456; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type decimal is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString numeric = 12345.12; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString float = 12345.1; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type float is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString real = 12345.1; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString bigint = 12345678; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString int = 12345678; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type int is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString smallint = 12356; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString tinyint = 235; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString money = 12356; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString smallmoney = 12356; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString bit = 1; +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bit is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of substring function.)~~ + + +SELECT substring(a, 4, 2) from babel_3658_substring_image; +GO +~~START~~ +varbinary +3631 +~~END~~ + +SELECT substring(a, 0, 1) from babel_3658_substring_image; +GO +~~START~~ +varbinary + +~~END~~ + +SELECT substring(a, 13, 1) from babel_3658_substring_image; +GO +~~START~~ +varbinary +36 +~~END~~ + +SELECT substring(a, 2, -1) from babel_3658_substring_image; +GO +~~START~~ +varbinary +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +SELECT substring(a, 2, 15) from babel_3658_substring_image; +GO +~~START~~ +varbinary +463936313946462D384238362D4430 +~~END~~ + + +-- input datatype text +SELECT substring(a, 4, 2) FROM babel_3658_substring_text +GO +~~START~~ +varchar +?d +~~END~~ + +SELECT substring(a, 0, 1) from babel_3658_substring_text; +GO +~~START~~ +varchar + +~~END~~ + +SELECT substring(a, 13, 1) from babel_3658_substring_text; +GO +~~START~~ +varchar + +~~END~~ + +SELECT substring(a, 2, -1) from babel_3658_substring_text; +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +SELECT substring(a, 2, 15) from babel_3658_substring_text; +GO +~~START~~ +varchar +bc?defghi?? +~~END~~ + + +-- input datatype ntext +SELECT substring(b, 4, 2) FROM babel_3658_substring_text +GO +~~START~~ +nvarchar +🙂d +~~END~~ + +SELECT substring(b, 0, 1) from babel_3658_substring_text; +GO +~~START~~ +nvarchar + +~~END~~ + +SELECT substring(b, 13, 1) from babel_3658_substring_text; +GO +~~START~~ +nvarchar + +~~END~~ + +SELECT substring(b, 2, -1) from babel_3658_substring_text; +GO +~~START~~ +nvarchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: negative substring length not allowed)~~ + +SELECT substring(b, 2, 15) from babel_3658_substring_text; +GO +~~START~~ +nvarchar +bc🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT substring(@inputString, 4, 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of substring function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO +~~START~~ +varchar +6 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO +~~START~~ +varchar +d +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO +~~START~~ +varchar +N +~~END~~ + diff --git a/test/JDBC/expected/sys-columns-dep-vu-prepare.out b/test/JDBC/expected/sys-columns-dep-vu-prepare.out index 922d9a930a9..b83a00a4c21 100644 --- a/test/JDBC/expected/sys-columns-dep-vu-prepare.out +++ b/test/JDBC/expected/sys-columns-dep-vu-prepare.out @@ -2,11 +2,11 @@ create table sys_columns_dep_vu_prepare_t1(a int, b float, c bigint, d numeric, go create procedure sys_columns_dep_vu_prepare_p1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create view sys_columns_dep_vu_prepare_v1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create function sys_columns_dep_vu_prepare_f1() diff --git a/test/JDBC/expected/sys-data_spaces-before-16-4-vu-cleanup.out b/test/JDBC/expected/sys-data_spaces-before-16-4-vu-cleanup.out new file mode 100644 index 00000000000..c27fcc00e9b --- /dev/null +++ b/test/JDBC/expected/sys-data_spaces-before-16-4-vu-cleanup.out @@ -0,0 +1,8 @@ +DROP VIEW sys_data_spaces_vu_prepare_view +GO + +DROP PROC sys_data_spaces_vu_prepare_proc +GO + +DROP FUNCTION sys_data_spaces_vu_prepare_func +GO diff --git a/test/JDBC/expected/sys-data_spaces-before-16-4-vu-prepare.out b/test/JDBC/expected/sys-data_spaces-before-16-4-vu-prepare.out new file mode 100644 index 00000000000..602042c62e8 --- /dev/null +++ b/test/JDBC/expected/sys-data_spaces-before-16-4-vu-prepare.out @@ -0,0 +1,15 @@ +CREATE VIEW sys_data_spaces_vu_prepare_view AS +SELECT * FROM sys.data_spaces where type_desc = 'ROWS_FILEGROUP' +GO + +CREATE PROC sys_data_spaces_vu_prepare_proc AS +SELECT * FROM sys.data_spaces where type_desc = 'ROWS_FILEGROUP' +GO + +CREATE FUNCTION dbo.sys_data_spaces_vu_prepare_func() +RETURNS INT +AS +BEGIN +RETURN (SELECT count(*) FROM sys.data_spaces where type_desc = 'ROWS_FILEGROUP') +END +GO diff --git a/test/JDBC/expected/sys-data_spaces-before-16-4-vu-verify.out b/test/JDBC/expected/sys-data_spaces-before-16-4-vu-verify.out new file mode 100644 index 00000000000..c9954638fd4 --- /dev/null +++ b/test/JDBC/expected/sys-data_spaces-before-16-4-vu-verify.out @@ -0,0 +1,31 @@ +SELECT * FROM sys.data_spaces +GO +~~START~~ +nvarchar#!#int#!#char#!#nvarchar#!#bit#!#bit +PRIMARY#!#1#!#FG#!#ROWS_FILEGROUP#!#1#!#0 +~~END~~ + + +SELECT * FROM sys_data_spaces_vu_prepare_view +GO +~~START~~ +varchar#!#int#!#char#!#nvarchar#!#bit#!#bit +PRIMARY#!#1#!#FG#!#ROWS_FILEGROUP#!#1#!#0 +~~END~~ + + +EXEC sys_data_spaces_vu_prepare_proc +GO +~~START~~ +nvarchar#!#int#!#char#!#nvarchar#!#bit#!#bit +PRIMARY#!#1#!#FG#!#ROWS_FILEGROUP#!#1#!#0 +~~END~~ + + +SELECT dbo.sys_data_spaces_vu_prepare_func() +GO +~~START~~ +int +1 +~~END~~ + diff --git a/test/JDBC/expected/sys-data_spaces-vu-cleanup.out b/test/JDBC/expected/sys-data_spaces-vu-cleanup.out new file mode 100644 index 00000000000..c27fcc00e9b --- /dev/null +++ b/test/JDBC/expected/sys-data_spaces-vu-cleanup.out @@ -0,0 +1,8 @@ +DROP VIEW sys_data_spaces_vu_prepare_view +GO + +DROP PROC sys_data_spaces_vu_prepare_proc +GO + +DROP FUNCTION sys_data_spaces_vu_prepare_func +GO diff --git a/test/JDBC/expected/sys-data_spaces-vu-prepare.out b/test/JDBC/expected/sys-data_spaces-vu-prepare.out new file mode 100644 index 00000000000..602042c62e8 --- /dev/null +++ b/test/JDBC/expected/sys-data_spaces-vu-prepare.out @@ -0,0 +1,15 @@ +CREATE VIEW sys_data_spaces_vu_prepare_view AS +SELECT * FROM sys.data_spaces where type_desc = 'ROWS_FILEGROUP' +GO + +CREATE PROC sys_data_spaces_vu_prepare_proc AS +SELECT * FROM sys.data_spaces where type_desc = 'ROWS_FILEGROUP' +GO + +CREATE FUNCTION dbo.sys_data_spaces_vu_prepare_func() +RETURNS INT +AS +BEGIN +RETURN (SELECT count(*) FROM sys.data_spaces where type_desc = 'ROWS_FILEGROUP') +END +GO diff --git a/test/JDBC/expected/sys-data_spaces-vu-verify.out b/test/JDBC/expected/sys-data_spaces-vu-verify.out index e7febd2c90b..4ef5d7d98d2 100644 --- a/test/JDBC/expected/sys-data_spaces-vu-verify.out +++ b/test/JDBC/expected/sys-data_spaces-vu-verify.out @@ -1,7 +1,31 @@ -SELECT * FROM sys.data_spaces; +SELECT * FROM sys.data_spaces GO ~~START~~ -varchar#!#int#!#char#!#nvarchar#!#bit#!#bit +nvarchar#!#int#!#char#!#nvarchar#!#bit#!#bit PRIMARY#!#1#!#FG#!#ROWS_FILEGROUP#!#1#!#0 ~~END~~ + +SELECT * FROM sys_data_spaces_vu_prepare_view +GO +~~START~~ +nvarchar#!#int#!#char#!#nvarchar#!#bit#!#bit +PRIMARY#!#1#!#FG#!#ROWS_FILEGROUP#!#1#!#0 +~~END~~ + + +EXEC sys_data_spaces_vu_prepare_proc +GO +~~START~~ +nvarchar#!#int#!#char#!#nvarchar#!#bit#!#bit +PRIMARY#!#1#!#FG#!#ROWS_FILEGROUP#!#1#!#0 +~~END~~ + + +SELECT dbo.sys_data_spaces_vu_prepare_func() +GO +~~START~~ +int +1 +~~END~~ + diff --git a/test/JDBC/expected/sys-data_spaces.out b/test/JDBC/expected/sys-data_spaces.out index 5937209056e..fdfee0328f2 100644 --- a/test/JDBC/expected/sys-data_spaces.out +++ b/test/JDBC/expected/sys-data_spaces.out @@ -1,7 +1,7 @@ SELECT * FROM sys.data_spaces; GO ~~START~~ -varchar#!#int#!#char#!#nvarchar#!#bit#!#bit +nvarchar#!#int#!#char#!#nvarchar#!#bit#!#bit PRIMARY#!#1#!#FG#!#ROWS_FILEGROUP#!#1#!#0 ~~END~~ diff --git a/test/JDBC/expected/sys-events-vu-verify.out b/test/JDBC/expected/sys-events-vu-verify.out index 0af5e16e3e9..81c86f8a8b8 100644 --- a/test/JDBC/expected/sys-events-vu-verify.out +++ b/test/JDBC/expected/sys-events-vu-verify.out @@ -22,6 +22,15 @@ sys_events_vu_prepare_trig3 ~~END~~ +select o.name, case when o.object_id = e.object_id and o.object_id = object_id(o.name) then 'equal' else 'not equal' end +from sys.objects o join sys.events e on o.object_id = e.object_id where o.name = 'sys_events_vu_prepare_trig3'; +go +~~START~~ +varchar#!#text +sys_events_vu_prepare_trig3#!#equal +~~END~~ + + USE master GO diff --git a/test/JDBC/expected/sys-filegroups-before-16-4-vu-cleanup.out b/test/JDBC/expected/sys-filegroups-before-16-4-vu-cleanup.out new file mode 100644 index 00000000000..9978d1d5878 --- /dev/null +++ b/test/JDBC/expected/sys-filegroups-before-16-4-vu-cleanup.out @@ -0,0 +1,11 @@ +USE master +GO + +DROP VIEW sys_filegroups_vu_prepare_view +GO + +DROP PROC sys_filegroups_vu_prepare_proc +GO + +DROP FUNCTION sys_filegroups_vu_prepare_func +GO diff --git a/test/JDBC/expected/sys-filegroups-before-16-4-vu-prepare.out b/test/JDBC/expected/sys-filegroups-before-16-4-vu-prepare.out new file mode 100644 index 00000000000..eb7f0563f59 --- /dev/null +++ b/test/JDBC/expected/sys-filegroups-before-16-4-vu-prepare.out @@ -0,0 +1,18 @@ +USE master +GO + +CREATE VIEW sys_filegroups_vu_prepare_view AS +SELECT * FROM sys.filegroups +GO + +CREATE PROC sys_filegroups_vu_prepare_proc AS +SELECT * FROM sys.filegroups +GO + +CREATE FUNCTION dbo.sys_filegroups_vu_prepare_func() +RETURNS INT +AS +BEGIN +RETURN (SELECT COUNT(*) FROM sys.filegroups) +END +GO diff --git a/test/JDBC/expected/sys-filegroups-before-16-4-vu-verify.out b/test/JDBC/expected/sys-filegroups-before-16-4-vu-verify.out new file mode 100644 index 00000000000..5e2b9a59d2d --- /dev/null +++ b/test/JDBC/expected/sys-filegroups-before-16-4-vu-verify.out @@ -0,0 +1,34 @@ +USE master +GO + +SELECT * FROM sys.filegroups +GO +~~START~~ +nvarchar#!#int#!#char#!#nvarchar#!#bit#!#bit#!#uniqueidentifier#!#int#!#bit#!#bit +PRIMARY#!#1#!#FG#!#ROWS_FILEGROUP#!#1#!#0#!##!#0#!#0#!#0 +~~END~~ + + +SELECT * FROM sys_filegroups_vu_prepare_view +GO +~~START~~ +varchar#!#int#!#char#!#nvarchar#!#bit#!#bit#!#uniqueidentifier#!#int#!#bit#!#bit +PRIMARY#!#1#!#FG#!#ROWS_FILEGROUP#!#1#!#0#!##!#0#!#0#!#0 +~~END~~ + + +EXEC sys_filegroups_vu_prepare_proc +GO +~~START~~ +nvarchar#!#int#!#char#!#nvarchar#!#bit#!#bit#!#uniqueidentifier#!#int#!#bit#!#bit +PRIMARY#!#1#!#FG#!#ROWS_FILEGROUP#!#1#!#0#!##!#0#!#0#!#0 +~~END~~ + + +SELECT dbo.sys_filegroups_vu_prepare_func() +GO +~~START~~ +int +1 +~~END~~ + diff --git a/test/JDBC/expected/sys-filegroups-vu-verify.out b/test/JDBC/expected/sys-filegroups-vu-verify.out index 9b73d546f01..dea3b0de31d 100644 --- a/test/JDBC/expected/sys-filegroups-vu-verify.out +++ b/test/JDBC/expected/sys-filegroups-vu-verify.out @@ -4,7 +4,7 @@ GO SELECT * FROM sys.filegroups GO ~~START~~ -varchar#!#int#!#char#!#nvarchar#!#bit#!#bit#!#uniqueidentifier#!#int#!#bit#!#bit +nvarchar#!#int#!#char#!#nvarchar#!#bit#!#bit#!#uniqueidentifier#!#int#!#bit#!#bit PRIMARY#!#1#!#FG#!#ROWS_FILEGROUP#!#1#!#0#!##!#0#!#0#!#0 ~~END~~ @@ -12,7 +12,7 @@ PRIMARY#!#1#!#FG#!#ROWS_FILEGROUP#!#1#!#0#!##!#0#!#0#!#0 SELECT * FROM sys_filegroups_vu_prepare_view GO ~~START~~ -varchar#!#int#!#char#!#nvarchar#!#bit#!#bit#!#uniqueidentifier#!#int#!#bit#!#bit +nvarchar#!#int#!#char#!#nvarchar#!#bit#!#bit#!#uniqueidentifier#!#int#!#bit#!#bit PRIMARY#!#1#!#FG#!#ROWS_FILEGROUP#!#1#!#0#!##!#0#!#0#!#0 ~~END~~ @@ -20,7 +20,7 @@ PRIMARY#!#1#!#FG#!#ROWS_FILEGROUP#!#1#!#0#!##!#0#!#0#!#0 EXEC sys_filegroups_vu_prepare_proc GO ~~START~~ -varchar#!#int#!#char#!#nvarchar#!#bit#!#bit#!#uniqueidentifier#!#int#!#bit#!#bit +nvarchar#!#int#!#char#!#nvarchar#!#bit#!#bit#!#uniqueidentifier#!#int#!#bit#!#bit PRIMARY#!#1#!#FG#!#ROWS_FILEGROUP#!#1#!#0#!##!#0#!#0#!#0 ~~END~~ diff --git a/test/JDBC/expected/sys-host_name-before-15_8-or-16_4-vu-cleanup.out b/test/JDBC/expected/sys-host_name-before-15_8-or-16_4-vu-cleanup.out new file mode 100644 index 00000000000..eb18e931d5e --- /dev/null +++ b/test/JDBC/expected/sys-host_name-before-15_8-or-16_4-vu-cleanup.out @@ -0,0 +1,26 @@ +DROP VIEW sys_host_name_vu_prepare__host_name_view +GO + +DROP FUNCTION sys_host_name_vu_prepare__host_name_func +GO + +DROP PROCEDURE sys_host_name_vu_prepare__host_name_proc +GO + +DROP VIEW sys_host_name_vu_prepare__dm_exec_connections_view +GO + +DROP FUNCTION sys_host_name_vu_prepare__dm_exec_connections_func +GO + +DROP PROCEDURE sys_host_name_vu_prepare__dm_exec_connections_proc +GO + +DROP VIEW sys_host_name_vu_prepare__dm_exec_sessions_view +GO + +DROP FUNCTION sys_host_name_vu_prepare__dm_exec_sessions_func +GO + +DROP PROCEDURE sys_host_name_vu_prepare__dm_exec_sessions_proc +GO diff --git a/test/JDBC/expected/sys-host_name-before-15_8-or-16_4-vu-prepare.out b/test/JDBC/expected/sys-host_name-before-15_8-or-16_4-vu-prepare.out new file mode 100644 index 00000000000..c4153e6ca81 --- /dev/null +++ b/test/JDBC/expected/sys-host_name-before-15_8-or-16_4-vu-prepare.out @@ -0,0 +1,42 @@ +CREATE VIEW sys_host_name_vu_prepare__host_name_view AS SELECT DISTINCT hostname FROM sys.sysprocesses WHERE spid = @@SPID +GO + +CREATE FUNCTION sys_host_name_vu_prepare__host_name_func(@pid int) +RETURNS TABLE +AS +RETURN (SELECT DISTINCT CAST(hostname as nvarchar(128)) FROM sys.sysprocesses WHERE spid = @pid); +GO + +CREATE PROCEDURE sys_host_name_vu_prepare__host_name_proc +AS +SELECT DISTINCT hostname FROM sys.sysprocesses WHERE spid = @@SPID +GO + +-- Create objects that relied on dependent functions that were modified +CREATE VIEW sys_host_name_vu_prepare__dm_exec_connections_view AS select net_transport, protocol_type, protocol_version, endpoint_id, encrypt_option from sys.dm_exec_connections where session_id = @@SPID +GO + +CREATE FUNCTION sys_host_name_vu_prepare__dm_exec_connections_func(@pid int) +RETURNS TABLE +AS +RETURN (select net_transport, protocol_type, protocol_version, endpoint_id, encrypt_option from sys.dm_exec_connections where session_id = @pid); +GO + +CREATE PROCEDURE sys_host_name_vu_prepare__dm_exec_connections_proc +AS +select net_transport, protocol_type, protocol_version, endpoint_id, encrypt_option from sys.dm_exec_connections where session_id = @@SPID +GO + +CREATE VIEW sys_host_name_vu_prepare__dm_exec_sessions_view AS select language, host_name, client_version, TRIM('0123456789.' FROM client_interface_name), program_name, date_format, date_first from sys.dm_exec_sessions where session_id = @@SPID +GO + +CREATE FUNCTION sys_host_name_vu_prepare__dm_exec_sessions_func(@pid int) +RETURNS TABLE +AS +RETURN (select language, host_name, client_version, TRIM('0123456789.' FROM client_interface_name), program_name, date_format, date_first from sys.dm_exec_sessions where session_id = @pid); +GO + +CREATE PROCEDURE sys_host_name_vu_prepare__dm_exec_sessions_proc +AS +select language, host_name, client_version, TRIM('0123456789.' FROM client_interface_name), program_name, date_format, date_first from sys.dm_exec_sessions where session_id = @@SPID +GO diff --git a/test/JDBC/expected/sys-host_name-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/sys-host_name-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..36baa707a80 --- /dev/null +++ b/test/JDBC/expected/sys-host_name-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,83 @@ + +-- tsql password=12345678;workstationID=a_nice_workstation_name +-- explicitly specify a workstation name to check the HOST_NAME +-- T-SQL function and hostname entry in sys.sysprocesses view +SELECT HOST_NAME() +GO +~~START~~ +nvarchar +a_nice_workstation_name +~~END~~ + + +SELECT * from sys_host_name_vu_prepare__host_name_func(@@SPID) +GO +~~START~~ +nvarchar +a_nice_workstation_name +~~END~~ + + +SELECT * FROM sys_host_name_vu_prepare__host_name_view +GO +~~START~~ +nchar +a_nice_workstation_name +~~END~~ + + +EXECUTE sys_host_name_vu_prepare__host_name_proc +GO +~~START~~ +nchar +a_nice_workstation_name +~~END~~ + + +SELECT * from sys_host_name_vu_prepare__dm_exec_connections_func(@@SPID) +GO +~~START~~ +nvarchar#!#nvarchar#!#int#!#int#!#nvarchar +TCP#!#TSQL#!#1946157060#!#4#!#FALSE +~~END~~ + + +SELECT * FROM sys_host_name_vu_prepare__dm_exec_connections_view +GO +~~START~~ +nvarchar#!#nvarchar#!#int#!#int#!#nvarchar +TCP#!#TSQL#!#1946157060#!#4#!#FALSE +~~END~~ + + +EXECUTE sys_host_name_vu_prepare__dm_exec_connections_proc +GO +~~START~~ +nvarchar#!#nvarchar#!#int#!#int#!#nvarchar +TCP#!#TSQL#!#1946157060#!#4#!#FALSE +~~END~~ + + +SELECT * from sys_host_name_vu_prepare__dm_exec_sessions_func(@@SPID) +GO +~~START~~ +nvarchar#!#nvarchar#!#int#!#text#!#nvarchar#!#nvarchar#!#smallint +us_english#!#a_nice_workstation_name#!#131592#!#Microsoft JDBC Driver #!#Microsoft JDBC Driver for SQL Server#!#ymd#!#7 +~~END~~ + + +SELECT * FROM sys_host_name_vu_prepare__dm_exec_sessions_view +GO +~~START~~ +nvarchar#!#nvarchar#!#int#!#text#!#nvarchar#!#nvarchar#!#smallint +us_english#!#a_nice_workstation_name#!#131592#!#Microsoft JDBC Driver #!#Microsoft JDBC Driver for SQL Server#!#ymd#!#7 +~~END~~ + + +EXECUTE sys_host_name_vu_prepare__dm_exec_sessions_proc +GO +~~START~~ +nvarchar#!#nvarchar#!#int#!#nvarchar#!#nvarchar#!#nvarchar#!#smallint +us_english#!#a_nice_workstation_name#!#131592#!#Microsoft JDBC Driver #!#Microsoft JDBC Driver for SQL Server#!#ymd#!#7 +~~END~~ + diff --git a/test/JDBC/expected/sys-host_name-vu-verify.out b/test/JDBC/expected/sys-host_name-vu-verify.out index ebffa467f79..13ef097ccf2 100644 --- a/test/JDBC/expected/sys-host_name-vu-verify.out +++ b/test/JDBC/expected/sys-host_name-vu-verify.out @@ -61,7 +61,7 @@ TCP#!#TSQL#!#1946157060#!#4#!#FALSE SELECT * from sys_host_name_vu_prepare__dm_exec_sessions_func(@@SPID) GO ~~START~~ -nvarchar#!#nvarchar#!#int#!#text#!#nvarchar#!#nvarchar#!#smallint +nvarchar#!#nvarchar#!#int#!#nvarchar#!#nvarchar#!#nvarchar#!#smallint us_english#!#a_nice_workstation_name#!#131592#!#Microsoft JDBC Driver #!#Microsoft JDBC Driver for SQL Server#!#ymd#!#7 ~~END~~ @@ -69,7 +69,7 @@ us_english#!#a_nice_workstation_name#!#131592#!#Microsoft JDBC Driver #!#Microso SELECT * FROM sys_host_name_vu_prepare__dm_exec_sessions_view GO ~~START~~ -nvarchar#!#nvarchar#!#int#!#text#!#nvarchar#!#nvarchar#!#smallint +nvarchar#!#nvarchar#!#int#!#nvarchar#!#nvarchar#!#nvarchar#!#smallint us_english#!#a_nice_workstation_name#!#131592#!#Microsoft JDBC Driver #!#Microsoft JDBC Driver for SQL Server#!#ymd#!#7 ~~END~~ @@ -77,7 +77,7 @@ us_english#!#a_nice_workstation_name#!#131592#!#Microsoft JDBC Driver #!#Microso EXECUTE sys_host_name_vu_prepare__dm_exec_sessions_proc GO ~~START~~ -nvarchar#!#nvarchar#!#int#!#text#!#nvarchar#!#nvarchar#!#smallint +nvarchar#!#nvarchar#!#int#!#nvarchar#!#nvarchar#!#nvarchar#!#smallint us_english#!#a_nice_workstation_name#!#131592#!#Microsoft JDBC Driver #!#Microsoft JDBC Driver for SQL Server#!#ymd#!#7 ~~END~~ diff --git a/test/JDBC/expected/sys-objects-vu-verify.out b/test/JDBC/expected/sys-objects-vu-verify.out index 9260bbfb57f..83358616f36 100644 --- a/test/JDBC/expected/sys-objects-vu-verify.out +++ b/test/JDBC/expected/sys-objects-vu-verify.out @@ -57,6 +57,15 @@ varchar#!#char#!#nvarchar USE master GO +select case when object_id([name]) = object_id then 'equal' else 'not equal' end +from sys_objects_vu_prepare_db1.sys.objects where [name] = 'sys_objects_vu_prepare_trig1' +go +~~START~~ +text +equal +~~END~~ + + -- Verify cross db reference, it should show the same rows as displayed by the cross db query above. select name from sys_objects_vu_prepare_db1.sys.objects order by name; GO diff --git a/test/JDBC/expected/sys-server_principals-vu-prepare.out b/test/JDBC/expected/sys-server_principals-vu-prepare.out index 0643573604c..9ae4297ec60 100644 --- a/test/JDBC/expected/sys-server_principals-vu-prepare.out +++ b/test/JDBC/expected/sys-server_principals-vu-prepare.out @@ -4,3 +4,10 @@ GO CREATE LOGIN sys_server_principals_vu_login_with_sa with password = '123' GO + +CREATE LOGIN [public] WITH PASSWORD = 'test'; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: role name "public" is reserved)~~ + diff --git a/test/JDBC/expected/sys-server_principals-vu-verify.out b/test/JDBC/expected/sys-server_principals-vu-verify.out index 72bb9a4f6c2..5290e408051 100644 --- a/test/JDBC/expected/sys-server_principals-vu-verify.out +++ b/test/JDBC/expected/sys-server_principals-vu-verify.out @@ -30,6 +30,16 @@ sysadmin#!#R#!#SERVER_ROLE#!##!#English#!##!#1#!#1 ~~END~~ +SELECT name, type, type_desc, default_database_name, default_language_name, credential_id, owning_principal_id, is_fixed_role +FROM sys.server_principals +WHERE name = 'public'; +GO +~~START~~ +varchar#!#char#!#nvarchar#!#varchar#!#varchar#!#int#!#int#!#bit +public#!#R#!#SERVER_ROLE#!##!##!##!#1#!#0 +~~END~~ + + -- server_principals view should not show internal role bbf_role_admin SELECT name, type, type_desc, default_database_name, default_language_name, credential_id, owning_principal_id, is_fixed_role FROM sys.server_principals @@ -52,6 +62,7 @@ GO ~~START~~ varchar#!#char#!#nvarchar#!#varchar#!#varchar#!#int#!#int#!#bit jdbc_user#!#S#!#SQL_LOGIN#!#master#!#English#!#-1#!#-1#!#0 +public#!#R#!#SERVER_ROLE#!##!##!##!#1#!#0 sys_server_principals_vu_login_without_sa#!#S#!#SQL_LOGIN#!#master#!#English#!#-1#!#-1#!#0 sysadmin#!#R#!#SERVER_ROLE#!##!#English#!##!#1#!#1 ~~END~~ diff --git a/test/JDBC/expected/sys-syscolumns.out b/test/JDBC/expected/sys-syscolumns.out index d66b6d1e3b9..48dd031565f 100644 --- a/test/JDBC/expected/sys-syscolumns.out +++ b/test/JDBC/expected/sys-syscolumns.out @@ -217,9 +217,10 @@ int -- Cross-DB system view query is not currently supported in Babelfish. SELECT COUNT(*) FROM db1.DbO.SySCOluMNs where name = '@firstparam' or name = '@secondparam' or name = 'col_a' or name = 'col_b' or name = 'col_c' go -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: Cross-DB system view query is not currently supported in Babelfish.)~~ +~~START~~ +int +6 +~~END~~ -- should not be visible here @@ -233,9 +234,10 @@ int SELECT COUNT(*) FROM db1.dbo.SySCOluMNs where name = '@thirdparam'; GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: Cross-DB system view query is not currently supported in Babelfish.)~~ +~~START~~ +int +0 +~~END~~ -- should not be visible here diff --git a/test/JDBC/expected/sys-sysforeignkeys.out b/test/JDBC/expected/sys-sysforeignkeys.out index aec2586d93b..15082ad0845 100644 --- a/test/JDBC/expected/sys-sysforeignkeys.out +++ b/test/JDBC/expected/sys-sysforeignkeys.out @@ -130,9 +130,10 @@ int SELECT COUNT(*) FROM db1.dbo.SySFoReIGNkeYs where fkeyid = object_id('fk_4'); go -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: Cross-DB system view query is not currently supported in Babelfish.)~~ +~~START~~ +int +0 +~~END~~ select count(*) from sys.foreign_keys where parent_object_id = object_id('fk_4'); diff --git a/test/JDBC/expected/sys-sysobjects-vu-verify.out b/test/JDBC/expected/sys-sysobjects-vu-verify.out index b912ce1edae..8a747e34a99 100644 --- a/test/JDBC/expected/sys-sysobjects-vu-verify.out +++ b/test/JDBC/expected/sys-sysobjects-vu-verify.out @@ -38,9 +38,10 @@ int SELECT COUNT(*) FROM sys_sysobjects_vu_prepare_db1.dbo.SySObJEctS s where s.name = 'sys_sysobjects_vu_prepare_table_t1'; go -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: Cross-DB system view query is not currently supported in Babelfish.)~~ +~~START~~ +int +1 +~~END~~ -- should not be visible here @@ -54,9 +55,10 @@ int SELECT COUNT(*) FROM sys_sysobjects_vu_prepare_db1.dbo.SySObJEctS s where s.name = 'sys_sysobjects_vu_prepare_table'; go -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: Cross-DB system view query is not currently supported in Babelfish.)~~ +~~START~~ +int +0 +~~END~~ SELECT * FROM sys_sysobjects_vu_prepare_view diff --git a/test/JDBC/expected/sys-systypes-vu-verify.out b/test/JDBC/expected/sys-systypes-vu-verify.out index 277c6a217db..f503be1a7b4 100644 --- a/test/JDBC/expected/sys-systypes-vu-verify.out +++ b/test/JDBC/expected/sys-systypes-vu-verify.out @@ -107,9 +107,10 @@ int SELECT count(*) FROM sys_systypes_db.dbo.systypes WHERE name = 'sys_systypes_type'; GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: Cross-DB system view query is not currently supported in Babelfish.)~~ +~~START~~ +int +1 +~~END~~ CREATE TYPE sys_systypes_type FROM int; @@ -142,9 +143,10 @@ sys_systypes_type#!#0#!#4#!#0#!#1#!##!# SELECT name, status, length, variable, allownulls, printfmt, collation FROM sys_systypes_db.dbo.systypes WHERE name = 'sys_systypes_type'; GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: Cross-DB system view query is not currently supported in Babelfish.)~~ +~~START~~ +varchar#!#tinyint#!#smallint#!#bit#!#bit#!#varchar#!#varchar +sys_systypes_type#!#0#!#4#!#0#!#1#!##!# +~~END~~ DROP TYPE sys_systypes_type; diff --git a/test/JDBC/expected/sys-triggers.out b/test/JDBC/expected/sys-triggers.out index f1c8bb363e4..59877f986fe 100644 --- a/test/JDBC/expected/sys-triggers.out +++ b/test/JDBC/expected/sys-triggers.out @@ -35,6 +35,15 @@ SELECT 1 END GO +select case when object_id([name]) = object_id then 'equal' else 'not equal' end +from sys.triggers where [name] = 'trig2' +go +~~START~~ +text +equal +~~END~~ + + -- test instead of insert trigger SELECT name, diff --git a/test/JDBC/expected/sys_all_objects-vu-verify.out b/test/JDBC/expected/sys_all_objects-vu-verify.out index a4d273826b1..e81a6f9931f 100644 --- a/test/JDBC/expected/sys_all_objects-vu-verify.out +++ b/test/JDBC/expected/sys_all_objects-vu-verify.out @@ -11,3 +11,12 @@ sys_all_objects_vu_prepare_1_6_if_1#!#IF#!#SQL_INLINE_TABLE_VALUED_FUNCTION sys_all_objects_vu_prepare_1_7_if_2#!#IF#!#SQL_INLINE_TABLE_VALUED_FUNCTION ~~END~~ + +select case when object_id([name]) = object_id then 'equal' else 'not equal' end +from sys.all_objects where [name] = 'sys_all_objects_vu_prepare_1_3' +go +~~START~~ +text +equal +~~END~~ + diff --git a/test/JDBC/expected/sys_sequences-vu-cleanup.out b/test/JDBC/expected/sys_sequences-vu-cleanup.out new file mode 100644 index 00000000000..71b195cbe47 --- /dev/null +++ b/test/JDBC/expected/sys_sequences-vu-cleanup.out @@ -0,0 +1,8 @@ +DROP VIEW sys_sequences_test_view +GO + +DROP PROC sys_sequences_test_proc +GO + +DROP FUNCTION sys_sequences_test_func +GO diff --git a/test/JDBC/expected/sys_sequences-vu-prepare.out b/test/JDBC/expected/sys_sequences-vu-prepare.out new file mode 100644 index 00000000000..3982f339b88 --- /dev/null +++ b/test/JDBC/expected/sys_sequences-vu-prepare.out @@ -0,0 +1,17 @@ +CREATE VIEW sys_sequences_test_view +AS + SELECT * FROM sys.sequences; +GO + +CREATE PROC sys_sequences_test_proc +AS + SELECT * FROM sys.sequences +GO + +CREATE FUNCTION sys_sequences_test_func() +RETURNS INT +AS +BEGIN + RETURN (SELECT COUNT(*) FROM sys.sequences) +END +GO diff --git a/test/JDBC/expected/sys_sequences-vu-verify.out b/test/JDBC/expected/sys_sequences-vu-verify.out new file mode 100644 index 00000000000..ceef4fc3e19 --- /dev/null +++ b/test/JDBC/expected/sys_sequences-vu-verify.out @@ -0,0 +1,41 @@ +SELECT * FROM sys.sequences +GO +~~START~~ +varchar#!#int#!#int#!#int#!#int#!#char#!#nvarchar#!#datetime#!#datetime#!#bit#!#bit#!#bit#!#sql_variant#!#sql_variant#!#sql_variant#!#sql_variant#!#bit#!#bit#!#int#!#int#!#int#!#tinyint#!#tinyint#!#sql_variant#!#bit#!#sql_variant +~~END~~ + + +SELECT * FROM sys_sequences_test_view +GO +~~START~~ +varchar#!#int#!#int#!#int#!#int#!#char#!#nvarchar#!#datetime#!#datetime#!#bit#!#bit#!#bit#!#sql_variant#!#sql_variant#!#sql_variant#!#sql_variant#!#bit#!#bit#!#int#!#int#!#int#!#tinyint#!#tinyint#!#sql_variant#!#bit#!#sql_variant +~~END~~ + + +EXEC sys_sequences_test_proc +GO +~~START~~ +varchar#!#int#!#int#!#int#!#int#!#char#!#nvarchar#!#datetime#!#datetime#!#bit#!#bit#!#bit#!#sql_variant#!#sql_variant#!#sql_variant#!#sql_variant#!#bit#!#bit#!#int#!#int#!#int#!#tinyint#!#tinyint#!#sql_variant#!#bit#!#sql_variant +~~END~~ + + +SELECT dbo.sys_sequences_test_func() +GO +~~START~~ +int +0 +~~END~~ + + +SELECT +SCHEMA_NAME(seq.schema_id) AS [Schema], +seq.name AS [Name] +FROM +sys.sequences AS seq +ORDER BY +[Schema] ASC,[Name] ASC +GO +~~START~~ +varchar#!#varchar +~~END~~ + diff --git a/test/JDBC/expected/sys_sysusers_dep-vu-verify.out b/test/JDBC/expected/sys_sysusers_dep-vu-verify.out index b6b1b142253..032701d97f2 100644 --- a/test/JDBC/expected/sys_sysusers_dep-vu-verify.out +++ b/test/JDBC/expected/sys_sysusers_dep-vu-verify.out @@ -211,7 +211,11 @@ FROM sysusersdb.dbo.sysusers WHERE name LIKE '%sysusers_dep_vu_prepare_%' OR name = 'dbo' or name = 'guest' ORDER BY name GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: Cross-DB system view query is not currently supported in Babelfish.)~~ +~~START~~ +varchar#!#int#!#int#!#int#!#int#!#int +dbo#!#1#!#1#!#0#!#1#!#0 +guest#!#0#!#1#!#0#!#1#!#0 +sysusers_dep_vu_prepare_user1#!#1#!#1#!#0#!#1#!#0 +sysusers_dep_vu_prepare_user2#!#1#!#1#!#0#!#1#!#0 +~~END~~ diff --git a/test/JDBC/expected/temp_table.out b/test/JDBC/expected/temp_table.out new file mode 100644 index 00000000000..64018079d48 --- /dev/null +++ b/test/JDBC/expected/temp_table.out @@ -0,0 +1,89 @@ +-- BABEL-4912 test ALTER TABLE for temp tables +CREATE TABLE #t1 (a INT IDENTITY PRIMARY KEY NOT NULL, b INT) +GO + +INSERT INTO #t1 (b) values (1) +GO +~~ROW COUNT: 1~~ + + +SELECT * FROM #t1 +GO +~~START~~ +int#!#int +1#!#1 +~~END~~ + + +ALTER TABLE #t1 DROP COLUMN b +GO + +SELECT * FROM #t1 +GO +~~START~~ +int +1 +~~END~~ + + +ALTER TABLE #t1 ADD b varchar(20) +GO + +SELECT * FROM #t1 +GO +~~START~~ +int#!#varchar +1#!# +~~END~~ + + +ALTER TABLE #t1 ADD c AS a + 1 +GO + +SELECT * FROM #t1 +GO +~~START~~ +int#!#varchar#!#int +1#!##!#2 +~~END~~ + + +ALTER TABLE #t1 DROP COLUMN a +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cannot drop a column used by a generated column)~~ + + +SELECT * FROM #t1 +GO +~~START~~ +int#!#varchar#!#int +1#!##!#2 +~~END~~ + + +ALTER TABLE #t1 DROP COLUMN b +GO + +SELECT * FROM #t1 +GO +~~START~~ +int#!#int +1#!#2 +~~END~~ + + +ALTER TABLE #t1 DROP COLUMN c +GO + +SELECT * FROM #t1 +GO +~~START~~ +int +1 +~~END~~ + + +DROP TABLE #t1 +GO diff --git a/test/JDBC/expected/temp_table_jdbc.out b/test/JDBC/expected/temp_table_jdbc.out index e69de29bb2d..015a827d62d 100644 --- a/test/JDBC/expected/temp_table_jdbc.out +++ b/test/JDBC/expected/temp_table_jdbc.out @@ -0,0 +1 @@ +Cannot create trigger on a temporary object. \ No newline at end of file diff --git a/test/JDBC/expected/temp_table_rollback-vu-verify.out b/test/JDBC/expected/temp_table_rollback-vu-verify.out index da649155143..199b6d3bd62 100644 --- a/test/JDBC/expected/temp_table_rollback-vu-verify.out +++ b/test/JDBC/expected/temp_table_rollback-vu-verify.out @@ -144,7 +144,7 @@ COMMIT GO ---------------------------------------------------------- --- ALTER TABLE (should fail due to BABEL-4912) +-- ALTER TABLE (BABEL-4912) ---------------------------------------------------------- CREATE TABLE #temp_table_rollback_t1 (a int, b int) GO @@ -153,37 +153,21 @@ BEGIN TRAN ALTER TABLE #temp_table_rollback_t1 DROP COLUMN b ROLLBACK GO -~~ERROR (Code: 3726)~~ - -~~ERROR (Message: cannot drop column b of table "#temp_table_rollback_t1" because other objects depend on it)~~ - BEGIN TRAN ALTER TABLE #temp_table_rollback_t1 ALTER COLUMN b VARCHAR ROLLBACK GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: unexpected object depending on column: type "#temp_table_rollback_t1")~~ - BEGIN TRAN -ALTER TABLE #temp_table_rollback_t1 DROP COLUMN b +ALTER TABLE #temp_table_rollback_t1 ALTER COLUMN b VARCHAR COMMIT GO -~~ERROR (Code: 3726)~~ - -~~ERROR (Message: cannot drop column b of table "#temp_table_rollback_t1" because other objects depend on it)~~ - BEGIN TRAN -ALTER TABLE #temp_table_rollback_t1 ALTER COLUMN b VARCHAR +ALTER TABLE #temp_table_rollback_t1 DROP COLUMN b COMMIT GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: unexpected object depending on column: type "#temp_table_rollback_t1")~~ - DROP TABLE #temp_table_rollback_t1 GO diff --git a/test/JDBC/expected/temp_table_rollback_isolation_read_uncommitted.out b/test/JDBC/expected/temp_table_rollback_isolation_read_uncommitted.out index a69d701906b..9f8a489859e 100644 --- a/test/JDBC/expected/temp_table_rollback_isolation_read_uncommitted.out +++ b/test/JDBC/expected/temp_table_rollback_isolation_read_uncommitted.out @@ -212,7 +212,7 @@ COMMIT GO ---------------------------------------------------------- --- ALTER TABLE (should fail due to BABEL-4912) +-- ALTER TABLE (BABEL-4912) ---------------------------------------------------------- CREATE TABLE #temp_table_rollback_t1 (a int, b int) GO @@ -221,37 +221,21 @@ BEGIN TRAN ALTER TABLE #temp_table_rollback_t1 DROP COLUMN b ROLLBACK GO -~~ERROR (Code: 3726)~~ - -~~ERROR (Message: cannot drop column b of table "#temp_table_rollback_t1" because other objects depend on it)~~ - BEGIN TRAN ALTER TABLE #temp_table_rollback_t1 ALTER COLUMN b VARCHAR ROLLBACK GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: unexpected object depending on column: type "#temp_table_rollback_t1")~~ - BEGIN TRAN -ALTER TABLE #temp_table_rollback_t1 DROP COLUMN b +ALTER TABLE #temp_table_rollback_t1 ALTER COLUMN b VARCHAR COMMIT GO -~~ERROR (Code: 3726)~~ - -~~ERROR (Message: cannot drop column b of table "#temp_table_rollback_t1" because other objects depend on it)~~ - BEGIN TRAN -ALTER TABLE #temp_table_rollback_t1 ALTER COLUMN b VARCHAR +ALTER TABLE #temp_table_rollback_t1 DROP COLUMN b COMMIT GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: unexpected object depending on column: type "#temp_table_rollback_t1")~~ - DROP TABLE #temp_table_rollback_t1 GO diff --git a/test/JDBC/expected/temp_table_rollback_isolation_snapshot.out b/test/JDBC/expected/temp_table_rollback_isolation_snapshot.out index b155ec955a1..f8dfa0e45bc 100644 --- a/test/JDBC/expected/temp_table_rollback_isolation_snapshot.out +++ b/test/JDBC/expected/temp_table_rollback_isolation_snapshot.out @@ -212,7 +212,7 @@ COMMIT GO ---------------------------------------------------------- --- ALTER TABLE (should fail due to BABEL-4912) +-- ALTER TABLE (BABEL-4912) ---------------------------------------------------------- CREATE TABLE #temp_table_rollback_t1 (a int, b int) GO @@ -221,37 +221,21 @@ BEGIN TRAN ALTER TABLE #temp_table_rollback_t1 DROP COLUMN b ROLLBACK GO -~~ERROR (Code: 3726)~~ - -~~ERROR (Message: cannot drop column b of table "#temp_table_rollback_t1" because other objects depend on it)~~ - BEGIN TRAN ALTER TABLE #temp_table_rollback_t1 ALTER COLUMN b VARCHAR ROLLBACK GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: unexpected object depending on column: type "#temp_table_rollback_t1")~~ - BEGIN TRAN -ALTER TABLE #temp_table_rollback_t1 DROP COLUMN b +ALTER TABLE #temp_table_rollback_t1 ALTER COLUMN b VARCHAR COMMIT GO -~~ERROR (Code: 3726)~~ - -~~ERROR (Message: cannot drop column b of table "#temp_table_rollback_t1" because other objects depend on it)~~ - BEGIN TRAN -ALTER TABLE #temp_table_rollback_t1 ALTER COLUMN b VARCHAR +ALTER TABLE #temp_table_rollback_t1 DROP COLUMN b COMMIT GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: unexpected object depending on column: type "#temp_table_rollback_t1")~~ - DROP TABLE #temp_table_rollback_t1 GO diff --git a/test/JDBC/expected/temp_table_rollback_xact_abort_on.out b/test/JDBC/expected/temp_table_rollback_xact_abort_on.out index a219ad4cb0d..bc1a1f39612 100644 --- a/test/JDBC/expected/temp_table_rollback_xact_abort_on.out +++ b/test/JDBC/expected/temp_table_rollback_xact_abort_on.out @@ -212,7 +212,7 @@ COMMIT GO ---------------------------------------------------------- --- ALTER TABLE (should fail due to BABEL-4912) +-- ALTER TABLE (BABEL-4912) ---------------------------------------------------------- CREATE TABLE #temp_table_rollback_t1 (a int, b int) GO @@ -221,37 +221,21 @@ BEGIN TRAN ALTER TABLE #temp_table_rollback_t1 DROP COLUMN b ROLLBACK GO -~~ERROR (Code: 3726)~~ - -~~ERROR (Message: cannot drop column b of table "#temp_table_rollback_t1" because other objects depend on it)~~ - BEGIN TRAN ALTER TABLE #temp_table_rollback_t1 ALTER COLUMN b VARCHAR ROLLBACK GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: unexpected object depending on column: type "#temp_table_rollback_t1")~~ - BEGIN TRAN -ALTER TABLE #temp_table_rollback_t1 DROP COLUMN b +ALTER TABLE #temp_table_rollback_t1 ALTER COLUMN b VARCHAR COMMIT GO -~~ERROR (Code: 3726)~~ - -~~ERROR (Message: cannot drop column b of table "#temp_table_rollback_t1" because other objects depend on it)~~ - BEGIN TRAN -ALTER TABLE #temp_table_rollback_t1 ALTER COLUMN b VARCHAR +ALTER TABLE #temp_table_rollback_t1 DROP COLUMN b COMMIT GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: unexpected object depending on column: type "#temp_table_rollback_t1")~~ - DROP TABLE #temp_table_rollback_t1 GO diff --git a/test/JDBC/expected/test_like_for_AI-vu-verify.out b/test/JDBC/expected/test_like_for_AI-vu-verify.out index e35177c9cd4..557a3a85527 100644 --- a/test/JDBC/expected/test_like_for_AI-vu-verify.out +++ b/test/JDBC/expected/test_like_for_AI-vu-verify.out @@ -1747,7 +1747,7 @@ Hi café SELECT UPPER((SELECT col FROM test_like_for_AI_prepare_t1_ci WHERE col LIKE '%oNo')); GO ~~START~~ -text +nvarchar TELÉFONO ~~END~~ @@ -4357,7 +4357,7 @@ Hi café SELECT UPPER((SELECT col FROM test_like_for_AI_prepare_t1_cs WHERE col LIKE '%no')); GO ~~START~~ -text +nvarchar JALAPEÑO ~~END~~ diff --git a/test/JDBC/expected/test_search_path.out b/test/JDBC/expected/test_search_path.out new file mode 100644 index 00000000000..7e057f6fdb7 --- /dev/null +++ b/test/JDBC/expected/test_search_path.out @@ -0,0 +1,212 @@ +CREATE TABLE babelfish_migration_mode_table (id_num INT IDENTITY(1,1), mig_mode VARCHAR(10)) +GO +INSERT INTO babelfish_migration_mode_table SELECT current_setting('babelfishpg_tsql.migration_mode') +GO +~~ROW COUNT: 1~~ + + +-- test multi-db mode +SELECT set_config('role', 'jdbc_user', false); +GO +~~START~~ +text +jdbc_user +~~END~~ + +SELECT set_config('babelfishpg_tsql.migration_mode', 'multi-db', false); +GO +~~START~~ +text +multi-db +~~END~~ + + +-- check if correct schema is present in search path +CREATE DATABASE ["BABEL_5111.db"] +GO + +CREATE DATABASE ["龙漫远; 龍漫遠.¢£€¥"] +GO + +use ["BABEL_5111.db"] +GO + +CREATE TABLE t1(a int) +GO + +SELECT current_setting('search_path') +GO +~~START~~ +text +"""babel_5111.db""_dbo", "$user", sys, pg_catalog +~~END~~ + + +CREATE SCHEMA ["BABEL_5111.scm"] +GO + +CREATE TABLE ["BABEL_5111.scm"].t1(a int) +GO + +CREATE VIEW ["BABEL_5111.scm"].v1 AS SELECT 1 +GO + +CREATE PROCEDURE ["BABEL_5111.scm"].p1 AS SELECT 1 +GO + +CREATE TRIGGER ["BABEL_5111.scm"].BABEL_5111_trgger1 on ["BABEL_5111.scm"].t1 AFTER INSERT AS BEGIN END +GO + +ALTER TABLE ["BABEL_5111.scm"].t1 ENABLE TRIGGER BABEL_5111_trgger1 +GO + +USE ["龙漫远; 龍漫遠.¢£€¥"] +GO + +CREATE TABLE t1(a int) +GO + +SELECT current_setting('search_path') +GO +~~START~~ +text +"""???; ???.¢£€¥""_dbo", "$user", sys, pg_catalog +~~END~~ + + +CREATE SCHEMA ["BABEL_5111.😃😄😉😊"] +GO + +CREATE TABLE ["BABEL_5111.😃😄😉😊"].t1(a int) +GO + +CREATE VIEW ["BABEL_5111.😃😄😉😊"].v1 AS SELECT 1 +GO + +CREATE PROCEDURE ["BABEL_5111.😃😄😉😊"].p1 AS SELECT 1 +GO + +CREATE TRIGGER ["BABEL_5111.😃😄😉😊"].BABEL_5111_trgger1 on ["BABEL_5111.😃😄😉😊"].t1 AFTER INSERT AS BEGIN END +GO + +ALTER TABLE ["BABEL_5111.😃😄😉😊"].t1 ENABLE TRIGGER BABEL_5111_trgger1 +GO + +USE master +GO + +EXEC ["BABEL_5111.db"].["BABEL_5111.scm"].p1 +GO +~~START~~ +int +1 +~~END~~ + + +SELECT * from ["BABEL_5111.db"].["BABEL_5111.scm"].t1 +GO +~~START~~ +int +~~END~~ + + +SELECT * from ["BABEL_5111.db"].["BABEL_5111.scm"].v1 +GO +~~START~~ +int +1 +~~END~~ + + +EXEC ["龙漫远; 龍漫遠.¢£€¥"].["BABEL_5111.😃😄😉😊"].p1 +GO +~~START~~ +int +1 +~~END~~ + + +SELECT * from ["龙漫远; 龍漫遠.¢£€¥"].["BABEL_5111.😃😄😉😊"].t1 +GO +~~START~~ +int +~~END~~ + + +SELECT * from ["龙漫远; 龍漫遠.¢£€¥"].["BABEL_5111.😃😄😉😊"].v1 +GO +~~START~~ +int +1 +~~END~~ + + +use ["BABEL_5111.db"] +GO + +DROP PROCEDURE ["BABEL_5111.scm"].p1 +GO + +DROP TRIGGER ["BABEL_5111.scm"].BABEL_5111_trgger1 +GO + +DROP VIEW ["BABEL_5111.scm"].v1 +GO + +DROP TABLE ["BABEL_5111.scm"].t1 +GO + +DROP SCHEMA ["BABEL_5111.scm"] +GO + +DROP TABLE t1 +GO + +USE ["龙漫远; 龍漫遠.¢£€¥"] +GO + +DROP PROCEDURE ["BABEL_5111.😃😄😉😊"].p1 +GO + +DROP TRIGGER ["BABEL_5111.😃😄😉😊"].BABEL_5111_trgger1 +GO + +DROP VIEW ["BABEL_5111.😃😄😉😊"].v1 +GO + +DROP TABLE ["BABEL_5111.😃😄😉😊"].t1 +GO + +DROP SCHEMA ["BABEL_5111.😃😄😉😊"] +GO + +USE master +GO + +DROP DATABASE ["BABEL_5111.db"] +GO + +DROP DATABASE ["龙漫远; 龍漫遠.¢£€¥"] +GO + +SELECT set_config('role', 'jdbc_user', false); +GO +~~START~~ +text +jdbc_user +~~END~~ + + +-- Reset migration mode to default +DECLARE @mig_mode VARCHAR(10) +SET @mig_mode = (SELECT mig_mode FROM babelfish_migration_mode_table WHERE id_num = 1) +SELECT CASE WHEN (SELECT set_config('babelfishpg_tsql.migration_mode', @mig_mode, false)) IS NOT NULL THEN 1 ELSE 0 END +GO +~~START~~ +int +1 +~~END~~ + + +Drop Table IF EXISTS babelfish_migration_mode_table +GO diff --git a/test/JDBC/expected/translate-before-15_8-or-16_4-vu-cleanup.out b/test/JDBC/expected/translate-before-15_8-or-16_4-vu-cleanup.out new file mode 100644 index 00000000000..d6a6689cf43 --- /dev/null +++ b/test/JDBC/expected/translate-before-15_8-or-16_4-vu-cleanup.out @@ -0,0 +1,56 @@ +DROP FUNCTION babel_4837_translate_itvf_func +GO + +DROP FUNCTION babel_4837_translate_dep_func +GO + +DROP PROCEDURE babel_4837_translate_dep_proc +GO + +DROP VIEW babel_4837_translate_dep_view +GO + +DROP VIEW babel_4837_translate_dep_view1 +GO + +DROP TABLE babel_4837_translate_UDT +GO + +DROP TYPE dbo.babel_4837_translate_varUDT +GO + +DROP TYPE dbo.babel_4837_translate_imageUDT +GO + +DROP TABLE babel_4837_translate_text +GO + +DROP TABLE babel_4837_translate_image +GO + +DROP TABLE babel_4837_translate_arabic_ci_ai +GO + +DROP TABLE babel_4837_translate_arabic_cs_as +GO + +DROP TABLE babel_4837_translate_arabic_ci_as +GO + +DROP TABLE babel_4837_translate_chinese_prc_ci_ai +GO + +DROP TABLE babel_4837_translate_chinese_prc_cs_as +GO + +DROP TABLE babel_4837_translate_chinese_prc_ci_as +GO + +DROP TABLE babel_4837_translate_t3 +GO + +DROP TABLE babel_4837_translate_t2 +GO + +DROP TABLE babel_4837_translate_t1 +GO diff --git a/test/JDBC/expected/translate-before-15_8-or-16_4-vu-prepare.out b/test/JDBC/expected/translate-before-15_8-or-16_4-vu-prepare.out new file mode 100644 index 00000000000..bc492b78807 --- /dev/null +++ b/test/JDBC/expected/translate-before-15_8-or-16_4-vu-prepare.out @@ -0,0 +1,118 @@ +CREATE TABLE babel_4837_translate_t1(a NCHAR(50), b NCHAR(20), c NCHAR(20)) +GO +INSERT INTO babel_4837_translate_t1 VALUES(N' abc🙂defghi🙂🙂 ', N'ab🙂', N'x🙂y') +INSERT INTO babel_4837_translate_t1 VALUES(N' 比尔·拉莫斯 ', N'比拉斯', N'尔·比') +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4837_translate_t2(a NVARCHAR(50), b NVARCHAR(20), c NVARCHAR(20)) +GO +INSERT INTO babel_4837_translate_t2 VALUES(N' abc🙂defghi🙂🙂 ', N'ab🙂', N'x🙂y') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4837_translate_t3(a VARCHAR(50), b VARCHAR(20), c VARCHAR(20)) +GO +INSERT INTO babel_4837_translate_t3 VALUES(' abc🙂defghi🙂🙂 ', 'ab🙂', 'x🙂y') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4837_translate_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CI_AS, c VARCHAR(20) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4837_translate_chinese_prc_ci_as VALUES(N' 比尔·拉莫斯 ', N'比拉斯', N'尔·比') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4837_translate_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CS_AS, c VARCHAR(20) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4837_translate_chinese_prc_cs_as VALUES(N' 比尔·拉莫斯 ', N'比拉斯', N'尔·比') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4837_translate_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI, b VARCHAR(20) COLLATE CHINESE_PRC_CI_AI, c VARCHAR(20) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4837_translate_chinese_prc_ci_ai VALUES(N' 比尔·拉莫斯 ', N'比拉斯', N'尔·比') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4837_translate_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS, b VARCHAR(20) COLLATE ARABIC_CI_AS, c VARCHAR(20) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4837_translate_arabic_ci_as VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4837_translate_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS, b VARCHAR(20) COLLATE ARABIC_CS_AS, c VARCHAR(20) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4837_translate_arabic_cs_as VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4837_translate_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI, b VARCHAR(20) COLLATE ARABIC_CI_AI, c VARCHAR(20) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4837_translate_arabic_ci_ai VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4837_translate_image(a IMAGE) +GO +INSERT INTO babel_4837_translate_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4837_translate_text(a TEXT, b NTEXT, c NTEXT) +GO +INSERT INTO babel_4837_translate_text VALUES (N' abc🙂defghi🙂🙂 ', N' abc🙂defghi🙂🙂 ', N' sbc🙂defjhi🙂🙂 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TYPE dbo.babel_4837_translate_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4837_translate_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4837_translate_UDT(a dbo.babel_4837_translate_imageUDT, b dbo.babel_4837_translate_varUDT, c dbo.babel_4837_translate_varUDT) +GO +INSERT INTO babel_4837_translate_UDT VALUES(CAST('abcdef' as dbo.babel_4837_translate_imageUDT), CAST('abcdef' as dbo.babel_4837_translate_varUDT), CAST('abcdef' as dbo.babel_4837_translate_varUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_4837_translate_dep_view AS + SELECT ('|' + TRANSLATE(a, b, c) + '|') as result FROM babel_4837_translate_t2 +GO + +CREATE VIEW babel_4837_translate_dep_view1 AS + SELECT ('|' + TRANSLATE(a, b, c) + '|') as result FROM babel_4837_translate_t3 +GO + +CREATE PROCEDURE babel_4837_translate_dep_proc AS + SELECT ('|' + TRANSLATE(a, b, c) + '|') as result FROM babel_4837_translate_t2 +GO + +CREATE FUNCTION babel_4837_translate_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 ('|' + TRANSLATE(a, b, c) + '|') FROM babel_4837_translate_t2) +END +GO + +CREATE FUNCTION babel_4837_translate_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT ('|' + TRANSLATE(a, b, c) + '|') as result FROM babel_4837_translate_t2) +GO diff --git a/test/JDBC/expected/translate-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/translate-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..13b05f6704a --- /dev/null +++ b/test/JDBC/expected/translate-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,2736 @@ +DECLARE @string1 nvarchar(30) = N'比尔·拉' +DECLARE @characters nvarchar(10) = N'尔', @translation nvarchar(10) = N'莫' +SELECT TRANSLATE(@string1, @characters, @translation) +GO +~~START~~ +nvarchar +比莫·拉 +~~END~~ + + +-- NULL +SELECT TRANSLATE(NULL, 'acs', 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE('scd', NULL, 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE('scd', 'scd', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE(NULL, NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE(NULL, 'aces', 'scdwe') +GO +~~START~~ +varchar + +~~END~~ + + +-- different no. of arguments +SELECT TRANSLATE('aceds', 'aces', 'scdwe', 'acsdes') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.translate function requires 3 arguments)~~ + + +SELECT TRANSLATE('aces', 'scdwe') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.translate function requires 3 arguments)~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +varchar +|????·?????????????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|????·?????????????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(10) = '比拉斯 ', @translations CHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| ??·??? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(10) = '比拉斯 ', @translations CHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| ??·??? | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +varchar +|????··??????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(10) = '比拉斯 ', @translations VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| ??·??? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(10) = '比拉斯 ', @translations VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(MAX) = '比拉斯 ', @translations VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| ??·??? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(MAX) = '比拉斯 ', @translations VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_ci_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4837_translate_chinese_prc_ci_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_cs_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4837_translate_chinese_prc_cs_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4837_translate_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CI_AS + '|' FROM babel_4837_translate_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CS_AS + '|' FROM babel_4837_translate_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CI_AI + '|' FROM babel_4837_translate_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +nvarchar +|????·?????????????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +|????·?????????????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(10) = N'比拉斯 ', @translations NCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| ??·??? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(10) = N'比拉斯 ', @translations NCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +| ??·??? | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_t1 +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +| 尔尔··莫比 | +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(10) = N'比拉斯 ', @translations NVARCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(10) = N'比拉斯 ', @translations NVARCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(MAX) = N'比拉斯 ', @translations NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(MAX) = N'比拉斯 ', @translations NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4837_translate_dep_view +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +SELECT * FROM babel_4837_translate_dep_view1 +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +EXEC babel_4837_translate_dep_proc +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +SELECT * FROM babel_4837_translate_dep_func() +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +SELECT * FROM babel_4837_translate_itvf_func() +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +-- different datatypes of inputString and characters/translations +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|????·?????????????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|????·?????????????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|????·?????????????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|????·???????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|????·???????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations)+ '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|????··??????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|????·?????????????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|????·?????????????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|????·?????????????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??比尔·拉莫斯????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??比尔·拉莫斯????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = N' ABCDEF ', @characters BINARY(4) = 0x414243, @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @characters NCHAR(20) = N'尔·比?', @translations VARBINARY(2) = 0x4144 +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 1 of translate function.)~~ + + +-- input type UDT +-- in table babel_4837_translate_UDT, col 'a' has basetype image and col 'b' and 'c' have basetype varchar +SELECT TRANSLATE(a, b, c) FROM babel_4837_translate_UDT +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE(b, b, c) FROM babel_4837_translate_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT TRANSLATE(@inputString, '12', '06'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString date = '2016-12-21', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters date = '2016-12-21', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters VARCHAR(20) = '2016-12-21', @translations date = '2016-12-21'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of translate function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @date date = '2016-12-21', @translations VARCHAR(10) = '06'; +DECLARE @characters datetime = @date; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters VARCHAR(20) = '2016-12-21', @date date = '2016-12-21'; +DECLARE @translations datetime = @date; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @characters smalldatetime = '2016-12-21 12:43:10', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @characters VARCHAR(30) = '2016-12-21 12:43:10', @translations smalldatetime = '2016-12-21 12:43:10'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @characters time(4) = '12:10:05.1237', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @characters VARCHAR(30) = '12:10:05.1237', @translations time(4) = '12:10:05.1237'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @characters datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @characters VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @translations datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @characters datetime2(4) = '1968-10-23 12:45:37.1237', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @characters VARCHAR(50) = '1968-10-23 12:45:37.1237', @translations datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString decimal = 123456, @characters decimal = 12, @translations decimal = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters decimal = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations decimal = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString numeric = 12345.12, @characters numeric = 12, @translations numeric = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters numeric = 12.12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations numeric = 12.12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString float = 12345.1, @characters float = 12, @translations float = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters float = 12.1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations float = 12.1; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString real = 12345.1, @characters real = 12, @translations real = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters real = 12.1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations real = 12.1; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString bigint = 12345678, @characters bigint = 12, @translations bigint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters bigint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations bigint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString int = 12345678, @characters int = 12, @translations int = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters int = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations int = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smallint = 12356, @characters smallint = 12, @translations smallint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters smallint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations smallint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString tinyint = 235, @characters tinyint = 12, @translations tinyint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters tinyint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations tinyint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString money = 12356, @characters money = 12, @translations money = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters money = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations money = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smallmoney = 12356, @characters smallmoney = 12, @translations smallmoney = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters smallmoney = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations smallmoney = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString bit = 1, @characters bit = 1, @translations bit = 0; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters bit = 1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations bit = 0; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE(a, a, a) FROM babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE('a', a, 'a') FROM babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of translate function.)~~ + + +SELECT TRANSLATE('a', 'a', a) FROM babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of translate function.)~~ + + +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(a, @characters, @translations) from babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE(a, b, c) FROM babel_4837_translate_text +GO +~~START~~ +varchar + sbc?defjhi?? +~~END~~ + +SELECT TRANSLATE('qw', a, 'cd') FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE('qw', 'ab', a) FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE(b, a, c) FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE('qw', c, 'cd') FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE('qw', 'ab', b) FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @characters VARCHAR(20) = 'ab?', @translations VARCHAR(10) = 'x?y'; +SELECT TRANSLATE(a, @characters, @translations) FROM babel_4837_translate_text +GO +~~START~~ +varchar + x?c?defghi?? +~~END~~ + + +DECLARE @characters VARCHAR(20) = 'ab?', @translations VARCHAR(10) = 'x?y'; +SELECT TRANSLATE(b, @characters, @translations) FROM babel_4837_translate_text +GO +~~START~~ +nvarchar + x?c🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @characters xml = CAST ('' AS xml), @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters xml = CAST ('' AS xml), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters geometry = geometry::STGeomFromText('POINT (1 2)', 0), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters geography = geography::STGeomFromText('POINT (1 2)', 4326), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations geography = geography::STGeomFromText('POINT (1 2)', 4326); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), @characters, @translations) +GO +~~START~~ +varchar +5A9519AA-8B85-D011-B42D-00C04AC954AA +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @characters xml = CAST ('' AS xml), @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), CAST (@characters AS VARCHAR(50)), CAST (@translations AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), @characters, @translations) +GO +~~START~~ +varchar +POINT(4 5) +~~END~~ + diff --git a/test/JDBC/expected/translate-vu-cleanup.out b/test/JDBC/expected/translate-vu-cleanup.out new file mode 100644 index 00000000000..d6a6689cf43 --- /dev/null +++ b/test/JDBC/expected/translate-vu-cleanup.out @@ -0,0 +1,56 @@ +DROP FUNCTION babel_4837_translate_itvf_func +GO + +DROP FUNCTION babel_4837_translate_dep_func +GO + +DROP PROCEDURE babel_4837_translate_dep_proc +GO + +DROP VIEW babel_4837_translate_dep_view +GO + +DROP VIEW babel_4837_translate_dep_view1 +GO + +DROP TABLE babel_4837_translate_UDT +GO + +DROP TYPE dbo.babel_4837_translate_varUDT +GO + +DROP TYPE dbo.babel_4837_translate_imageUDT +GO + +DROP TABLE babel_4837_translate_text +GO + +DROP TABLE babel_4837_translate_image +GO + +DROP TABLE babel_4837_translate_arabic_ci_ai +GO + +DROP TABLE babel_4837_translate_arabic_cs_as +GO + +DROP TABLE babel_4837_translate_arabic_ci_as +GO + +DROP TABLE babel_4837_translate_chinese_prc_ci_ai +GO + +DROP TABLE babel_4837_translate_chinese_prc_cs_as +GO + +DROP TABLE babel_4837_translate_chinese_prc_ci_as +GO + +DROP TABLE babel_4837_translate_t3 +GO + +DROP TABLE babel_4837_translate_t2 +GO + +DROP TABLE babel_4837_translate_t1 +GO diff --git a/test/JDBC/expected/translate-vu-prepare.out b/test/JDBC/expected/translate-vu-prepare.out new file mode 100644 index 00000000000..bc492b78807 --- /dev/null +++ b/test/JDBC/expected/translate-vu-prepare.out @@ -0,0 +1,118 @@ +CREATE TABLE babel_4837_translate_t1(a NCHAR(50), b NCHAR(20), c NCHAR(20)) +GO +INSERT INTO babel_4837_translate_t1 VALUES(N' abc🙂defghi🙂🙂 ', N'ab🙂', N'x🙂y') +INSERT INTO babel_4837_translate_t1 VALUES(N' 比尔·拉莫斯 ', N'比拉斯', N'尔·比') +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4837_translate_t2(a NVARCHAR(50), b NVARCHAR(20), c NVARCHAR(20)) +GO +INSERT INTO babel_4837_translate_t2 VALUES(N' abc🙂defghi🙂🙂 ', N'ab🙂', N'x🙂y') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4837_translate_t3(a VARCHAR(50), b VARCHAR(20), c VARCHAR(20)) +GO +INSERT INTO babel_4837_translate_t3 VALUES(' abc🙂defghi🙂🙂 ', 'ab🙂', 'x🙂y') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4837_translate_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CI_AS, c VARCHAR(20) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4837_translate_chinese_prc_ci_as VALUES(N' 比尔·拉莫斯 ', N'比拉斯', N'尔·比') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4837_translate_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CS_AS, c VARCHAR(20) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4837_translate_chinese_prc_cs_as VALUES(N' 比尔·拉莫斯 ', N'比拉斯', N'尔·比') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4837_translate_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI, b VARCHAR(20) COLLATE CHINESE_PRC_CI_AI, c VARCHAR(20) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4837_translate_chinese_prc_ci_ai VALUES(N' 比尔·拉莫斯 ', N'比拉斯', N'尔·比') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4837_translate_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS, b VARCHAR(20) COLLATE ARABIC_CI_AS, c VARCHAR(20) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4837_translate_arabic_ci_as VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4837_translate_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS, b VARCHAR(20) COLLATE ARABIC_CS_AS, c VARCHAR(20) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4837_translate_arabic_cs_as VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4837_translate_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI, b VARCHAR(20) COLLATE ARABIC_CI_AI, c VARCHAR(20) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4837_translate_arabic_ci_ai VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4837_translate_image(a IMAGE) +GO +INSERT INTO babel_4837_translate_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4837_translate_text(a TEXT, b NTEXT, c NTEXT) +GO +INSERT INTO babel_4837_translate_text VALUES (N' abc🙂defghi🙂🙂 ', N' abc🙂defghi🙂🙂 ', N' sbc🙂defjhi🙂🙂 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TYPE dbo.babel_4837_translate_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4837_translate_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4837_translate_UDT(a dbo.babel_4837_translate_imageUDT, b dbo.babel_4837_translate_varUDT, c dbo.babel_4837_translate_varUDT) +GO +INSERT INTO babel_4837_translate_UDT VALUES(CAST('abcdef' as dbo.babel_4837_translate_imageUDT), CAST('abcdef' as dbo.babel_4837_translate_varUDT), CAST('abcdef' as dbo.babel_4837_translate_varUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_4837_translate_dep_view AS + SELECT ('|' + TRANSLATE(a, b, c) + '|') as result FROM babel_4837_translate_t2 +GO + +CREATE VIEW babel_4837_translate_dep_view1 AS + SELECT ('|' + TRANSLATE(a, b, c) + '|') as result FROM babel_4837_translate_t3 +GO + +CREATE PROCEDURE babel_4837_translate_dep_proc AS + SELECT ('|' + TRANSLATE(a, b, c) + '|') as result FROM babel_4837_translate_t2 +GO + +CREATE FUNCTION babel_4837_translate_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 ('|' + TRANSLATE(a, b, c) + '|') FROM babel_4837_translate_t2) +END +GO + +CREATE FUNCTION babel_4837_translate_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT ('|' + TRANSLATE(a, b, c) + '|') as result FROM babel_4837_translate_t2) +GO diff --git a/test/JDBC/expected/translate-vu-verify.out b/test/JDBC/expected/translate-vu-verify.out new file mode 100644 index 00000000000..4f0f9134241 --- /dev/null +++ b/test/JDBC/expected/translate-vu-verify.out @@ -0,0 +1,2736 @@ +DECLARE @string1 nvarchar(30) = N'比尔·拉' +DECLARE @characters nvarchar(10) = N'尔', @translation nvarchar(10) = N'莫' +SELECT TRANSLATE(@string1, @characters, @translation) +GO +~~START~~ +nvarchar +比莫·拉 +~~END~~ + + +-- NULL +SELECT TRANSLATE(NULL, 'acs', 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE('scd', NULL, 'scd') +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE('scd', 'scd', NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE(NULL, NULL, NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRANSLATE(NULL, 'aces', 'scdwe') +GO +~~START~~ +varchar + +~~END~~ + + +-- different no. of arguments +SELECT TRANSLATE('aceds', 'aces', 'scdwe', 'acsdes') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.translate function requires 3 arguments)~~ + + +SELECT TRANSLATE('aces', 'scdwe') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The sys.translate function requires 3 arguments)~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +varchar +|????·?????????????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|????·?????????????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(10) = '比拉斯 ', @translations CHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| ??·??? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(10) = '比拉斯 ', @translations CHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| ??·??? | +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +varchar +|????··??????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(10) = '比拉斯 ', @translations VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| ??·??? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(10) = '比拉斯 ', @translations VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(MAX) = '比拉斯 ', @translations VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| ??·??? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(MAX) = '比拉斯 ', @translations VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +| 比尔·拉莫斯 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_ci_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4837_translate_chinese_prc_ci_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_cs_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4837_translate_chinese_prc_cs_as +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4837_translate_chinese_prc_ci_ai +GO +~~START~~ +varchar +| 尔尔··莫比 | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CI_AS + '|' FROM babel_4837_translate_arabic_ci_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CS_AS + '|' FROM babel_4837_translate_arabic_cs_as +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CI_AI + '|' FROM babel_4837_translate_arabic_ci_ai +GO +~~START~~ +varchar +| الله مع المتقمع | +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +nvarchar +|????·?????????????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +|????·?????????????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(10) = N'比拉斯 ', @translations NCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| ??·??? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(10) = N'比拉斯 ', @translations NCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +| ??·??? | +~~END~~ + + +-- with table column of type nchar +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_t1 +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +| 尔尔··莫比 | +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(10) = N'比拉斯 ', @translations NVARCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(10) = N'比拉斯 ', @translations NVARCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(MAX) = N'比拉斯 ', @translations NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(MAX) = N'比拉斯 ', @translations NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +nvarchar +| 比尔·拉莫斯 | +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4837_translate_dep_view +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +SELECT * FROM babel_4837_translate_dep_view1 +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +EXEC babel_4837_translate_dep_proc +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +SELECT * FROM babel_4837_translate_dep_func() +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +SELECT * FROM babel_4837_translate_itvf_func() +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +-- different datatypes of inputString and characters/translations +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|????·?????????????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|????·?????????????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|????·?????????????????????????????????????????????| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|????·???????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|????·???????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations)+ '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +|????··??????| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +varchar +| x?c?defghi?? | +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|????·?????????????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|????·?????????????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c?defghi?? | +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|????·?????????????????????????????????????????????| +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??比尔·拉莫斯????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂cydefghiyy | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??尔尔··莫比????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x?c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +|??比尔·拉莫斯????| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~START~~ +nvarchar +| x🙂c🙂defghi🙂🙂 | +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @inputString NVARCHAR(50) = N' ABCDEF ', @characters BINARY(4) = 0x414243, @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @characters NCHAR(20) = N'尔·比?', @translations VARBINARY(2) = 0x4144 +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 1 of translate function.)~~ + + +-- input type UDT +-- in table babel_4837_translate_UDT, col 'a' has basetype image and col 'b' and 'c' have basetype varchar +SELECT TRANSLATE(a, b, c) FROM babel_4837_translate_UDT +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE(b, b, c) FROM babel_4837_translate_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT TRANSLATE(@inputString, '12', '06'); +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString date = '2016-12-21', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters date = '2016-12-21', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters VARCHAR(20) = '2016-12-21', @translations date = '2016-12-21'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of translate function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @date date = '2016-12-21', @translations VARCHAR(10) = '06'; +DECLARE @characters datetime = @date; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters VARCHAR(20) = '2016-12-21', @date date = '2016-12-21'; +DECLARE @translations datetime = @date; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @characters smalldatetime = '2016-12-21 12:43:10', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @characters VARCHAR(30) = '2016-12-21 12:43:10', @translations smalldatetime = '2016-12-21 12:43:10'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @characters time(4) = '12:10:05.1237', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @characters VARCHAR(30) = '12:10:05.1237', @translations time(4) = '12:10:05.1237'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @characters datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @characters VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @translations datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @characters datetime2(4) = '1968-10-23 12:45:37.1237', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @characters VARCHAR(50) = '1968-10-23 12:45:37.1237', @translations datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString decimal = 123456, @characters decimal = 12, @translations decimal = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters decimal = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations decimal = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString numeric = 12345.12, @characters numeric = 12, @translations numeric = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters numeric = 12.12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations numeric = 12.12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString float = 12345.1, @characters float = 12, @translations float = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters float = 12.1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations float = 12.1; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString real = 12345.1, @characters real = 12, @translations real = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters real = 12.1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations real = 12.1; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString bigint = 12345678, @characters bigint = 12, @translations bigint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters bigint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations bigint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString int = 12345678, @characters int = 12, @translations int = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters int = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations int = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smallint = 12356, @characters smallint = 12, @translations smallint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters smallint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations smallint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString tinyint = 235, @characters tinyint = 12, @translations tinyint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters tinyint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations tinyint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString money = 12356, @characters money = 12, @translations money = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters money = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations money = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString smallmoney = 12356, @characters smallmoney = 12, @translations smallmoney = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters smallmoney = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations smallmoney = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString bit = 1, @characters bit = 1, @translations bit = 0; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters bit = 1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations bit = 0; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE(a, a, a) FROM babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE('a', a, 'a') FROM babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of translate function.)~~ + + +SELECT TRANSLATE('a', 'a', a) FROM babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 3 of translate function.)~~ + + +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(a, @characters, @translations) from babel_4837_translate_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of translate function.)~~ + + +SELECT TRANSLATE(a, b, c) FROM babel_4837_translate_text +GO +~~START~~ +varchar + sbc?defjhi?? +~~END~~ + +SELECT TRANSLATE('qw', a, 'cd') FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE('qw', 'ab', a) FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE(b, a, c) FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE('qw', c, 'cd') FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + +SELECT TRANSLATE('qw', 'ab', b) FROM babel_4837_translate_text +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must have same argument data type.)~~ + + +DECLARE @characters VARCHAR(20) = 'ab?', @translations VARCHAR(10) = 'x?y'; +SELECT TRANSLATE(a, @characters, @translations) FROM babel_4837_translate_text +GO +~~START~~ +varchar + x?c?defghi?? +~~END~~ + + +DECLARE @characters VARCHAR(20) = 'ab?', @translations VARCHAR(10) = 'x?y'; +SELECT TRANSLATE(b, @characters, @translations) FROM babel_4837_translate_text +GO +~~START~~ +nvarchar + x?c🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @characters xml = CAST ('' AS xml), @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters xml = CAST ('' AS xml), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters geometry = geometry::STGeomFromText('POINT (1 2)', 0), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters geography = geography::STGeomFromText('POINT (1 2)', 4326), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of translate function.)~~ + + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations geography = geography::STGeomFromText('POINT (1 2)', 4326); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 3 of translate function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of translate function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), @characters, @translations) +GO +~~START~~ +varchar +5A9519AA-8B85-D011-B42D-00C04AC954AA +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @characters xml = CAST ('' AS xml), @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), CAST (@characters AS VARCHAR(50)), CAST (@translations AS VARCHAR(50))) +GO +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), @characters, @translations) +GO +~~START~~ +varchar +POINT(4 5) +~~END~~ + diff --git a/test/JDBC/expected/trim-before-15_8-or-16_4-vu-cleanup.out b/test/JDBC/expected/trim-before-15_8-or-16_4-vu-cleanup.out new file mode 100644 index 00000000000..a5ab529c011 --- /dev/null +++ b/test/JDBC/expected/trim-before-15_8-or-16_4-vu-cleanup.out @@ -0,0 +1,77 @@ +DROP FUNCTION babel_4489_trim_itvf_func +GO + +DROP FUNCTION babel_4489_trim_dep_func +GO + +DROP PROCEDURE babel_4489_trim_dep_proc +GO + +DROP VIEW babel_4489_trim_dep_view +GO + +DROP VIEW babel_4489_trim_dep_view_1 +GO + +DROP VIEW babel_4489_trim_dep_view_2 +GO + +DROP VIEW babel_4489_trim_dep_view_3 +GO + +DROP VIEW babel_4489_trim_dep_view_4 +GO + +DROP VIEW babel_4489_trim_dep_view_5 +GO + +DROP VIEW babel_4489_trim_dep_view_6 +GO + +DROP TABLE babel_4489_trim_UDT +GO + +DROP TYPE dbo.babel_4489_trim_varUDT +GO + +DROP TYPE dbo.babel_4489_trim_imageUDT +GO + +DROP TABLE babel_4489_trim_text +GO + +DROP TABLE babel_4489_trim_image +GO + +DROP TABLE babel_4489_trim_arabic_ci_ai +GO + +DROP TABLE babel_4489_trim_arabic_cs_as +GO + +DROP TABLE babel_4489_trim_arabic_ci_as +GO + +DROP TABLE babel_4489_trim_chinese_prc_ci_ai +GO + +DROP TABLE babel_4489_trim_chinese_prc_cs_as +GO + +DROP TABLE babel_4489_trim_chinese_prc_ci_as +GO + +DROP TABLE babel_4489_trim_t5 +GO + +DROP TABLE babel_4489_trim_t4 +GO + +DROP TABLE babel_4489_trim_t3 +GO + +DROP TABLE babel_4489_trim_t2 +GO + +DROP TABLE babel_4489_trim_t1 +GO diff --git a/test/JDBC/expected/trim-before-15_8-or-16_4-vu-prepare.out b/test/JDBC/expected/trim-before-15_8-or-16_4-vu-prepare.out new file mode 100644 index 00000000000..468efff53c9 --- /dev/null +++ b/test/JDBC/expected/trim-before-15_8-or-16_4-vu-prepare.out @@ -0,0 +1,152 @@ +CREATE TABLE babel_4489_trim_t1(a NCHAR(50), b NCHAR(20)) +GO +INSERT INTO babel_4489_trim_t1 VALUES(N' abc🙂defghi🙂🙂 ', N'ab🙂 ') +INSERT INTO babel_4489_trim_t1 VALUES(N' 比尔·拉莫斯 ', N'比拉斯 ') +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_trim_t2(a NVARCHAR(50), b NVARCHAR(20)) +GO +INSERT INTO babel_4489_trim_t2 VALUES(N' abc🙂defghi🙂🙂 ', N'ab🙂 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_trim_t3(a CHAR(50), b CHAR(20)) +GO +INSERT INTO babel_4489_trim_t3 VALUES(' abcdefghi ', 'abi ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_trim_t4(a VARCHAR(50), b VARCHAR(20)) +GO +INSERT INTO babel_4489_trim_t4 VALUES(' abcdefghi ', 'abi ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_trim_t5(a VARBINARY(50), b VARBINARY(50)) +GO +INSERT INTO babel_4489_trim_t5 VALUES(0x61626364, 0x6164) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_trim_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4489_trim_chinese_prc_ci_as VALUES(N' 比尔·拉莫斯 ', N'比拉斯 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_trim_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4489_trim_chinese_prc_cs_as VALUES(N' 比尔·拉莫斯 ', N'比拉斯 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_trim_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI, b VARCHAR(20) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4489_trim_chinese_prc_ci_ai VALUES(N' 比尔·拉莫斯 ', N'比拉斯 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_trim_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS, b VARCHAR(20) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4489_trim_arabic_ci_as VALUES(N' الله مع المتقين ', N'ين ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_trim_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS, b VARCHAR(20) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4489_trim_arabic_cs_as VALUES(N' الله مع المتقين ', N'ين ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_trim_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI, b VARCHAR(20) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4489_trim_arabic_ci_ai VALUES(N' الله مع المتقين ', N'ين ') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_trim_image(a IMAGE) +GO +INSERT INTO babel_4489_trim_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE babel_4489_trim_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4489_trim_text VALUES (N' abc🙂defghi🙂🙂 ', N' abc🙂defghi🙂🙂 ') +GO +~~ROW COUNT: 1~~ + + +CREATE TYPE dbo.babel_4489_trim_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4489_trim_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4489_trim_UDT(a dbo.babel_4489_trim_imageUDT, b dbo.babel_4489_trim_varUDT) +GO +INSERT INTO babel_4489_trim_UDT VALUES(CAST('abcdef' as dbo.babel_4489_trim_imageUDT), CAST('abcdef' as dbo.babel_4489_trim_varUDT)) +GO +~~ROW COUNT: 1~~ + + +CREATE VIEW babel_4489_trim_dep_view AS + SELECT ('|' + TRIM(b FROM a) + '|') as result FROM babel_4489_trim_t2 +GO + +CREATE PROCEDURE babel_4489_trim_dep_proc AS + SELECT ('|' + TRIM(b FROM a) + '|') as result FROM babel_4489_trim_t2 +GO + +CREATE FUNCTION babel_4489_trim_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 ('|' + TRIM(b FROM a) + '|') FROM babel_4489_trim_t2) +END +GO + +CREATE VIEW babel_4489_trim_dep_view_1 AS + SELECT ('|' + TRIM(a) + '|') as result FROM babel_4489_trim_t1 +GO + +CREATE VIEW babel_4489_trim_dep_view_2 AS + SELECT ('|' + TRIM(a) + '|') as result FROM babel_4489_trim_t2 +GO + +CREATE VIEW babel_4489_trim_dep_view_3 AS + SELECT ('|' + TRIM(a) + '|') as result FROM babel_4489_trim_t3 +GO + +CREATE VIEW babel_4489_trim_dep_view_4 AS + SELECT ('|' + TRIM(a) + '|') as result FROM babel_4489_trim_t4 +GO + +CREATE VIEW babel_4489_trim_dep_view_5 AS + SELECT ('|' + TRIM(a) + '|') as result FROM babel_4489_trim_t5 +GO + +CREATE VIEW babel_4489_trim_dep_view_6 AS + SELECT ('|' + TRIM(b FROM a) + '|') as result FROM babel_4489_trim_t4 +GO + +CREATE FUNCTION babel_4489_trim_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT ('|' + TRIM(b FROM a) + '|') as result FROM babel_4489_trim_t2) +GO diff --git a/test/JDBC/expected/trim-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/trim-before-15_8-or-16_4-vu-verify.out new file mode 100644 index 00000000000..0e905e48eac --- /dev/null +++ b/test/JDBC/expected/trim-before-15_8-or-16_4-vu-verify.out @@ -0,0 +1,1364 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(50) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO +~~START~~ +nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar#!#nvarchar +比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉莫斯#!#比尔·拉#!#·拉莫斯#!#尔·拉莫 +~~END~~ + + +-- NULL +SELECT TRIM(NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRIM(NULL FROM NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRIM('' FROM NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRIM(NULL FROM '') +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|??·???| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??·???| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab? ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab😎 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|??·???| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??·???| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|·| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|·| +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|??·???| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab? ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab😎 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|?·??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|?·??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|?·??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|?·??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_ci_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_trim_chinese_prc_ci_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_cs_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_trim_chinese_prc_cs_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_trim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_trim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_trim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_trim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|??·???| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' ab😎c🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂😎 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|?c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|??·???| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|·| +~~END~~ + + +-- with table column of type nchar +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_t1 +GO +~~START~~ +nvarchar +|c🙂defghi| +|尔·拉莫| +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' ab😎c🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂😎 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_trim_dep_view +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +EXEC babel_4489_trim_dep_proc +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_func() +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_itvf_func() +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_1 +GO +~~START~~ +varchar +|abc?defghi??| +|??·???| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_2 +GO +~~START~~ +varchar +|abc?defghi??| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_3 +GO +~~START~~ +varchar +|abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_4 +GO +~~START~~ +varchar +|abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_5 +GO +~~START~~ +varchar +|0x61626364| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_6 +GO +~~START~~ +varchar +|cdefgh| +~~END~~ + + +-- different datatypes of inputString and charSet +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??·???| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|·| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??·???| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??·???| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??·???| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|?·??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|·| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|??·???| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|??·???| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' ABCDEF ', @charSet BINARY(4) = 0x414243 +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @charSet VARBINARY(2) = 0x4144 +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 1 of Trim function.)~~ + + +-- input type UDT +-- -- in table babel_4489_trim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT TRIM(a) FROM babel_4489_trim_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of Trim function.)~~ + + +SELECT TRIM(b) FROM babel_4489_trim_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +DECLARE @charSet VARCHAR(10) = 'ab' +SELECT TRIM(@charSet FROM a) FROM babel_4489_trim_UDT +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of Trim function.)~~ + + +DECLARE @charSet VARCHAR(10) = 'ab' +SELECT TRIM(@charSet FROM b) FROM babel_4489_trim_UDT +GO +~~START~~ +varchar +cdef +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT TRIM('12' FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString date = '2016-12-21', @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of Trim function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of Trim function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @charSet VARCHAR(10) = '10'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @charSet VARCHAR(10) = '23'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @charSet VARCHAR(10) = '23'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString decimal = 123456, @charSet decimal = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString numeric = 12345.12, @charSet numeric = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString float = 12345.1, @charSet float = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString real = 12345.1, @charSet real = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString bigint = 12345678, @charSet bigint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString int = 12345678, @charSet int = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString smallint = 12356, @charSet smallint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString tinyint = 235, @charSet tinyint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString money = 12356, @charSet money = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString smallmoney = 12356, @charSet smallmoney = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString bit = 1, @charSet bit = 1; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of Trim function.)~~ + + +SELECT TRIM(a FROM a) FROM babel_4489_trim_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of Trim function.)~~ + + +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM a) from babel_4489_trim_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of Trim function.)~~ + + +SELECT TRIM(a FROM b) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar + +~~END~~ + +SELECT TRIM(b FROM a) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar + +~~END~~ + + +DECLARE @charSet VARCHAR(20) = 'ab? ' +SELECT TRIM(@charSet FROM a) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar +c🙂defghi🙂🙂 +~~END~~ + + +DECLARE @charSet VARCHAR(20) = 'ab? ' +SELECT TRIM(@charSet FROM b) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar +c🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @charSet xml = CAST ('' AS xml); +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @charSet VARCHAR(10) = '(1 2)'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @charSet VARCHAR(10) = '(1 2)'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @charSet VARCHAR(10) = '2'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @charSet VARCHAR(10) = '2'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +9619FF-8B86-D011-B42D-00C04FC964 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @charSet xml = CAST ('' AS xml); +SELECT TRIM(CAST(@charSet AS VARCHAR) FROM CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +body> +~~END~~ + + +SELECT TRIM(NULL FROM NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRIM('' FROM NULL) +GO +~~START~~ +varchar + +~~END~~ + + +SELECT TRIM(NULL FROM '') +GO +~~START~~ +varchar + +~~END~~ + + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|??·???| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??·???| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab? ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab😎 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|??·???| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|??·???| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|·| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|·| +~~END~~ + + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|abc?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +varchar +|??·???| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab? ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab😎 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|?·??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +varchar +|?·??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|?·??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|?·??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_ci_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_trim_chinese_prc_ci_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_cs_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_trim_chinese_prc_cs_as +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_trim_chinese_prc_ci_ai +GO +~~START~~ +varchar +|尔·拉莫| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_trim_arabic_ci_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_trim_arabic_cs_as +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_trim_arabic_ci_ai +GO +~~START~~ +varchar +|الله مع المتق| +~~END~~ + + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|??·???| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' ab😎c🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂😎 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|?c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|??·???| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|·| +~~END~~ + + +-- with table column of type nchar +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_t1 +GO +~~START~~ +nvarchar +|c🙂defghi| +|尔·拉莫| +~~END~~ + + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' ab😎c🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂😎 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +-- dependent objects +SELECT * FROM babel_4489_trim_dep_view +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +EXEC babel_4489_trim_dep_proc +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_func() +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_itvf_func() +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_1 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂| +|比尔·拉莫斯| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_2 +GO +~~START~~ +nvarchar +|abc🙂defghi🙂🙂| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_3 +GO +~~START~~ +varchar +|abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_4 +GO +~~START~~ +varchar +|abcdefghi| +~~END~~ + + +SELECT * FROM babel_4489_trim_dep_view_5 +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 1 of Trim function.)~~ + + +SELECT * FROM babel_4489_trim_dep_view_6 +GO +~~START~~ +varchar +|cdefgh| +~~END~~ + + +-- different datatypes of inputString and charSet +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??·???| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|·| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??·???| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??·???| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|??·???| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +varchar +|?·??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|·| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|??·???| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c?defghi??| +~~END~~ + + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|??·???| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|尔·拉莫| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|c🙂defghi🙂🙂| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~START~~ +nvarchar +|比尔·拉莫斯| +~~END~~ + + +DECLARE @inputString NVARCHAR(50) = N' ABCDEF ', @charSet BINARY(4) = 0x414243 +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "binary" is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString VARBINARY(50) = 0x41424344, @charSet VARBINARY(2) = 0x4144 +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type varbinary is invalid for argument 1 of Trim function.)~~ + + +-- input type UDT +-- -- in table babel_4489_trim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT TRIM(a) FROM babel_4489_trim_UDT +GO +~~START~~ +varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of Trim function.)~~ + + +SELECT TRIM(b) FROM babel_4489_trim_UDT +GO +~~START~~ +varchar +abcdef +~~END~~ + + +DECLARE @charSet VARCHAR(10) = 'ab' +SELECT TRIM(@charSet FROM a) FROM babel_4489_trim_UDT +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of Trim function.)~~ + + +DECLARE @charSet VARCHAR(10) = 'ab' +SELECT TRIM(@charSet FROM b) FROM babel_4489_trim_UDT +GO +~~START~~ +varchar +cdef +~~END~~ + + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT TRIM('12' FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString date = '2016-12-21', @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString date = '2016-12-21' +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type date is invalid for argument 1 of Trim function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 2 of Trim function.)~~ + + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237', @charSet VARCHAR(10) = '10'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type time without time zone is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @charSet VARCHAR(10) = '23'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @charSet VARCHAR(10) = '23'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 2 of Trim function.)~~ + + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString decimal = 123456, @charSet decimal = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "decimal" is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString numeric = 12345.12, @charSet numeric = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type numeric is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString float = 12345.1, @charSet float = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type double precision is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString real = 12345.1, @charSet real = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type real is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString bigint = 12345678, @charSet bigint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type bigint is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString int = 12345678, @charSet int = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type integer is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString smallint = 12356, @charSet smallint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallint is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString tinyint = 235, @charSet tinyint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString money = 12356, @charSet money = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type money is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString smallmoney = 12356, @charSet smallmoney = 12; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString bit = 1, @charSet bit = 1; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type "bit" is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of Trim function.)~~ + + +SELECT TRIM(a FROM a) FROM babel_4489_trim_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of Trim function.)~~ + + +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM a) from babel_4489_trim_image; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 2 of Trim function.)~~ + + +SELECT TRIM(a FROM b) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar + +~~END~~ + +SELECT TRIM(b FROM a) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar + +~~END~~ + + +DECLARE @charSet VARCHAR(20) = 'ab? ' +SELECT TRIM(@charSet FROM a) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar +c🙂defghi🙂🙂 +~~END~~ + + +DECLARE @charSet VARCHAR(20) = 'ab? ' +SELECT TRIM(@charSet FROM b) FROM babel_4489_trim_text +GO +~~START~~ +nvarchar +c🙂defghi🙂🙂 +~~END~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @charSet xml = CAST ('' AS xml); +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @charSet VARCHAR(10) = '(1 2)'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @charSet VARCHAR(10) = '(1 2)'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @charSet VARCHAR(10) = '2'; +SELECT TRIM(@charSet FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 2 of Trim function.)~~ + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @charSet VARCHAR(10) = '2'; +SELECT TRIM(@inputString FROM @inputString) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geography is invalid for argument 1 of Trim function.)~~ + + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +9619FF-8B86-D011-B42D-00C04FC964 +~~END~~ + + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @charSet xml = CAST ('' AS xml); +SELECT TRIM(CAST(@charSet AS VARCHAR) FROM CAST(@inputString AS VARCHAR(50))) +GO +~~START~~ +varchar +body> +~~END~~ + +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString BINARY(30) = 0x4142434445 +SELECT UPPER(@inputString) +SELECT LOWER(@inputString) +SELECT CONVERT(BINARY(50), UPPER(@inputString)); +SELECT CONVERT(BINARY(50), LOWER(@inputString)); +GO +~~START~~ +varchar +ABCDE +~~END~~ + +~~START~~ +varchar +abcde +~~END~~ + +~~START~~ +binary +4142434445000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +~~END~~ + +~~START~~ +binary +6162636465000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +~~END~~ + + +DECLARE @inputString VARBINARY(30) = 0x4142434445 +SELECT UPPER(@inputString) +SELECT LOWER(@inputString) +SELECT CONVERT(VARBINARY(50), UPPER(@inputString)); +SELECT CONVERT(VARBINARY(50), LOWER(@inputString)); +GO +~~START~~ +varchar +ABCDE +~~END~~ + +~~START~~ +varchar +abcde +~~END~~ + +~~START~~ +varbinary +4142434445 +~~END~~ + +~~START~~ +varbinary +6162636465 +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-4803 +declare @string1 nchar(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO +~~START~~ +nvarchar +|??·? | +~~END~~ + +~~START~~ +nvarchar +|??·? | +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-1664 +DECLARE @date date = '12-21-16'; +DECLARE @datetime datetime = @date; +SELECT UPPER(@datetime) +SELECT LOWER(@datetime) +GO +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-1664 +DECLARE @smalldatetime smalldatetime = '1955-12-13 12:43:10'; +SELECT UPPER(@smalldatetime) +SELECT LOWER(@smalldatetime) +GO +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + + +DECLARE @date date = '2016-12-21'; +SELECT UPPER(@date) +SELECT LOWER(@date) +GO +~~START~~ +varchar +2016-12-21 +~~END~~ + +~~START~~ +varchar +2016-12-21 +~~END~~ + + +DECLARE @time time(4) = '12:10:05.1237'; +SELECT UPPER(@time) +SELECT LOWER(@time) +GO +~~START~~ +varchar +12:10:05.1237 +~~END~~ + +~~START~~ +varchar +12:10:05.1237 +~~END~~ + + +DECLARE @datetimeoffset datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT UPPER(@datetimeoffset) +SELECT LOWER(@datetimeoffset) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @datetime2 datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT UPPER(@datetime2) +SELECT LOWER(@datetime2) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @decimal decimal = 123; +SELECT UPPER(@decimal) +SELECT LOWER(@decimal) +GO +~~START~~ +varchar +123 +~~END~~ + +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @numeric numeric = 12345.12; +SELECT UPPER(@numeric) +SELECT LOWER(@numeric) +GO +~~START~~ +varchar +12345 +~~END~~ + +~~START~~ +varchar +12345 +~~END~~ + + +DECLARE @float float = 12345.1; +SELECT UPPER(@float) +SELECT LOWER(@float) +GO +~~START~~ +varchar +12345.1 +~~END~~ + +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @real real = 12345.1; +SELECT UPPER(@real) +SELECT LOWER(@real) +GO +~~START~~ +varchar +12345.1 +~~END~~ + +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @bigint bigint = 2; +SELECT UPPER(@bigint) +SELECT LOWER(@bigint) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @int int = 2; +SELECT UPPER(@int) +SELECT LOWER(@int) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @smallint smallint = 2; +SELECT UPPER(@smallint) +SELECT LOWER(@smallint) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @tinyint tinyint = 2; +SELECT UPPER(@tinyint) +SELECT LOWER(@tinyint) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @money money = 2; +SELECT UPPER(@money) +SELECT LOWER(@money) +GO +~~START~~ +varchar +2.0000 +~~END~~ + +~~START~~ +varchar +2.0000 +~~END~~ + + +DECLARE @smallmoney smallmoney = 2; +SELECT UPPER(@smallmoney) +SELECT LOWER(@smallmoney) +GO +~~START~~ +varchar +2.0000 +~~END~~ + +~~START~~ +varchar +2.0000 +~~END~~ + + +DECLARE @bit bit = 1; +SELECT UPPER(@bit) +SELECT LOWER(@bit) +GO +~~START~~ +varchar +1 +~~END~~ + +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @myid uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + +~~START~~ +varchar +6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + + +DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of upper function.)~~ + + +DECLARE @myid xml = CAST ('' AS xml) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of upper function.)~~ + + +DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of upper function.)~~ + + +DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04F +~~END~~ + +~~START~~ +varchar +6f9619ff-8b86-d011-b42d-00c04f +~~END~~ + + +DECLARE @myid xml = CAST ('' AS xml) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + + +DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO +~~START~~ +varchar +POINT(1 2) +~~END~~ + +~~START~~ +varchar +point(1 2) +~~END~~ + + +Select UPPER(a), LOWER(a) from upper_lower_text +GO +~~START~~ +varchar#!#varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +Select UPPER(a), LOWER(a) from upper_lower_ntext +GO +~~START~~ +nvarchar#!#nvarchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +Select UPPER(a), LOWER(a) from upper_lower_image +GO +~~START~~ +varchar#!#varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of upper function.)~~ + + +declare @string1 nvarchar(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO +~~START~~ +nvarchar +|比尔·拉| +~~END~~ + +~~START~~ +nvarchar +|比尔·拉| +~~END~~ + + +declare @string1 char(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO +~~START~~ +varchar +|??·? | +~~END~~ + +~~START~~ +varchar +|??·? | +~~END~~ + + +declare @string1 varchar(30) = N'比尔·拉'; +select UPPER(@string1) +select LOWER(@string1) +GO +~~START~~ +varchar +??·? +~~END~~ + +~~START~~ +varchar +??·? +~~END~~ + + +SELECT * from upper_lower_dt where UPPER(a) = N'Anikait'; +GO +~~START~~ +varchar#!#nvarchar#!#char#!#nchar +Anikait #!#Agrawal #!#Anikait #!#Agrawal +~~END~~ + +SELECT * from upper_lower_dt where LOWER(c) = N'比尔·拉拉'; +GO +~~START~~ +varchar#!#nvarchar#!#char#!#nchar +~~END~~ + + +SELECT * from dep_view_upper +GO +~~START~~ +text#!#text#!#text#!#text +~~END~~ + +SELECT upper(col), lower(col) FROM tab_arabic_ci_ai; +GO +~~START~~ +varchar#!#varchar +لقد#!#لقد +~~END~~ + +SELECT upper(col), lower(col) FROM tab_arabic_ci_as; +GO +~~START~~ +varchar#!#varchar +لقد#!#لقد +~~END~~ + +SELECT upper(col), lower(col) FROM tab_arabic_cs_as; +GO +~~START~~ +varchar#!#varchar +لقد#!#لقد +~~END~~ + +SELECT upper(col), lower(col) FROM tab_chinese_ci_ai; +GO +~~START~~ +varchar#!#varchar +比尔·拉#!#比尔·拉 +~~END~~ + +SELECT upper(col), lower(col) FROM tab_chinese_ci_as; +GO +~~START~~ +varchar#!#varchar +比尔·拉#!#比尔·拉 +~~END~~ + +SELECT upper(col), lower(col) FROM tab_chinese_cs_as; +GO +~~START~~ +varchar#!#varchar +比尔·拉#!#比尔·拉 +~~END~~ + +EXEC dep_proc_upper +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +ANIKAIT #!#AGRAWAL #!#ANIKAIT #!#AGRAWAL +~~END~~ + +select dbo.dep_func_upper() +GO +~~START~~ +varchar +ANIKAIT +~~END~~ + + +SELECT * from dep_view_lower +GO +~~START~~ +text#!#text#!#text#!#text +~~END~~ + +EXEC dep_proc_lower +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +anikait #!#agrawal #!#anikait #!#agrawal +~~END~~ + +SELECT * from dep_view_upper_lower +GO +~~START~~ +text#!#text +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +EXEC dep_proc_upper_lower +GO +~~START~~ +varchar#!#varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +SELECT * from dep_view_upper_lower1 +GO +~~START~~ +text#!#text +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +EXEC dep_proc_upper_lower1 +GO +~~START~~ +nvarchar#!#nvarchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +select dbo.dep_func_lower() +GO +~~START~~ +varchar +anikait +~~END~~ + +select dbo.tvp_func_upper_lower() +GO +~~START~~ +varchar +("ANIKAIT ","anikait ") +(" ANIKAIT"," anikait") +(" A"," a") +(" "," ") +("","") +(A,a) +(,) +(??·?,??·?) +~~END~~ + +SELECT * from dep_view_lower1 +GO +~~START~~ +text +adjnfjh +~~END~~ + +declare @b dbo.MyUDT = CAST('scsdc' AS dbo.MyUDT) +select upper(@b) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of upper function.)~~ + diff --git a/test/JDBC/expected/upper_lower-vu-cleanup.out b/test/JDBC/expected/upper_lower-vu-cleanup.out new file mode 100644 index 00000000000..a6576612e7e --- /dev/null +++ b/test/JDBC/expected/upper_lower-vu-cleanup.out @@ -0,0 +1,46 @@ +DROP VIEW IF EXISTS dep_view_upper +GO +DROP TABLE IF EXISTS tab_arabic_ci_ai +GO +DROP TABLE IF EXISTS tab_arabic_ci_as +GO +DROP TABLE IF EXISTS tab_arabic_cs_as +GO +DROP TABLE IF EXISTS tab_chinese_ci_ai +GO +DROP TABLE IF EXISTS tab_chinese_ci_as +GO +DROP TABLE IF EXISTS tab_chinese_cs_as +GO +DROP PROCEDURE IF EXISTS dep_proc_upper +GO +DROP FUNCTION IF EXISTS dep_func_upper +GO +DROP VIEW IF EXISTS dep_view_lower +GO +DROP PROCEDURE IF EXISTS dep_proc_lower +GO +DROP VIEW IF EXISTS dep_view_upper_lower +GO +DROP PROCEDURE IF EXISTS dep_proc_upper_lower +GO +DROP VIEW IF EXISTS dep_view_upper_lower1 +GO +DROP PROCEDURE IF EXISTS dep_proc_upper_lower1 +GO +DROP FUNCTION IF EXISTS dep_func_lower +GO +DROP FUNCTION IF EXISTS tvp_func_upper_lower +GO +DROP TABLE IF EXISTS upper_lower_dt; +GO +DROP TABLE IF EXISTS upper_lower_text; +GO +DROP TABLE IF EXISTS upper_lower_ntext; +GO +DROP TABLE IF EXISTS upper_lower_image; +GO +DROP VIEW IF EXISTS dep_view_lower1; +GO +DROP TYPE IF EXISTS dbo.MyUDT; +GO diff --git a/test/JDBC/expected/upper_lower-vu-prepare.out b/test/JDBC/expected/upper_lower-vu-prepare.out new file mode 100644 index 00000000000..fedddf3d721 --- /dev/null +++ b/test/JDBC/expected/upper_lower-vu-prepare.out @@ -0,0 +1,160 @@ +CREATE TABLE upper_lower_dt (a VARCHAR(20), b NVARCHAR(24), c CHAR(20), d NCHAR(24)) +GO +INSERT INTO upper_lower_dt(a,b,c,d) values(N'Anikait ', N'Agrawal ', N'Anikait ', N'Agrawal ') +GO +~~ROW COUNT: 1~~ + +INSERT INTO upper_lower_dt(a,b,c,d) values(N' Anikait', N' Agrawal', N' Anikait', N' Agrawal') +GO +~~ROW COUNT: 1~~ + +INSERT INTO upper_lower_dt(a,b,c,d) values(N' A',N' 🤣😃',N' A',N' 🤣😃') +GO +~~ROW COUNT: 1~~ + +INSERT INTO upper_lower_dt(a,b,c,d) values(N' ',N' ',N' ',N' ') +GO +~~ROW COUNT: 1~~ + +INSERT INTO upper_lower_dt(a,b,c,d) values(N'',N'',N'',N'') +GO +~~ROW COUNT: 1~~ + +INSERT INTO upper_lower_dt(a,b,c,d) values(N'a',N'A',N'a',N'A') +GO +~~ROW COUNT: 1~~ + +INSERT INTO upper_lower_dt(a,b,c,d) values(NULL,NULL,NULL,NULL) +GO +~~ROW COUNT: 1~~ + +INSERT INTO upper_lower_dt(a, b, c, d) values(N'比尔·拉', N'比尔·拉', N'比尔·拉', N'比尔·拉') +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE upper_lower_text(a TEXT) +GO +INSERT INTO upper_lower_text values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS text)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE upper_lower_ntext(a NTEXT) +GO +INSERT INTO upper_lower_ntext values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS ntext)) +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE upper_lower_image(a IMAGE) +GO +INSERT INTO upper_lower_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO +~~ROW COUNT: 1~~ + + +-- UPPER +CREATE VIEW dep_view_upper AS +select UPPER(a) AS upper_a, UPPER(b) AS upper_b, UPPER(c) AS upper_c, UPPER(d) AS upper_d from upper_lower_dt WHERE UPPER(a) = N'ANIKAIT' and UPPER(b) = N'AGRAWAL' and UPPER(c) = N'ANIKAIT' and UPPER(d) = N'AGRAWAL'; +GO + +CREATE TABLE tab_arabic_ci_ai(col varchar(20) COLLATE arabic_ci_ai); +INSERT INTO tab_arabic_ci_ai VALUES ('لقد'); +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE tab_arabic_ci_as(col varchar(20) COLLATE arabic_ci_as); +INSERT INTO tab_arabic_ci_as VALUES ('لقد'); +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE tab_arabic_cs_as(col varchar(20) COLLATE arabic_cs_as); +INSERT INTO tab_arabic_cs_as VALUES ('لقد'); +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE tab_chinese_ci_ai(col varchar(20) COLLATE chinese_prc_ci_ai); +INSERT INTO tab_chinese_ci_ai VALUES ('比尔·拉'); +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE tab_chinese_ci_as(col varchar(20) COLLATE chinese_prc_ci_as); +INSERT INTO tab_chinese_ci_as VALUES ('比尔·拉'); +GO +~~ROW COUNT: 1~~ + + +CREATE TABLE tab_chinese_cs_as(col varchar(20) COLLATE chinese_prc_cs_as); +INSERT INTO tab_chinese_cs_as VALUES ('比尔·拉'); +GO +~~ROW COUNT: 1~~ + + +CREATE PROC dep_proc_upper AS +select UPPER(a), UPPER(b), UPPER(c), UPPER(d) from upper_lower_dt WHERE UPPER(a) = N'ANIKAIT' and UPPER(b) = N'AGRAWAL' and UPPER(c) = N'ANIKAIT' and UPPER(d) = N'AGRAWAL'; +GO + +CREATE FUNCTION dbo.dep_func_upper() +RETURNS VARCHAR(50) +AS +BEGIN +RETURN (select TOP 1 UPPER(a) from upper_lower_dt); +END +GO + +CREATE VIEW dep_view_upper_lower AS +select UPPER(a) AS upper_a, LOWER(a) AS lower_a from upper_lower_text; +GO + +CREATE PROC dep_proc_upper_lower AS +select UPPER(a), LOWER(a) from upper_lower_text; +GO + +CREATE VIEW dep_view_upper_lower1 AS +select UPPER(a) AS upper_a, LOWER(a) AS lower_a from upper_lower_ntext; +GO + +CREATE PROC dep_proc_upper_lower1 AS +select UPPER(a), LOWER(a) from upper_lower_ntext; +GO + +-- LOWER +CREATE VIEW dep_view_lower AS +select LOWER(a) AS lower_a, LOWER(b) AS lower_b, LOWER(c) AS lower_c, LOWER(d) AS lower_d from upper_lower_dt WHERE LOWER(a) = N'anikait' and LOWER(b) = N'agrawal' and LOWER(c) = N'anikait' and LOWER(d) = N'agrawal'; +GO + +CREATE PROC dep_proc_lower AS +select LOWER(a), LOWER(b), LOWER(c), LOWER(d) from upper_lower_dt WHERE LOWER(a) = N'anikait' and LOWER(b) = N'agrawal' and LOWER(c) = N'anikait' and LOWER(d) = N'agrawal'; +GO + +CREATE FUNCTION dbo.dep_func_lower() +RETURNS VARCHAR(50) +AS +BEGIN +RETURN (select TOP 1 LOWER(a) from upper_lower_dt); +END +GO + +CREATE FUNCTION dbo.tvp_func_upper_lower() +RETURNS TABLE +AS +RETURN +( + SELECT UPPER(a) AS upper_a, LOWER(a) AS lower_a + FROM upper_lower_dt +); +GO + +CREATE VIEW dep_view_lower1 AS ( + select + lower(cast(N'ADJNFJH' as varchar(50))) as db1 + ); +GO + +CREATE TYPE dbo.MyUDT FROM image; +GO diff --git a/test/JDBC/expected/upper_lower-vu-verify.out b/test/JDBC/expected/upper_lower-vu-verify.out new file mode 100644 index 00000000000..3c8a50e643e --- /dev/null +++ b/test/JDBC/expected/upper_lower-vu-verify.out @@ -0,0 +1,844 @@ +DECLARE @class NCHAR(30) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE (@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'ANIKAIT AGRAWAL' +SELECT '[' + @class + ']' WHERE upper(@class) = N'Anikait Agrawal ' +SELECT '[' + @class + ']' WHERE lower(@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE lower(@class) = N'anikait agrawal' +SELECT '[' + @class + ']' WHERE lower(@class) = N'Anikait Agrawal ' +GO +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +nvarchar +[Anikait Agrawal ] +~~END~~ + + +DECLARE @class CHAR(30) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE (@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'ANIKAIT AGRAWAL' +SELECT '[' + @class + ']' WHERE upper(@class) = N'Anikait Agrawal ' +SELECT '[' + @class + ']' WHERE lower(@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE lower(@class) = N'anikait agrawal' +SELECT '[' + @class + ']' WHERE lower(@class) = N'Anikait Agrawal ' +GO +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + +~~START~~ +varchar +[Anikait Agrawal ] +~~END~~ + + +DECLARE @class NCHAR = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'ANIKAIT AGRAWAL' +SELECT '[' + @class + ']' WHERE lower(@class) = N'anikait agrawal' +GO +~~START~~ +nvarchar +~~END~~ + +~~START~~ +nvarchar +~~END~~ + + +DECLARE @class CHAR = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'ANIKAIT AGRAWAL' +SELECT '[' + @class + ']' WHERE lower(@class) = N'anikait agrawal' +GO +~~START~~ +varchar +~~END~~ + +~~START~~ +varchar +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-4807 +declare @string1 varchar(30) = N'比尔·拉' COLLATE chinese_prc_ci_as +SELECT UPPER(@string1) +SELECT UPPER(@string1) COLLATE chinese_prc_ci_as +SELECT LOWER(@string1) +SELECT LOWER(@string1) COLLATE chinese_prc_ci_as +go +~~START~~ +varchar +??·? +~~END~~ + +~~START~~ +varchar +比尔·拉 +~~END~~ + +~~START~~ +varchar +??·? +~~END~~ + +~~START~~ +varchar +比尔·拉 +~~END~~ + + +declare @string1 char(30) = N'比尔·拉' COLLATE chinese_prc_ci_as +SELECT '|' + UPPER(@string1) + '|' +SELECT '|' + UPPER(@string1) + '|' COLLATE chinese_prc_ci_as +SELECT '|' + LOWER(@string1) + '|' +SELECT '|' + LOWER(@string1) + '|' COLLATE chinese_prc_ci_as +go +~~START~~ +varchar +|??·? | +~~END~~ + +~~START~~ +varchar +|??·? | +~~END~~ + +~~START~~ +varchar +|??·? | +~~END~~ + +~~START~~ +varchar +|??·? | +~~END~~ + + +SELECT UPPER(NULL) +SELECT LOWER(NULL) +GO +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + + +DECLARE @inputString BINARY(30) = 0x4142434445 +SELECT UPPER(@inputString) +SELECT LOWER(@inputString) +SELECT CONVERT(BINARY(50), UPPER(@inputString)); +SELECT CONVERT(BINARY(50), LOWER(@inputString)); +GO +~~START~~ +varchar +ABCDE +~~END~~ + +~~START~~ +varchar +abcde +~~END~~ + +~~START~~ +binary +4142434445000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +~~END~~ + +~~START~~ +binary +6162636465000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +~~END~~ + + +DECLARE @inputString VARBINARY(30) = 0x4142434445 +SELECT UPPER(@inputString) +SELECT LOWER(@inputString) +SELECT CONVERT(VARBINARY(50), UPPER(@inputString)); +SELECT CONVERT(VARBINARY(50), LOWER(@inputString)); +GO +~~START~~ +varchar +ABCDE +~~END~~ + +~~START~~ +varchar +abcde +~~END~~ + +~~START~~ +varbinary +4142434445 +~~END~~ + +~~START~~ +varbinary +6162636465 +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-4803 +declare @string1 nchar(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO +~~START~~ +nvarchar +|??·? | +~~END~~ + +~~START~~ +nvarchar +|??·? | +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-1664 +DECLARE @date date = '12-21-16'; +DECLARE @datetime datetime = @date; +SELECT UPPER(@datetime) +SELECT LOWER(@datetime) +GO +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + +~~START~~ +varchar +2016-12-21 00:00:00 +~~END~~ + + +-- different result from TSQL, should be fixed under BABEL-1664 +DECLARE @smalldatetime smalldatetime = '1955-12-13 12:43:10'; +SELECT UPPER(@smalldatetime) +SELECT LOWER(@smalldatetime) +GO +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + +~~START~~ +varchar +1955-12-13 12:43:00 +~~END~~ + + +DECLARE @date date = '2016-12-21'; +SELECT UPPER(@date) +SELECT LOWER(@date) +GO +~~START~~ +varchar +2016-12-21 +~~END~~ + +~~START~~ +varchar +2016-12-21 +~~END~~ + + +DECLARE @time time(4) = '12:10:05.1237'; +SELECT UPPER(@time) +SELECT LOWER(@time) +GO +~~START~~ +varchar +12:10:05.1237 +~~END~~ + +~~START~~ +varchar +12:10:05.1237 +~~END~~ + + +DECLARE @datetimeoffset datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT UPPER(@datetimeoffset) +SELECT LOWER(@datetimeoffset) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + +~~START~~ +varchar +1968-10-23 12:45:37.1234 +10:00 +~~END~~ + + +DECLARE @datetime2 datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT UPPER(@datetime2) +SELECT LOWER(@datetime2) +GO +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + +~~START~~ +varchar +1968-10-23 12:45:37.1237 +~~END~~ + + +DECLARE @decimal decimal = 123; +SELECT UPPER(@decimal) +SELECT LOWER(@decimal) +GO +~~START~~ +varchar +123 +~~END~~ + +~~START~~ +varchar +123 +~~END~~ + + +DECLARE @numeric numeric = 12345.12; +SELECT UPPER(@numeric) +SELECT LOWER(@numeric) +GO +~~START~~ +varchar +12345 +~~END~~ + +~~START~~ +varchar +12345 +~~END~~ + + +DECLARE @float float = 12345.1; +SELECT UPPER(@float) +SELECT LOWER(@float) +GO +~~START~~ +varchar +12345.1 +~~END~~ + +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @real real = 12345.1; +SELECT UPPER(@real) +SELECT LOWER(@real) +GO +~~START~~ +varchar +12345.1 +~~END~~ + +~~START~~ +varchar +12345.1 +~~END~~ + + +DECLARE @bigint bigint = 2; +SELECT UPPER(@bigint) +SELECT LOWER(@bigint) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @int int = 2; +SELECT UPPER(@int) +SELECT LOWER(@int) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @smallint smallint = 2; +SELECT UPPER(@smallint) +SELECT LOWER(@smallint) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @tinyint tinyint = 2; +SELECT UPPER(@tinyint) +SELECT LOWER(@tinyint) +GO +~~START~~ +varchar +2 +~~END~~ + +~~START~~ +varchar +2 +~~END~~ + + +DECLARE @money money = 2; +SELECT UPPER(@money) +SELECT LOWER(@money) +GO +~~START~~ +varchar +2.0000 +~~END~~ + +~~START~~ +varchar +2.0000 +~~END~~ + + +DECLARE @smallmoney smallmoney = 2; +SELECT UPPER(@smallmoney) +SELECT LOWER(@smallmoney) +GO +~~START~~ +varchar +2.0000 +~~END~~ + +~~START~~ +varchar +2.0000 +~~END~~ + + +DECLARE @bit bit = 1; +SELECT UPPER(@bit) +SELECT LOWER(@bit) +GO +~~START~~ +varchar +1 +~~END~~ + +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @myid uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF +~~END~~ + +~~START~~ +varchar +6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + + +DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of upper function.)~~ + + +DECLARE @myid xml = CAST ('' AS xml) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type xml is invalid for argument 1 of upper function.)~~ + + +DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type geometry is invalid for argument 1 of upper function.)~~ + + +DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO +~~START~~ +varchar +6F9619FF-8B86-D011-B42D-00C04F +~~END~~ + +~~START~~ +varchar +6f9619ff-8b86-d011-b42d-00c04f +~~END~~ + + +DECLARE @myid xml = CAST ('' AS xml) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO +~~START~~ +varchar + +~~END~~ + +~~START~~ +varchar + +~~END~~ + + +DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO +~~START~~ +varchar +POINT(1 2) +~~END~~ + +~~START~~ +varchar +point(1 2) +~~END~~ + + +Select UPPER(a), LOWER(a) from upper_lower_text +GO +~~START~~ +varchar#!#varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +Select UPPER(a), LOWER(a) from upper_lower_ntext +GO +~~START~~ +nvarchar#!#nvarchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +Select UPPER(a), LOWER(a) from upper_lower_image +GO +~~START~~ +varchar#!#varchar +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of upper function.)~~ + + +declare @string1 nvarchar(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO +~~START~~ +nvarchar +|比尔·拉| +~~END~~ + +~~START~~ +nvarchar +|比尔·拉| +~~END~~ + + +declare @string1 char(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO +~~START~~ +varchar +|??·? | +~~END~~ + +~~START~~ +varchar +|??·? | +~~END~~ + + +declare @string1 varchar(30) = N'比尔·拉'; +select UPPER(@string1) +select LOWER(@string1) +GO +~~START~~ +varchar +??·? +~~END~~ + +~~START~~ +varchar +??·? +~~END~~ + + +SELECT upper(a), lower(b), lower(c), upper(d) from upper_lower_dt; +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +ANIKAIT #!#agrawal #!#anikait #!#AGRAWAL + ANIKAIT#!# agrawal#!# anikait #!# AGRAWAL + A#!# 🤣😃#!# a #!# 🤣😃 + #!# #!# #!# +#!##!# #!# +A#!#a#!#a #!#A +#!##!##!# +??·?#!#比尔·拉#!#??·? #!#比尔·拉 +~~END~~ + +SELECT * from upper_lower_dt where UPPER(a) = N'Anikait'; +GO +~~START~~ +varchar#!#nvarchar#!#char#!#nchar +Anikait #!#Agrawal #!#Anikait #!#Agrawal +~~END~~ + +SELECT * from upper_lower_dt where LOWER(c) = N'比尔·拉'; +GO +~~START~~ +varchar#!#nvarchar#!#char#!#nchar +~~END~~ + +SELECT * from upper_lower_dt where LOWER(d) = N'比尔·拉'; +GO +~~START~~ +varchar#!#nvarchar#!#char#!#nchar +??·?#!#比尔·拉#!#??·? #!#比尔·拉 +~~END~~ + + +SELECT * from dep_view_upper +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +ANIKAIT #!#AGRAWAL #!#ANIKAIT #!#AGRAWAL +~~END~~ + +SELECT upper(col), lower(col) FROM tab_arabic_ci_ai; +GO +~~START~~ +varchar#!#varchar +لقد#!#لقد +~~END~~ + +SELECT upper(col), lower(col) FROM tab_arabic_ci_as; +GO +~~START~~ +varchar#!#varchar +لقد#!#لقد +~~END~~ + +SELECT upper(col), lower(col) FROM tab_arabic_cs_as; +GO +~~START~~ +varchar#!#varchar +لقد#!#لقد +~~END~~ + +SELECT upper(col), lower(col) FROM tab_chinese_ci_ai; +GO +~~START~~ +varchar#!#varchar +比尔·拉#!#比尔·拉 +~~END~~ + +SELECT upper(col), lower(col) FROM tab_chinese_ci_as; +GO +~~START~~ +varchar#!#varchar +比尔·拉#!#比尔·拉 +~~END~~ + +SELECT upper(col), lower(col) FROM tab_chinese_cs_as; +GO +~~START~~ +varchar#!#varchar +比尔·拉#!#比尔·拉 +~~END~~ + +EXEC dep_proc_upper +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +ANIKAIT #!#AGRAWAL #!#ANIKAIT #!#AGRAWAL +~~END~~ + +select dbo.dep_func_upper() +GO +~~START~~ +varchar +ANIKAIT +~~END~~ + + +SELECT * from dep_view_lower +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +anikait #!#agrawal #!#anikait #!#agrawal +~~END~~ + +EXEC dep_proc_lower +GO +~~START~~ +varchar#!#nvarchar#!#varchar#!#nvarchar +anikait #!#agrawal #!#anikait #!#agrawal +~~END~~ + +SELECT * from dep_view_upper_lower +GO +~~START~~ +varchar#!#varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +EXEC dep_proc_upper_lower +GO +~~START~~ +varchar#!#varchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +SELECT * from dep_view_upper_lower1 +GO +~~START~~ +nvarchar#!#nvarchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +EXEC dep_proc_upper_lower1 +GO +~~START~~ +nvarchar#!#nvarchar +6F9619FF-8B86-D011-B42D-00C04FC964FF#!#6f9619ff-8b86-d011-b42d-00c04fc964ff +~~END~~ + +select dbo.dep_func_lower() +GO +~~START~~ +varchar +anikait +~~END~~ + +select dbo.tvp_func_upper_lower() +GO +~~START~~ +varchar +("ANIKAIT ","anikait ") +(" ANIKAIT"," anikait") +(" A"," a") +(" "," ") +("","") +(A,a) +(,) +(??·?,??·?) +~~END~~ + +SELECT * from dep_view_lower1 +GO +~~START~~ +varchar +adjnfjh +~~END~~ + +declare @b dbo.MyUDT = CAST('scsdc' AS dbo.MyUDT) +select upper(@b) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Argument data type image is invalid for argument 1 of upper function.)~~ + diff --git a/test/JDBC/expected/verify_mapping_for_remove_accents.out b/test/JDBC/expected/verify_mapping_for_remove_accents.out new file mode 100644 index 00000000000..903656efeee --- /dev/null +++ b/test/JDBC/expected/verify_mapping_for_remove_accents.out @@ -0,0 +1,44 @@ +-- tsql +-- Insert all possible UNICODE/UTF-8 valid characters +CREATE TABLE all_utf8_chars(col1 BYTEA, col2 TEXT) +GO + +-- psql +DO $$ +DECLARE + cnt INT:= 1; + var TEXT; +BEGIN + WHILE cnt <= 1114112 LOOP + BEGIN + var := chr(cnt); + IF var <> '\' THEN + INSERT INTO master_dbo.all_utf8_chars VALUES (cast(var as bytea), var); + ELSE + INSERT INTO master_dbo.all_utf8_chars VALUES (cast('\\' as bytea), '\'); + END IF; + EXCEPTION + WHEN program_limit_exceeded THEN + END; + cnt := cnt + 1; + END LOOP; +END; +$$; +GO + +-- tsql +-- Verify like with AI collations against all possible characters +-- except BBF_ESC_CHAR_REPLC and '[' which are special characters +SELECT COUNT(*)FROM all_utf8_chars + WHERE col1 != cast(chr(65535) as bytea) AND col2 != '[' AND + col2 NOT LIKE sys.remove_accents_internal(col2) COLLATE Latin1_General_CI_AI; +GO +~~START~~ +int +0 +~~END~~ + + +-- tsql +DROP TABLE all_utf8_chars +GO diff --git a/test/JDBC/input/BABEL-2515.sql b/test/JDBC/input/BABEL-2515.sql deleted file mode 100644 index 512a0710d32..00000000000 --- a/test/JDBC/input/BABEL-2515.sql +++ /dev/null @@ -1,32 +0,0 @@ -use master; -GO - -CREATE TABLE [BABEL-2515] -( - [PartitionId] [smallint] NOT NULL, - CONSTRAINT [PK_DataRecord2056] PRIMARY KEY CLUSTERED ( [PartitionId] ASC ) - WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) - ON [XFPS_DataRecord2056]([PartitionId]) -) -ON [XFPS_DataRecord2056]([PartitionId]); -GO - -EXEC sp_babelfish_configure 'babelfishpg_tsql.escape_hatch_storage_on_partition', 'ignore'; -GO - -CREATE TABLE [BABEL-2515] -( - [PartitionId] [smallint] NOT NULL, - CONSTRAINT [PK_DataRecord2056] PRIMARY KEY CLUSTERED ( [PartitionId] ASC ) - WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) - ON [XFPS_DataRecord2056]([PartitionId]) -) -ON [XFPS_DataRecord2056]([PartitionId]); -GO - -DROP TABLE [BABEL-2515] -GO - --- reset to default -EXEC sp_babelfish_configure 'babelfishpg_tsql.escape_hatch_storage_on_partition', 'strict'; -GO diff --git a/test/JDBC/input/BABEL-4279.mix b/test/JDBC/input/BABEL-4279.mix index 3c9d00a0f83..108430ec7ff 100644 --- a/test/JDBC/input/BABEL-4279.mix +++ b/test/JDBC/input/BABEL-4279.mix @@ -1,3 +1,15 @@ +-- tsql +CREATE TABLE babelfish_migration_mode_table (id_num INT IDENTITY(1,1), mig_mode VARCHAR(10)) +GO +INSERT INTO babelfish_migration_mode_table SELECT current_setting('babelfishpg_tsql.migration_mode') +GO + +-- test multi-db mode +SELECT set_config('role', 'jdbc_user', false); +GO +SELECT set_config('babelfishpg_tsql.migration_mode', 'multi-db', false); +GO + -- tsql CREATE TABLE test_babel_4279_t1([ABC.nfds] INT, [DEf.j] INT); GO @@ -190,3 +202,14 @@ GO DROP TABLE t3 GO +SELECT set_config('role', 'jdbc_user', false); +GO + +-- Reset migration mode to default +DECLARE @mig_mode VARCHAR(10) +SET @mig_mode = (SELECT mig_mode FROM babelfish_migration_mode_table WHERE id_num = 1) +SELECT CASE WHEN (SELECT set_config('babelfishpg_tsql.migration_mode', @mig_mode, false)) IS NOT NULL THEN 1 ELSE 0 END +GO + +Drop Table IF EXISTS babelfish_migration_mode_table +GO \ No newline at end of file diff --git a/test/JDBC/input/BABEL-4484-vu-verify.sql b/test/JDBC/input/BABEL-4484-vu-verify.sql index 5c5f6a2e636..474ae42cd31 100644 --- a/test/JDBC/input/BABEL-4484-vu-verify.sql +++ b/test/JDBC/input/BABEL-4484-vu-verify.sql @@ -9,3 +9,23 @@ GO SELECT test_babel_4484_t1.ced FROM test_babel_4484_t1 INNER JOIN test_babel_4484_t2 ON test_babel_4484_t1.ABC = test_babel_4484_t2.ABC WHERE test_babel_4484_t1.ABC = 1; GO + +SELECT test_babel_4484_t1.ced--table1.REPGETTEXT( +FROM test_babel_4484_t1 +GO + +select test_babel_4484_t1.您您--table1.a.b.c +from test_babel_4484_t1 +GO + +select test_babel_4484_t2.您您--table1.a.b.c +from test_babel_4484_t2 +GO + +select test_babel_4484_t1.您您 as kk--table1.a.b.c +from test_babel_4484_t1 +GO + +select test_babel_4484_t2.您您 as kk--table1.a.b.c +from test_babel_4484_t2 +GO \ No newline at end of file diff --git a/test/JDBC/input/BABEL-4888-vu-cleanup.sql b/test/JDBC/input/BABEL-4888-vu-cleanup.sql new file mode 100644 index 00000000000..33ac0890066 --- /dev/null +++ b/test/JDBC/input/BABEL-4888-vu-cleanup.sql @@ -0,0 +1,2 @@ +DROP TABLE babel_4888_t1, babel_4888_t2, babel_4888_t3, babel_4888_t4; +GO diff --git a/test/JDBC/input/BABEL-4888-vu-prepare.sql b/test/JDBC/input/BABEL-4888-vu-prepare.sql new file mode 100644 index 00000000000..e307372a0ef --- /dev/null +++ b/test/JDBC/input/BABEL-4888-vu-prepare.sql @@ -0,0 +1,8 @@ +CREATE TABLE babel_4888_t1 (id1 INT UNIQUE(id1 DESC), id2 VARCHAR(30) UNIQUE(id2 ASC), id3 VARBINARY(30)) +GO +CREATE TABLE babel_4888_t2 (id1 INT, id2 VARCHAR(30), id3 VARBINARY(30), UNIQUE(id1 ASC, id2 DESC)) +GO +CREATE TABLE babel_4888_t3 (id1 INT PRIMARY KEY(id1 DESC), id2 VARCHAR(30) UNIQUE(id2), id3 VARBINARY(30)) +GO +CREATE TABLE babel_4888_t4 (id1 INT, id2 VARCHAR(30), id3 VARBINARY(30), PRIMARY KEY(id1 ASC, id2 DESC)) +GO diff --git a/test/JDBC/input/BABEL-4888-vu-verify.sql b/test/JDBC/input/BABEL-4888-vu-verify.sql new file mode 100644 index 00000000000..4851deeb131 --- /dev/null +++ b/test/JDBC/input/BABEL-4888-vu-verify.sql @@ -0,0 +1,69 @@ +-- table 1 id1 & id2 should be individually unique + +INSERT INTO babel_4888_t1 VALUES (-1, '-a', 0x0001), (1, '+a', 0x1001), (NULL, '', NULL), (0, NULL, NULL) +GO + +INSERT INTO babel_4888_t1 VALUES (NULL, 'random', 0x9999) +GO + +INSERT INTO babel_4888_t1 VALUES (9999, NULL, 0x9999) +GO + +INSERT INTO babel_4888_t1 VALUES (9999, 'random', NULL) +GO + +-- table 2 Combination of id1 & id2 should be unique + +INSERT INTO babel_4888_t2 VALUES (-1, '-a', 0x0001), (1, '+a', 0x1001), (NULL, '', NULL), (0, NULL, NULL) +GO + +INSERT INTO babel_4888_t2 VALUES (NULL, '', 0x9999) +GO + +INSERT INTO babel_4888_t2 VALUES (0, NULL, 0x9999) +GO + +INSERT INTO babel_4888_t2 VALUES (NULL, NULL, NULL) +GO + +INSERT INTO babel_4888_t2 VALUES (NULL, NULL, 0x9999) +GO + +-- table 3 id1 & id2 should be individually unique + +INSERT INTO babel_4888_t3 VALUES (-1, '-a', 0x0001), (1, '+a', 0x1001), (NULL, '', NULL), (0, NULL, NULL) +GO + +INSERT INTO babel_4888_t3 VALUES (NULL, '', 0x9999) +GO + +INSERT INTO babel_4888_t3 VALUES (0, NULL, 0x9999) +GO + +INSERT INTO babel_4888_t3 VALUES (NULL, NULL, NULL) +GO + +INSERT INTO babel_4888_t3 VALUES (NULL, NULL, 0x9999) +GO + +-- table 4 Combination of id1 & id2 should be unique + +INSERT INTO babel_4888_t4 VALUES (-1, '-a', 0x0001), (1, '+a', 0x1001), (NULL, '', NULL), (0, NULL, NULL) +GO + +INSERT INTO babel_4888_t4 VALUES (NULL, '', 0x9999) +GO + +INSERT INTO babel_4888_t4 VALUES (0, NULL, 0x9999) +GO + +INSERT INTO babel_4888_t4 VALUES (NULL, NULL, NULL) +GO + +INSERT INTO babel_4888_t4 VALUES (NULL, NULL, 0x9999) +GO + +SELECT indexdef FROM pg_indexes +WHERE tablename LIKE '%babel_4888%' +ORDER BY indexdef +GO diff --git a/test/JDBC/input/BABEL-5071-vu-cleanup.sql b/test/JDBC/input/BABEL-5071-vu-cleanup.sql new file mode 100644 index 00000000000..937a89de8b6 --- /dev/null +++ b/test/JDBC/input/BABEL-5071-vu-cleanup.sql @@ -0,0 +1,15 @@ +drop trigger trig5071_1 +go + +drop table tab5071_1 +go + +DROP TRIGGER tab4992_1deleteOperation +GO + +DROP TABLE tab4992_1 +GO + +DROP TABLE tab4992_2 +GO + diff --git a/test/JDBC/input/BABEL-5071-vu-prepare.sql b/test/JDBC/input/BABEL-5071-vu-prepare.sql new file mode 100644 index 00000000000..691c9163bcd --- /dev/null +++ b/test/JDBC/input/BABEL-5071-vu-prepare.sql @@ -0,0 +1,33 @@ +create table tab5071_1 (a int) +go + +create trigger trig5071_1 on tab5071_1 for insert as begin +create table #temp_tst (a int) +insert #temp_tst select a*-1 from inserted; +select * from #temp_tst; +drop table #temp_tst +end +go + +CREATE TABLE tab4992_1 (c1 int, c2 int) +GO + +CREATE TABLE tab4992_2 (c1 int, c2 int) +GO + +INSERT INTO tab4992_1 VALUES(1, 2) +GO + +CREATE TRIGGER tab4992_1deleteOperation on [dbo].[tab4992_1] +after delete AS +BEGIN + CREATE TABLE #tmp + ( + c1 INT PRIMARY KEY, + c2 INT, + c3 VARCHAR(64) NOT NULL DEFAULT '' + ) + INSERT INTO #tmp VALUES (1, 2, '') + INSERT INTO tab4992_2 SELECT c1,c2 FROM #tmp --> Crash +END +GO diff --git a/test/JDBC/input/BABEL-5071-vu-verify.sql b/test/JDBC/input/BABEL-5071-vu-verify.sql new file mode 100644 index 00000000000..eb56da595ae --- /dev/null +++ b/test/JDBC/input/BABEL-5071-vu-verify.sql @@ -0,0 +1,12 @@ +-- Test case found in 5071 + +insert tab5071_1 values (123) +go + +-- Test case found in 4992 + +DELETE FROM tab4992_1 +GO + +SELECT * FROM tab4992_1 +GO \ No newline at end of file diff --git a/test/JDBC/input/BABEL-CROSS-DB.mix b/test/JDBC/input/BABEL-CROSS-DB.mix index c86e7cd128d..1957d7ff2a2 100644 --- a/test/JDBC/input/BABEL-CROSS-DB.mix +++ b/test/JDBC/input/BABEL-CROSS-DB.mix @@ -359,6 +359,145 @@ GO DROP DATABASE db2; GO +-- BABEL-4934 Test blocking cross-db SELECT-INTO statement +CREATE DATABASE db_4934_1; +GO + +CREATE DATABASE db_4934_2; +GO + +USE master; +GO + +CREATE TABLE t1(a int); +GO + +CREATE TABLE t2(b int); +GO + +USE db_4934_1; +GO + +CREATE TABLE t1(a int); +GO + +CREATE TABLE t2(b int); +GO + +USE db_4934_2; +GO + +CREATE TABLE t1(a int); +GO + +CREATE TABLE t2(b int); +GO + +USE db_4934_1; +GO + +-- #4934.1 It should be blocked +SELECT * INTO t222 FROM master.dbo.t1; +GO + +SELECT * INTO t222 FROM master..t1; +GO + +SELECT * INTO t222 FROM db_4934_2..t1; +GO + +SELECT * INTO t222 FROM db_4934_2.dbo.t1; +GO + +SELECT * INTO t222 FROM db_4934_2..t1, t1; +GO + +SELECT * INTO t222 FROM t1, db_4934_1..t2; +GO + +SELECT * INTO t222 FROM master..t1, db_4934_2..t1; +GO + +SELECT * INTO t222 FROM (SELECT * FROM master..t1); +GO + +SELECT * INTO t222 FROM (SELECT * FROM t1, master..t1); +GO + +SELECT * INTO t222 FROM (SELECT *, (SELECT * FROM master..t1) FROM t1); +GO + +SELECT * INTO t222 FROM (SELECT *, (SELECT * FROM t1) FROM master..t3); +GO + +SELECT * INTO master..t222 FROM db_4934_2..t1; +GO + +SELECT * INTO db_4934_1..t222 FROM db_4934_2..t1; +GO + +SELECT * INTO master..t222 FROM master..t1; +GO + +-- #4934.2 Following statements will succeed across same database +SELECT * INTO t3 FROM db_4934_1.dbo.t1; +GO + +SELECT * INTO t4 FROM dbo.t1; +GO + +SELECT * INTO t5 FROM db_4934_1..t1; +GO + +SELECT * INTO t6 FROM db_4934_1..t1, db_4934_1..t2; +GO + +SELECT * INTO t7 FROM (SELECT * FROM db_4934_1..t1); +GO + +SELECT * INTO t8 FROM (SELECT *, (SELECT * FROM db_4934_1..t2) FROM db_4934_1..t1); +GO + +-- validate the access +SELECT * FROM t3, t4, t5, t6, t7, t8; +GO + +DROP TABLE t3, t4, t5, t6, t7, t8; +GO + +-- #4934.3 Temporary table should not be blocked +SELECT * INTO #t1 FROM db_4934_1.dbo.t1; +GO + +SELECT * INTO #t2 FROM (SELECT * FROM db_4934_1.dbo.t1); +GO + +-- validate the access +SELECT * FROM #t1, #t2; +GO + +DROP TABLE #t1, #t2; +GO + +-- Even though this is same as above statement, this will still fail since +-- internally it considers as cross-db statement (This behaviour is general to +-- all of the applicable DMLs) +SELECT * INTO tempdb..#t3 FROM db_4934_1.dbo.t1; +GO + + +USE master; +GO + +DROP TABLE t1, t2; +GO + +DROP DATABASE db_4934_1; +GO + +DROP DATABASE db_4934_2; +GO + -- psql ALTER SYSTEM SET babelfishpg_tsql.migration_mode = 'single-db'; SELECT pg_reload_conf(); diff --git a/test/JDBC/input/BABEL-GRANT.sql b/test/JDBC/input/BABEL-GRANT.sql index 8388f782ffd..d740686be37 100644 --- a/test/JDBC/input/BABEL-GRANT.sql +++ b/test/JDBC/input/BABEL-GRANT.sql @@ -206,6 +206,243 @@ GO REVOKE ALL ON OBJECT::t1 TO guest AS superuser; GO +--- +--- Check for supported and unsupported GRANT syntax +--- + +GRANT EXECUTE ON APPLICATION ROLE::test TO public; +GO + +GRANT EXECUTE ON ASSEMBLY::test TO public; +GO + +GRANT EXECUTE ON ASYMMETRIC KEY::test TO public; +GO + +GRANT EXECUTE ON AVAILABILITY GROUP::test TO public; +GO + +GRANT EXECUTE ON CERTIFICATE::test TO public; +GO + +GRANT EXECUTE ON CONTRACT::test TO public; +GO + +GRANT EXECUTE ON DATABASE::test TO public; +GO + +GRANT EXECUTE ON DATABASE SCOPED CREDENTIAL::test TO public; +GO + +GRANT EXECUTE ON ENDPOINT::test TO public; +GO + +GRANT EXECUTE ON FULLTEXT CATALOG::test TO public; +GO + +GRANT EXECUTE ON FULLTEXT STOPLIST::test TO public; +GO + +GRANT EXECUTE ON LOGIN::test TO public; +GO + +GRANT EXECUTE ON MESSAGE TYPE::test TO public; +GO + +GRANT SELECT ON OBJECT::t1 TO public; +GO + +GRANT EXECUTE ON REMOTE SERVICE BINDING::test TO public; +GO + +GRANT EXECUTE ON ROLE::test TO public; +GO + +GRANT EXECUTE ON ROUTE::test TO public; +GO + +GRANT EXECUTE ON SCHEMA::scm TO public; +GO + +GRANT EXECUTE ON SEARCH PROPERTY LIST::test TO public; +GO + +GRANT EXECUTE ON SERVER ROLE::test TO public; +GO + +GRANT EXECUTE ON SERVICE::test TO public; +GO + +GRANT EXECUTE ON SYMMETRIC KEY::test TO public; +GO + +GRANT EXECUTE ON TYPE::test TO public; +GO + +GRANT EXECUTE ON USER::test TO public; +GO + +GRANT EXECUTE ON XML SCHEMA COLLECTION::scm TO public; +GO + +--- +--- Check for supported and unsupported REVOKE syntax +--- + +REVOKE EXECUTE ON APPLICATION ROLE::test TO public; +GO + +REVOKE EXECUTE ON ASSEMBLY::test TO public; +GO + +REVOKE EXECUTE ON ASYMMETRIC KEY::test TO public; +GO + +REVOKE EXECUTE ON AVAILABILITY GROUP::test TO public; +GO + +REVOKE EXECUTE ON CERTIFICATE::test TO public; +GO + +REVOKE EXECUTE ON CONTRACT::test TO public; +GO + +REVOKE EXECUTE ON DATABASE::test TO public; +GO + +REVOKE EXECUTE ON DATABASE SCOPED CREDENTIAL::test TO public; +GO + +REVOKE EXECUTE ON ENDPOINT::test TO public; +GO + +REVOKE EXECUTE ON FULLTEXT CATALOG::test TO public; +GO + +REVOKE EXECUTE ON FULLTEXT STOPLIST::test TO public; +GO + +REVOKE EXECUTE ON LOGIN::test TO public; +GO + +REVOKE EXECUTE ON MESSAGE TYPE::test TO public; +GO + +REVOKE SELECT ON OBJECT::t1 TO public; +GO + +REVOKE EXECUTE ON REMOTE SERVICE BINDING::test TO public; +GO + +REVOKE EXECUTE ON ROLE::test TO public; +GO + +REVOKE EXECUTE ON ROUTE::test TO public; +GO + +REVOKE EXECUTE ON SCHEMA::scm TO public; +GO + +REVOKE EXECUTE ON SEARCH PROPERTY LIST::test TO public; +GO + +REVOKE EXECUTE ON SERVER ROLE::test TO public; +GO + +REVOKE EXECUTE ON SERVICE::test TO public; +GO + +REVOKE EXECUTE ON SYMMETRIC KEY::test TO public; +GO + +REVOKE EXECUTE ON TYPE::test TO public; +GO + +REVOKE EXECUTE ON USER::test TO public; +GO + +REVOKE EXECUTE ON XML SCHEMA COLLECTION::scm TO public; +GO + +--- +--- Check for supported and unsupported DENY syntax +--- + +DENY EXECUTE ON APPLICATION ROLE::test TO public; +GO + +DENY EXECUTE ON ASSEMBLY::test TO public; +GO + +DENY EXECUTE ON ASYMMETRIC KEY::test TO public; +GO + +DENY EXECUTE ON AVAILABILITY GROUP::test TO public; +GO + +DENY EXECUTE ON CERTIFICATE::test TO public; +GO + +DENY EXECUTE ON CONTRACT::test TO public; +GO + +DENY EXECUTE ON DATABASE::test TO public; +GO + +DENY EXECUTE ON DATABASE SCOPED CREDENTIAL::test TO public; +GO + +DENY EXECUTE ON ENDPOINT::test TO public; +GO + +DENY EXECUTE ON FULLTEXT CATALOG::test TO public; +GO + +DENY EXECUTE ON FULLTEXT STOPLIST::test TO public; +GO + +DENY EXECUTE ON LOGIN::test TO public; +GO + +DENY EXECUTE ON MESSAGE TYPE::test TO public; +GO + +DENY SELECT ON OBJECT::t1 TO public; +GO + +DENY EXECUTE ON REMOTE SERVICE BINDING::test TO public; +GO + +DENY EXECUTE ON ROLE::test TO public; +GO + +DENY EXECUTE ON ROUTE::test TO public; +GO + +DENY EXECUTE ON SCHEMA::scm TO public; +GO + +DENY EXECUTE ON SEARCH PROPERTY LIST::test TO public; +GO + +DENY EXECUTE ON SERVER ROLE::test TO public; +GO + +DENY EXECUTE ON SERVICE::test TO public; +GO + +DENY EXECUTE ON SYMMETRIC KEY::test TO public; +GO + +DENY EXECUTE ON TYPE::test TO public; +GO + +DENY EXECUTE ON USER::test TO public; +GO + +DENY EXECUTE ON XML SCHEMA COLLECTION::scm TO public; +GO + --- --- Clean Up --- diff --git a/test/JDBC/input/BABEL-LOGIN-USER-EXT.mix b/test/JDBC/input/BABEL-LOGIN-USER-EXT.mix index 41f6c3c9629..491391cc22d 100644 --- a/test/JDBC/input/BABEL-LOGIN-USER-EXT.mix +++ b/test/JDBC/input/BABEL-LOGIN-USER-EXT.mix @@ -715,3 +715,83 @@ GO SELECT pg_sleep(1); GO + +-- tsql +CREATE DATABASE babel_4935_db +GO + +USE babel_4935_db +GO + +-- Login that is member sysadmin +CREATE LOGIN babel_4935_sysadmin WITH PASSWORD = '123' +GO + +ALTER ROLE sysadmin ADD MEMBER babel_4935_sysadmin +GO + +-- Logins that are not a member of sysadmin but have users associated +CREATE LOGIN babel_4935_no_sysadmin1 WITH PASSWORD = '123' +CREATE LOGIN babel_4935_no_sysadmin2 WITH PASSWORD = '123' +GO + +CREATE USER babel_4935_no_sysadmin1 +CREATE USER babel_4935_no_sysadmin2 +GO + +-- Login that is not a member of sysadmin and has no user associated +CREATE LOGIN babel_4935_guest WITH PASSWORD = '123' +GO + +GRANT CONNECT TO guest +GO + +-- jdbc_user is superuser so should see all the users +SELECT name FROM sys.database_principals ORDER BY name +GO + +-- tsql user=babel_4935_sysadmin password=123 database=babel_4935_db +-- login is member of sysadmin so should see all the users +SELECT name FROM sys.database_principals ORDER BY name +GO + +-- tsql user=babel_4935_no_sysadmin1 password=123 database=babel_4935_db +-- login is not member of sysadmin so should see all the system users and only it's own user +SELECT name FROM sys.database_principals ORDER BY name +GO + +-- tsql user=babel_4935_guest password=123 database=babel_4935_db +-- login is not member of sysadmin and no user associated so should only see system users +SELECT name FROM sys.database_principals ORDER BY name +GO + +-- psql +-- Need to terminate active session before cleaning up the login +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'babel_4935_sysadmin' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +GO + +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'babel_4935_no_sysadmin1' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +GO + +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'babel_4935_guest' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +GO + +-- Wait to sync with another session +SELECT pg_sleep(1); +GO + +-- tsql +USE master +GO + +DROP DATABASE babel_4935_db +GO + +DROP LOGIN babel_4935_sysadmin +DROP LOGIN babel_4935_no_sysadmin1 +DROP LOGIN babel_4935_no_sysadmin2 +DROP LOGIN babel_4935_guest +GO diff --git a/test/JDBC/input/BABEL-ROLE-MEMBER-vu-verify.mix b/test/JDBC/input/BABEL-ROLE-MEMBER-vu-verify.mix index 65faccd7fda..f8ce2a45240 100644 --- a/test/JDBC/input/BABEL-ROLE-MEMBER-vu-verify.mix +++ b/test/JDBC/input/BABEL-ROLE-MEMBER-vu-verify.mix @@ -86,7 +86,7 @@ GO SELECT IS_ROLEMEMBER('BABEL_ROLE_MEMBER_vu_prepare_role1', NULL) GO --- Given role name is not a real role, should return NULL +-- Given name is a real user but not associated with login, should return 0 SELECT IS_MEMBER('BABEL_ROLE_MEMBER_vu_prepare_user1') GO SELECT IS_ROLEMEMBER('BABEL_ROLE_MEMBER_vu_prepare_user1') diff --git a/test/JDBC/input/BABEL-ROLE-MEMBER.mix b/test/JDBC/input/BABEL-ROLE-MEMBER.mix index c0bf23ff5ba..7d8c113085e 100644 --- a/test/JDBC/input/BABEL-ROLE-MEMBER.mix +++ b/test/JDBC/input/BABEL-ROLE-MEMBER.mix @@ -44,6 +44,13 @@ GO CREATE USER test_user3 FOR LOGIN test_login3 GO +-- check for roles with name > 64 characters +CREATE ROLE thisroleisaveryuniquerolewhereitsnamelengthisveryveryverylongandspansonehundredandelevencharacterswhichis__111 +GO + +CREATE ROLE thisroleisaveryuniquerolewhereitsnamelengthisveryveryverylongandspansonehundredandelevencharacterswhichis__111_dup +GO + -- role1 -> role2 -> role3 -> role4 ALTER ROLE test_role1 ADD MEMBER test_role2 GO @@ -61,6 +68,9 @@ GO ALTER ROLE test_role3 ADD MEMBER test_user3 GO +ALTER ROLE thisroleisaveryuniquerolewhereitsnamelengthisveryveryverylongandspansonehundredandelevencharacterswhichis__111 ADD MEMBER test_user3 +GO + -- Print the current membership status EXEC babel_role_members GO @@ -108,6 +118,17 @@ GO SELECT IS_ROLEMEMBER('public', 'test_user1') GO +-- Return NULL for server roles other than public +SELECT IS_MEMBER('sysadmin') +GO + +-- Return NULL for SQL logins and users +SELECT IS_MEMBER('test_login1') +GO + +SELECT IS_MEMBER('test_user1') +GO + -- Should return 0 SELECT IS_ROLEMEMBER('db_owner', 'test_role1') GO @@ -239,10 +260,14 @@ SELECT IS_ROLEMEMBER('test_role1', 'test_role3') GO SELECT IS_MEMBER('test_user3') GO +SELECT IS_MEMBER('thisroleisaveryuniquerolewhereitsnamelengthisveryveryverylongandspansonehundredandelevencharacterswhichis__111') +GO -- Should return 0 SELECT IS_MEMBER('test_role4') GO +SELECT IS_MEMBER('thisroleisaveryuniquerolewhereitsnamelengthisveryveryverylongandspansonehundredandelevencharacterswhichis__111_dup') +GO -- Doesn't have permission, should return NULL SELECT IS_ROLEMEMBER('test_role3', 'test_role4') @@ -281,6 +306,10 @@ DROP ROLE test_role2 GO DROP ROLE test_role1 GO +DROP ROLE thisroleisaveryuniquerolewhereitsnamelengthisveryveryverylongandspansonehundredandelevencharacterswhichis__111 +GO +DROP ROLE thisroleisaveryuniquerolewhereitsnamelengthisveryveryverylongandspansonehundredandelevencharacterswhichis__111_dup +GO -- psql -- Need to terminate active session before cleaning up the login diff --git a/test/JDBC/input/BABEL-UNSUPPORTED.sql b/test/JDBC/input/BABEL-UNSUPPORTED.sql index 12af2f08fcb..8a3b8e4a1ec 100644 --- a/test/JDBC/input/BABEL-UNSUPPORTED.sql +++ b/test/JDBC/input/BABEL-UNSUPPORTED.sql @@ -251,20 +251,12 @@ GO -- escape hatch: storage_on_partition. -- 'strict' is default -CREATE TABLE t_unsupported_sop1(a int) ON partition(a); -GO - CREATE TABLE t_unsupported_sop2(a int) FILESTREAM_ON partition(a); GO SELECT set_config('babelfishpg_tsql.escape_hatch_storage_on_partition', 'ignore', 'false') GO -CREATE TABLE t_unsupported_sop1(a int) ON partition(a); -GO -DROP TABLE t_unsupported_sop1; -GO - CREATE TABLE t_unsupported_sop2(a int) FILESTREAM_ON partition(a); GO DROP TABLE t_unsupported_sop2 @@ -1317,9 +1309,6 @@ EXEC sp_babelfish_configure 'babelfishpg_tsql.escape_hatch_schemabinding_%', 'ig GO -- test automatically generated message for unsupported DDL -CREATE PARTITION FUNCTION f_unsupported_1(datetime) AS RANGE RIGHT FOR VALUES (N'2017-07-11T00:00:00.000', N'2017-07-12T00:00:00.000', N'2017-07-13T00:00:00.000'); -GO - ALTER AUTHORIZATION ON a1 TO SCHEMA OWNER; GO diff --git a/test/JDBC/input/BABEL_4330-before-15_8-or-16_4-vu-prepare.sql b/test/JDBC/input/BABEL_4330-before-15_8-or-16_4-vu-prepare.sql new file mode 100644 index 00000000000..0efac9eac1d --- /dev/null +++ b/test/JDBC/input/BABEL_4330-before-15_8-or-16_4-vu-prepare.sql @@ -0,0 +1,17 @@ + +CREATE TABLE babel_4330_vu_prepare_t1(a varchar(50) NULL); +GO + +INSERT INTO babel_4330_vu_prepare_t1 VALUES('ababa'); +GO + +CREATE VIEW babel_4330_vu_prepare_v1 AS +SELECT replace(a, 'a', 'c') FROM babel_4330_vu_prepare_t1 +GO + +CREATE FUNCTION babel_4330_vu_prepare_f1() returns table as return +SELECT replace(a, 'a', 'c') FROM babel_4330_vu_prepare_t1 +GO + +CREATE PROCEDURE babel_4330_vu_prepare_p1 AS SELECT replace(a, 'a', 'c') FROM babel_4330_vu_prepare_t1 +GO \ No newline at end of file diff --git a/test/JDBC/input/BABEL_4330-before-15_8-or-16_4-vu-verify.sql b/test/JDBC/input/BABEL_4330-before-15_8-or-16_4-vu-verify.sql new file mode 100644 index 00000000000..645b3d01c2c --- /dev/null +++ b/test/JDBC/input/BABEL_4330-before-15_8-or-16_4-vu-verify.sql @@ -0,0 +1,25 @@ +SELECT replace(a, 'a', 'c') FROM babel_4330_vu_prepare_t1; +go + +SELECT * FROM babel_4330_vu_prepare_v1; +go + + +SELECT * FROM babel_4330_vu_prepare_f1(); +go + +EXEC babel_4330_vu_prepare_p1; +GO + + +DROP PROCEDURE babel_4330_vu_prepare_p1; +GO + +DROP FUNCTION babel_4330_vu_prepare_f1; +GO + +DROP VIEW babel_4330_vu_prepare_v1; +GO + +DROP TABLE babel_4330_vu_prepare_t1; +GO \ No newline at end of file diff --git a/test/JDBC/input/BABEL_4982.mix b/test/JDBC/input/BABEL_4982.mix new file mode 100644 index 00000000000..688cc85686c --- /dev/null +++ b/test/JDBC/input/BABEL_4982.mix @@ -0,0 +1,64 @@ +-- psql +CREATE SCHEMA s1 +GO + +CREATE TABLE s1.babel_4982_t (id VARCHAR(100)) +GO + +CREATE FUNCTION babel_4982_ddl_trigger() +RETURNS event_trigger AS +$$ +BEGIN +INSERT INTO babel_4982_t VALUES (current_setting('search_path')); +END; +$$ +SECURITY DEFINER +SET search_path = s1, pg_catalog, pg_temp +LANGUAGE plpgsql; + +CREATE EVENT TRIGGER babel_4982_ddl_trigger + ON ddl_command_end + EXECUTE PROCEDURE babel_4982_ddl_trigger(); + +SELECT set_config('search_path', 'master_dbo, sys, '||current_setting('search_path'), false); +GO + +SHOW search_path +GO + +CREATE TABLE babel_4982_t2 (id INT) +GO + +SHOW search_path +GO + +BEGIN +GO + +SHOW search_path +GO + +DROP TABLE babel_4982_t2 +GO + +SHOW search_path +GO + +COMMIT +GO + +-- two entries since two DDLs after trigger was created +SELECT * FROM s1.babel_4982_t +GO + +DROP EVENT TRIGGER babel_4982_ddl_trigger +GO + +DROP FUNCTION babel_4982_ddl_trigger +GO + +DROP TABLE s1.babel_4982_t +GO + +DROP SCHEMA s1 +GO diff --git a/test/JDBC/input/BABEL_OBJECT_DEFINITION-vu-verify.mix b/test/JDBC/input/BABEL_OBJECT_DEFINITION-vu-verify.mix index 3edd1e724bb..0a61ddc3022 100644 --- a/test/JDBC/input/BABEL_OBJECT_DEFINITION-vu-verify.mix +++ b/test/JDBC/input/BABEL_OBJECT_DEFINITION-vu-verify.mix @@ -35,8 +35,6 @@ SELECT OBJECT_DEFINITION(OBJECT_ID('object_definition_fc1')) GO -- DML trigger --- TODO: After BABEL-3927 is fixed, we get the correct trigger definition. --- Now, it shows NULL. SELECT OBJECT_DEFINITION(OBJECT_ID('object_definition_tr1')) GO diff --git a/test/JDBC/input/GRANT_SCHEMA.mix b/test/JDBC/input/GRANT_SCHEMA.mix index a090901e514..36b91dac824 100644 --- a/test/JDBC/input/GRANT_SCHEMA.mix +++ b/test/JDBC/input/GRANT_SCHEMA.mix @@ -2332,4 +2332,12 @@ go -- psql -- should have no entries since the table is dropped select schema_name, object_name, permission, grantee from sys.babelfish_schema_permissions where object_name = 'babel_4344_t1'; -go \ No newline at end of file +go + +-- tsql +-- should properly throw an error when schema does not exist +GRANT SELECT on doesnt_exist.tbl TO public; +GO + +grant execute on xyz.babel_4344_p to public; +GO diff --git a/test/JDBC/input/ISC-Tables-before_16_4_or_15_8_or_14_13-vu-cleanup.sql b/test/JDBC/input/ISC-Tables-before_16_4_or_15_8_or_14_13-vu-cleanup.sql new file mode 100644 index 00000000000..b2a1c38e3d1 --- /dev/null +++ b/test/JDBC/input/ISC-Tables-before_16_4_or_15_8_or_14_13-vu-cleanup.sql @@ -0,0 +1,28 @@ +DROP TABLE isc_tables_sc1.t2 +DROP TABLE [ISC_TABLES_TABLE_SCHEMA].[ISC_TABLES_TABLE] +DROP TABLE [ISC_TABLES SCHEMA . WITH .. DOTS].[ISC_TABLES TABLE . WITH .. DOTS2] +GO + +DROP TYPE isc_tables_sc1.isc_table_type2 +GO + +DROP SCHEMA isc_tables_sc1 +DROP SCHEMA [ISC_TABLES_TABLE_SCHEMA] +DROP SCHEMA [ISC_TABLES SCHEMA . WITH .. DOTS] +GO + +DROP VIEW isc_tables_vu_prepare_v1 +GO + +DROP FUNCTION isc_tables_vu_prepare_f2 +DROP FUNCTION isc_tables_vu_prepare_f1 +GO + +DROP PROCEDURE isc_tables_vu_prepare_p1 +GO + +DROP TABLE isc_tables_vu_prepare_t1 +GO + +DROP TYPE isc_table_type1 +GO diff --git a/test/JDBC/input/ISC-Tables-before_16_4_or_15_8_or_14_13-vu-prepare.sql b/test/JDBC/input/ISC-Tables-before_16_4_or_15_8_or_14_13-vu-prepare.sql new file mode 100644 index 00000000000..806a0e3c9d7 --- /dev/null +++ b/test/JDBC/input/ISC-Tables-before_16_4_or_15_8_or_14_13-vu-prepare.sql @@ -0,0 +1,56 @@ +CREATE TABLE isc_tables_vu_prepare_t1(a INT,b INT) +GO + +CREATE TYPE isc_table_type1 AS TABLE(a INT) +GO + +-- test different schema +CREATE SCHEMA isc_tables_sc1 +GO + +CREATE SCHEMA [ISC_TABLES_TABLE_SCHEMA] +GO + +CREATE SCHEMA [ISC_TABLES SCHEMA . WITH .. DOTS] +GO + +CREATE TABLE isc_tables_sc1.t2(a INT,b INT) +GO + +-- Table name which is prefix of schema name +CREATE TABLE [ISC_TABLES_TABLE_SCHEMA] . [ISC_TABLES_TABLE] (a INT, b INT) +GO + +CREATE TABLE [ISC_TABLES SCHEMA . WITH .. DOTS] . [ISC_TABLES TABLE . WITH .. DOTS] (a INT, b INT) +GO + +CREATE TYPE isc_tables_sc1.isc_table_type2 AS TABLE(a INT) +GO + +--Dep Proc +CREATE PROCEDURE isc_tables_vu_prepare_p1 AS +SELECT * FROM information_schema.tables WHERE TABLE_NAME = 'isc_tables_vu_prepare_t1' +SELECT * FROM information_schema.tables WHERE TABLE_NAME = 'ISC_TABLES_VU_PREPARE_T1' +GO + +-- Dep Funcs +CREATE FUNCTION isc_tables_vu_prepare_f1() +RETURNS INT +AS +BEGIN + RETURN (SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_NAME LIKE 'isc_tables%') +end +GO + +CREATE FUNCTION isc_tables_vu_prepare_f2() +RETURNS INT +AS +BEGIN + RETURN (SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_NAME LIKE 'ISC_TABLES%') +end +GO + +-- Dep View +CREATE VIEW isc_tables_vu_prepare_v1 AS + SELECT * FROM information_schema.tables WHERE TABLE_NAME LIKE 'ISC_TABLES%' ORDER BY TABLE_NAME +GO diff --git a/test/JDBC/input/ISC-Tables-before_16_4_or_15_8_or_14_13-vu-verify.sql b/test/JDBC/input/ISC-Tables-before_16_4_or_15_8_or_14_13-vu-verify.sql new file mode 100644 index 00000000000..b1bdcfc6fde --- /dev/null +++ b/test/JDBC/input/ISC-Tables-before_16_4_or_15_8_or_14_13-vu-verify.sql @@ -0,0 +1,52 @@ +SELECT * FROM information_schema.tables WHERE TABLE_NAME LIKE 'ISC_TABLES%' ORDER BY TABLE_NAME +GO + +-- Rename the existing tables to fix the originally stored incorrect bbf_original_rel_name +EXEC sp_rename 'ISC_TABLES_TABLE_SCHEMA.ISC_TABLES_TABLE', 'ISC_TABLES_TABLE2', 'OBJECT' +GO + +EXEC sp_rename '"ISC_TABLES SCHEMA . WITH .. DOTS"."ISC_TABLES TABLE . WITH .. DOTS"', 'ISC_TABLES TABLE . WITH .. DOTS2', 'OBJECT' +GO + +-- create a new table with name which is prefix of schema name to verify new behavior +CREATE TABLE [ISC_TABLES_TABLE_SCHEMA] . [ISC_TABLES_TABLE] (a INT, b INT) +GO + +SELECT * FROM information_schema.tables WHERE TABLE_NAME LIKE 'isc_tables%' ORDER BY TABLE_NAME +SELECT * FROM information_schema.tables WHERE TABLE_NAME LIKE 'ISC_TABLES%' ORDER BY TABLE_NAME +GO + +-- Table types should not be a result +-- Should not return any rows. +SELECT * FROM information_schema.tables WHERE TABLE_NAME = 'isc_table_type1' +GO + +SELECT * FROM information_schema.tables WHERE TABLE_SCHEMA = 'isc_tables_sc1' +SELECT * FROM information_schema.tables WHERE TABLE_SCHEMA = 'ISC_TABLES_SC1' +GO + +-- Table types should not be a result +-- Should not return any rows. +SELECT * FROM information_schema.tables WHERE (TABLE_NAME = 'isc_table_type2' AND TABLE_SCHEMA = 'isc_tables_sc1') +GO + +EXEC isc_tables_vu_prepare_p1 +GO + +SELECT * FROM isc_tables_vu_prepare_f1() +SELECT * FROM isc_tables_vu_prepare_f2() +GO + +-- Drop and re-create isc_tables_vu_prepare_v1 as it might be dependent upon +-- the deprecated version of information_schema.tables view. +DROP VIEW isc_tables_vu_prepare_v1 +GO +CREATE VIEW isc_tables_vu_prepare_v1 AS + SELECT * FROM information_schema.tables WHERE TABLE_NAME LIKE 'ISC_TABLES%' ORDER BY TABLE_NAME +GO + +SELECT * FROM isc_tables_vu_prepare_v1 +GO + +DROP TABLE [ISC_TABLES_TABLE_SCHEMA] . [ISC_TABLES_TABLE2] +GO diff --git a/test/JDBC/input/ISC-Tables-vu-cleanup.sql b/test/JDBC/input/ISC-Tables-vu-cleanup.sql index ccadb1a4256..d648cef653b 100644 --- a/test/JDBC/input/ISC-Tables-vu-cleanup.sql +++ b/test/JDBC/input/ISC-Tables-vu-cleanup.sql @@ -1,10 +1,14 @@ DROP TABLE isc_tables_sc1.t2 +DROP TABLE [ISC_TABLES_TABLE_SCHEMA].[ISC_TABLES_TABLE] +DROP TABLE [ISC_TABLES SCHEMA . WITH .. DOTS].[ISC_TABLES TABLE . WITH .. DOTS] GO DROP TYPE isc_tables_sc1.isc_table_type2 GO DROP SCHEMA isc_tables_sc1 +DROP SCHEMA [ISC_TABLES_TABLE_SCHEMA] +DROP SCHEMA [ISC_TABLES SCHEMA . WITH .. DOTS] GO DROP VIEW isc_tables_vu_prepare_v1 diff --git a/test/JDBC/input/ISC-Tables-vu-prepare.sql b/test/JDBC/input/ISC-Tables-vu-prepare.sql index 18f81a38128..806a0e3c9d7 100644 --- a/test/JDBC/input/ISC-Tables-vu-prepare.sql +++ b/test/JDBC/input/ISC-Tables-vu-prepare.sql @@ -8,9 +8,22 @@ GO CREATE SCHEMA isc_tables_sc1 GO +CREATE SCHEMA [ISC_TABLES_TABLE_SCHEMA] +GO + +CREATE SCHEMA [ISC_TABLES SCHEMA . WITH .. DOTS] +GO + CREATE TABLE isc_tables_sc1.t2(a INT,b INT) GO +-- Table name which is prefix of schema name +CREATE TABLE [ISC_TABLES_TABLE_SCHEMA] . [ISC_TABLES_TABLE] (a INT, b INT) +GO + +CREATE TABLE [ISC_TABLES SCHEMA . WITH .. DOTS] . [ISC_TABLES TABLE . WITH .. DOTS] (a INT, b INT) +GO + CREATE TYPE isc_tables_sc1.isc_table_type2 AS TABLE(a INT) GO @@ -25,7 +38,7 @@ CREATE FUNCTION isc_tables_vu_prepare_f1() RETURNS INT AS BEGIN - RETURN (SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_NAME = 'isc_tables_vu_prepare_t1') + RETURN (SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_NAME LIKE 'isc_tables%') end GO @@ -33,11 +46,11 @@ CREATE FUNCTION isc_tables_vu_prepare_f2() RETURNS INT AS BEGIN - RETURN (SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_NAME = 'ISC_TABLES_VU_PREPARE_T1') + RETURN (SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_NAME LIKE 'ISC_TABLES%') end GO -- Dep View CREATE VIEW isc_tables_vu_prepare_v1 AS - SELECT * FROM information_schema.tables WHERE TABLE_NAME = 'ISC_TABLES_VU_PREPARE_T1' + SELECT * FROM information_schema.tables WHERE TABLE_NAME LIKE 'ISC_TABLES%' ORDER BY TABLE_NAME GO diff --git a/test/JDBC/input/ISC-Tables-vu-verify.sql b/test/JDBC/input/ISC-Tables-vu-verify.sql index eba2754bd54..031d4746abe 100644 --- a/test/JDBC/input/ISC-Tables-vu-verify.sql +++ b/test/JDBC/input/ISC-Tables-vu-verify.sql @@ -1,5 +1,5 @@ -SELECT * FROM information_schema.tables WHERE TABLE_NAME = 'isc_tables_vu_prepare_t1' -SELECT * FROM information_schema.tables WHERE TABLE_NAME = 'ISC_TABLES_VU_PREPARE_T1' +SELECT * FROM information_schema.tables WHERE TABLE_NAME LIKE 'isc_tables%' ORDER BY TABLE_NAME +SELECT * FROM information_schema.tables WHERE TABLE_NAME LIKE 'ISC_TABLES%' ORDER BY TABLE_NAME GO -- Table types should not be a result diff --git a/test/JDBC/input/PARTITION-vu-cleanup.mix b/test/JDBC/input/PARTITION-vu-cleanup.mix new file mode 100644 index 00000000000..5c40b45835c --- /dev/null +++ b/test/JDBC/input/PARTITION-vu-cleanup.mix @@ -0,0 +1,465 @@ +DROP VIEW GetPartitionFunctionMetadataView +GO + +DROP VIEW GetRangeMetadataView +GO + +DROP VIEW GetRangeMetadataVarBinaryFunctionView +GO + +DROP VIEW GetParameterMetadataView +GO + +DROP VIEW GetPartitionSchemesMetadataView +GO + +DROP VIEW GetPartitionedTableListFromSysTablesView +GO + +DROP VIEW GetPartitionedIndexListFromSysIndexesView +GO + +DROP FUNCTION PartitionFunctionContainsDuplicateName +GO + +DROP FUNCTION PartitionFunctionContainsDuplicateIDs +GO + +DROP FUNCTION PartitionSchemeContainsDuplicateName +GO + +DROP FUNCTION PartitionSchemeContainsDuplicateIDs +GO + +DROP VIEW GetPartitionSchemeOrFilegroupForTableOrIndex +GO + +DROP VIEW GetFileGroupMappingOfPartitionScheme +GO + +DROP VIEW GetPartitionedTablePartitioningColumn +GO + +DROP VIEW GetPartitionedIndexPartitioningColumn +GO + +DROP VIEW GetSysPartitionsMetadata +GO + +DROP VIEW DollarPartitionFunctionView +GO + +DROP PROCEDURE DollarPartitionFunctionProc +GO + +DROP FUNCTION DollarPartitionFunctionFunc +GO + +DROP VIEW DollarPartitionFunctionNullView +GO + +DROP PROCEDURE DollarPartitionFunctionNullProc +GO + +DROP FUNCTION DollarPartitionFunctionNullFunc +GO + +DROP VIEW SysSearchPartitionDepView +GO + +DROP VIEW SysSearchPartitionNULLDepView +GO +-------------------------------------------------- +--- DROP Partitioned Index +-------------------------------------------------- +DROP INDEX partition_vu_prepare_uniqueidentifier_index ON partition_vu_prepare_uniqueidentifier_table; +GO + +DROP INDEX partition_vu_prepare_varbinary_index ON partition_vu_prepare_varbinary_table; +GO + +DROP INDEX partition_vu_prepare_binary_index ON partition_vu_prepare_binary_table; +GO + +DROP INDEX partition_vu_prepare_nchar_index ON partition_vu_prepare_nchar_table; +GO + +DROP INDEX partition_vu_prepare_nvarchar_index ON partition_vu_prepare_nvarchar_table; +GO + +DROP INDEX partition_vu_prepare_varchar_index ON partition_vu_prepare_varchar_table; +GO + +DROP INDEX partition_vu_prepare_char_index ON partition_vu_prepare_char_table; +GO + +DROP INDEX partition_vu_prepare_smalldatetime_index ON partition_vu_prepare_smalldatetime_table; +GO + +DROP INDEX partition_vu_prepare_datetime2_index ON partition_vu_prepare_datetime2_table; +GO + +DROP INDEX partition_vu_prepare_datetime_index ON partition_vu_prepare_datetime_table; +GO + +DROP INDEX partition_vu_prepare_date_index ON partition_vu_prepare_date_table; +GO + +DROP INDEX partition_vu_prepare_smallmoney_index ON partition_vu_prepare_smallmoney_table; +GO + +DROP INDEX partition_vu_prepare_money_index ON partition_vu_prepare_money_table; +GO + +DROP INDEX partition_vu_prepare_numeric_index ON partition_vu_prepare_numeric_table; +GO + +DROP INDEX partition_vu_prepare_decimal_index ON partition_vu_prepare_decimal_table; +GO + +DROP INDEX partition_vu_prepare_tinyint_index ON partition_vu_prepare_tinyint_table; +GO + +DROP INDEX partition_vu_prepare_smallint_index ON partition_vu_prepare_smallint_table; +GO + +DROP INDEX partition_vu_prepare_bigint_index ON partition_vu_prepare_bigint_table; +GO + +DROP INDEX partition_vu_prepare_int_index ON partition_vu_prepare_int_table; +GO + +DROP INDEX PARTITION_INDEXログインαιώνια ON PARTITION_TABLEログインαιώνια +GO + +DROP INDEX [PARTITION_INDEX 유니코드스키마👻 ] ON [PARTITION_TABLE 유니코드스키마👻 ] +GO + +DROP INDEX partition_vu_prepare_normal_index ON partition_vu_prepare_normal_table +GO + + +SET QUOTED_IDENTIFIER ON; +GO + +DROP INDEX "PARTITION_INDEX 😎$@ #123 🌍rder " ON "PARTITION_TABLE 😎$@ #123 🌍rder " +GO + +SET QUOTED_IDENTIFIER OFF; +GO + +DROP INDEX PartitionIndexNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz +ON PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz +GO + +DROP INDEX PartitionIndexNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz +ON PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +GO +-------------------------------------------------- +--- DROP Partitioned Table +-------------------------------------------------- +DROP TABLE partition_vu_prepare_uniqueidentifier_table; +GO + +DROP TABLE partition_vu_prepare_varbinary_table; +GO + +DROP TABLE partition_vu_prepare_binary_table; +GO + +DROP TABLE partition_vu_prepare_nchar_table; +GO + +DROP TABLE partition_vu_prepare_nvarchar_table; +GO + +DROP TABLE partition_vu_prepare_varchar_table; +GO + +DROP TABLE partition_vu_prepare_char_table; +GO + +DROP TABLE partition_vu_prepare_smalldatetime_table; +GO + +DROP TABLE partition_vu_prepare_datetime2_table; +GO + +DROP TABLE partition_vu_prepare_datetime_table; +GO + +DROP TABLE partition_vu_prepare_date_table; +GO + +DROP TABLE partition_vu_prepare_smallmoney_table; +GO + +DROP TABLE partition_vu_prepare_money_table; +GO + +DROP TABLE partition_vu_prepare_numeric_table; +GO + +DROP TABLE partition_vu_prepare_decimal_table; +GO + +DROP TABLE partition_vu_prepare_tinyint_table; +GO + +DROP TABLE partition_vu_prepare_smallint_table; +GO + +DROP TABLE partition_vu_prepare_bigint_table; +GO + +DROP TABLE partition_vu_prepare_int_table; +GO + +DROP TABLE PartitionTableNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz +GO + +DROP TABLE PARTITION_TABLEログインαιώνια +GO + +DROP TABLE [PARTITION_TABLE 유니코드스키마👻 ] +GO + +DROP TABLE partition_vu_prepare_normal_table +GO + +SET QUOTED_IDENTIFIER ON; +GO + +DROP TABLE "PARTITION_TABLE 😎$@ #123 🌍rder " +GO + +SET QUOTED_IDENTIFIER OFF; +GO + +DROP TABLE PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz +GO + +DROP TABLE PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +GO + +DROP SCHEMA PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz +GO +-------------------------------------------------- +--- DROP Partition Scheme +-------------------------------------------------- +DROP PARTITION SCHEME IntPartitionScheme +GO + +DROP PARTITION SCHEME BigIntPartitionScheme +GO + +DROP PARTITION SCHEME SmallIntPartitionScheme +GO + +DROP PARTITION SCHEME TinyIntPartitionScheme +GO + +DROP PARTITION SCHEME DecimalPartitionScheme +GO + +DROP PARTITION SCHEME NumericPartitionScheme +GO + +DROP PARTITION SCHEME MoneyPartitionScheme +GO + +DROP PARTITION SCHEME SmallMoneyPartitionScheme +GO + +DROP PARTITION SCHEME DatePartitionScheme +GO + +DROP PARTITION SCHEME DateTimePartitionScheme +GO + +DROP PARTITION SCHEME DateTime2PartitionScheme +GO + +DROP PARTITION SCHEME SmallDateTimePartitionScheme +GO + +DROP PARTITION SCHEME CharPartitionScheme +GO + +DROP PARTITION SCHEME VarCharPartitionScheme +GO + +DROP PARTITION SCHEME NVarCharPartitionScheme +GO + +DROP PARTITION SCHEME NCharPartitionScheme +GO + +DROP PARTITION SCHEME BinaryPartitionScheme +GO + +DROP PARTITION SCHEME VarBinaryPartitionScheme +GO + +DROP PARTITION SCHEME UniqueIdentifierPartitionScheme +GO + +DROP PARTITION SCHEME PartitionSchemeNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz +GO + +DROP PARTITION SCHEME PARTITION_SCHEMEログインαιώνια +GO + +DROP PARTITION SCHEME [PARTITION_SCHEME 유니코드스키마👻 ] +GO + +SET QUOTED_IDENTIFIER ON; +GO + +DROP PARTITION SCHEME "PARTITION_SCHEME 😎$@ #123 🌍rder " +Go + +SET QUOTED_IDENTIFIER OFF; +GO + +DROP PARTITION SCHEME PartitionSchemeNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +GO + +------------------------------------------- +--- DROP Partition Function +------------------------------------------- +DROP PARTITION FUNCTION IntPartitionFunction +GO + +DROP PARTITION FUNCTION BigIntPartitionFunction +GO + +DROP PARTITION FUNCTION SmallIntPartitionFunction +GO + +DROP PARTITION FUNCTION TinyIntPartitionFunction +GO + +DROP PARTITION FUNCTION DecimalPartitionFunction +GO + +DROP PARTITION FUNCTION NumericPartitionFunction +GO + +DROP PARTITION FUNCTION MoneyPartitionFunction +GO + +DROP PARTITION FUNCTION SmallMoneyPartitionFunction +GO + +DROP PARTITION FUNCTION DatePartitionFunction +GO + +DROP PARTITION FUNCTION DateTimePartitionFunction +GO + +DROP PARTITION FUNCTION DateTime2PartitionFunction +GO + +DROP PARTITION FUNCTION SmallDateTimePartitionFunction +GO + +DROP PARTITION FUNCTION CharPartitionFunction +GO + +DROP PARTITION FUNCTION VarCharPartitionFunction +GO + +DROP PARTITION FUNCTION NVarCharPartitionFunction +GO + +DROP PARTITION FUNCTION NCharPartitionFunction +GO + +DROP PARTITION FUNCTION BinaryPartitionFunction +GO + +DROP PARTITION FUNCTION VarBinaryPartitionFunction +GO + +DROP PARTITION FUNCTION UniqueIdentifierPartitionFunction +GO + +DROP PARTITION FUNCTION PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz +GO + +DROP PARTITION FUNCTION PartitionFunctionHavingDifferentCollationInput +GO + +DROP PARTITION FUNCTION PARTITION_FUNCTIONログインαιώνια +GO + +DROP PARTITION FUNCTION [PARTITION_FUNCTION 유니코드스키마👻 ] +GO + +DROP PARTITION FUNCTION PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +GO + +--------------------------- +--- DROP Procedures +--------------------------- + +DROP PROCEDURE PartitionProcedureCreatePartitionFunction +GO + +DROP PROCEDURE PartitionProcedureCreatePartitionScheme +GO + +DROP PROCEDURE PartitionProcedureCreatePartitionTable +GO + +DROP PROCEDURE PartitionProcedureCreatePartitionFunctionSchemeAndTable +GO + +DROP PROCEDURE PartitionProcedureDropPartitionFunction +GO + +DROP PROCEDURE PartitionProcedureDropPartitionScheme +GO + +DROP PROCEDURE PartitionProcedureDropPartitionTable +GO + +DROP PROCEDURE PartitionProcedureDropPartitionFunctionSchemeAndTable +GO + + +SET QUOTED_IDENTIFIER ON; +GO + +DROP PARTITION FUNCTION "PARTITION_FUNCTION 😎$@ #123 🌍rder " +Go + +SET QUOTED_IDENTIFIER OFF; +GO + +USE PartitionDb; +GO + +DROP LOGIN partition_l1; +GO + +DROP LOGIN partition_l2 +GO + +USE master +go + +DROP DATABASE PartitionDb +go + +-- validate that catalogs don't have stale entries +-- psql +SELECT count(*) FROM sys.babelfish_partition_function; +GO + +SELECT count(*) FROM sys.babelfish_partition_scheme +GO + +SELECT count(*) FROM sys.babelfish_partition_depend +GO \ No newline at end of file diff --git a/test/JDBC/input/PARTITION-vu-prepare.mix b/test/JDBC/input/PARTITION-vu-prepare.mix new file mode 100644 index 00000000000..844eb9faa7e --- /dev/null +++ b/test/JDBC/input/PARTITION-vu-prepare.mix @@ -0,0 +1,1164 @@ + +--------------------------------------------------------------- +---- Views/Function to retrieve from the metadata Views +---------------------------------------------------------------- + +CREATE VIEW GetPartitionFunctionMetadataView +AS +( + SELECT + name, type, type_desc, fanout, boundary_value_on_right, is_system + FROM + sys.partition_functions + ORDER BY + name +) +GO + +CREATE VIEW GetRangeMetadataVIEW +AS +( + SELECT + name, parameter_id, boundary_id, value + FROM + sys.partition_range_values pr + LEFT JOIN + sys.partition_functions pf on (pr.function_id = pf.function_id) + WHERE + name not in ('BinaryPartitionFunction', 'VarBinaryPartitionFunction') + ORDER BY + name, boundary_id +) +GO + +CREATE VIEW GetRangeMetadataVarBinaryFunctionView +AS +( + SELECT + name, parameter_id, boundary_id, cast(value as varbinary) + FROM + sys.partition_range_values pr + LEFT JOIN + sys.partition_functions pf on (pr.function_id = pf.function_id) + WHERE + name in ('BinaryPartitionFunction', 'VarBinaryPartitionFunction') + ORDER BY + name, boundary_id +) +GO + + +CREATE VIEW GetParameterMetadataView +AS +( + SELECT + pf.name as function_name, typ.name as typname, parameter_id, pp.max_length, pp.precision, pp.scale, pp.collation_name + FROM + sys.partition_functions pf + INNER JOIN + sys.partition_parameters pp on (pp.function_id = pf.function_id) + INNER JOIN + sys.types typ on (pp.user_type_id = typ.user_type_id and pp.user_type_id = typ.system_type_id) + ORDER BY + pf.name +) +GO + +CREATE VIEW GetPartitionSchemesMetadataView +AS +( + SELECT + ps.name as scheme_name, pf.name as function_name, ps.type, ps.type_desc, is_default, ps.is_system + FROM + sys.partition_schemes ps + INNER JOIN + sys.partition_functions pf on (ps.function_id = pf.function_id) + ORDER BY + ps.name +) +GO + +CREATE FUNCTION PartitionFunctionContainsDuplicateName() +RETURNS TABLE +AS +RETURN +( + SELECT + name + FROM + sys.partition_functions + GROUP BY name + HAVING COUNT(*) > 1 +) +GO + +CREATE FUNCTION PartitionFunctionContainsDuplicateIDs() +RETURNS TABLE +AS +RETURN +( + SELECT + function_id + FROM + sys.partition_functions + GROUP BY function_id + HAVING COUNT(*) > 1 +) +GO + +CREATE FUNCTION PartitionSchemeContainsDuplicateName() +RETURNS TABLE +AS +RETURN +( + SELECT + name + FROM + sys.partition_schemes + GROUP BY name + HAVING COUNT(*) > 1 +) +GO + +CREATE FUNCTION PartitionSchemeContainsDuplicateIDs() +RETURNS TABLE +AS +RETURN +( + SELECT + data_space_id + FROM + sys.partition_schemes + GROUP BY data_space_id + HAVING COUNT(*) > 1 +) +GO + + +CREATE VIEW GetPartitionSchemeOrFilegroupForTableOrIndex +AS +( + SELECT + o.name AS TableName, + i.name AS IndexName, + ds.name AS PartitionSchemeOrFilegroupName + FROM + sys.indexes i + INNER JOIN + sys.objects o ON i.object_id = o.object_id + INNER JOIN + sys.data_spaces ds ON i.data_space_id = ds.data_space_id + WHERE + o.name like 'partition_vu_prepare%' + ORDER BY + o.name, i.name +) +GO + + +CREATE VIEW GetFileGroupMappingOfPartitionScheme +AS +( + SELECT + ps.name AS PartitionSchemeName, + sf.name AS FileGroupName, + dds.destination_id AS DestinationId + FROM + sys.partition_schemes AS ps + INNER JOIN + sys.destination_data_spaces AS dds ON dds.partition_scheme_id = ps.data_space_id + INNER JOIN + sys.filegroups AS sf ON sf.data_space_id = dds.data_space_id + WHERE + -- fetch only these two because they covers both possible value of next_used + ps.name in ('IntPartitionScheme', 'SmallIntPartitionScheme') + ORDER BY + ps.name, dds.destination_id +) +GO + + +CREATE VIEW GetPartitionedTablePartitioningColumn +AS +( + SELECT + tbl.name AS TableName, + c.name AS PartitioningColumn, + ic.partition_ordinal AS PartitionOrdinal + FROM + sys.tables AS tbl + INNER JOIN + sys.index_columns ic ON (ic.index_id = 0 AND ic.partition_ordinal > 0 AND ic.object_id = tbl.object_id) + INNER JOIN + sys.columns c ON (c.object_id = ic.object_id AND c.column_id = ic.column_id) + WHERE + tbl.name like 'partition_vu_prepare%' + ORDER BY + tbl.name +) +GO + +CREATE VIEW GetPartitionedIndexPartitioningColumn +AS +( + SELECT + idx.name AS IndexName, + OBJECT_NAME(idx.object_id) AS TableName, + c.name AS PartitioningColumn, + ic.partition_ordinal AS PartitionOrdinal + FROM + sys.indexes AS idx + INNER JOIN + sys.index_columns ic ON (ic.partition_ordinal > 0 AND ic.object_id = idx.object_id) + INNER JOIN + sys.columns c ON (c.object_id = ic.object_id AND c.column_id = ic.column_id) + WHERE + idx.name like 'partition_vu_prepare%' + ORDER BY + idx.name +) +GO + + +CREATE VIEW GetSysPartitionsMetadata +AS +( + SELECT + OBJECT_NAME(partition_id) AS PartitionName, + partition_number, + index_id + FROM + sys.partitions, + OBJECT_NAME(object_id) AS ParentName + WHERE + ParentName IN ('partition_vu_prepare_int_table', 'partition_vu_prepare_normal_table') + ORDER BY + ParentName, partition_number +) +GO + +-------------------------------------------------- +--- Create Normal TABLE and INDEX for Views testing +-------------------------------------------------- +CREATE TABLE partition_vu_prepare_normal_table ( + Id INT, + Value sys.varchar(50) +); +GO + +CREATE INDEX partition_vu_prepare_normal_index +ON partition_vu_prepare_normal_table(Value); +GO + +-------------------------------------------------- +--- Supported Datatypes for Partition Function +-------------------------------------------------- +-- all datatypes should sort and store the values in ascending order by itself +-- and input values should be implicit casted into specified type + + +-- using local variable in args +declare @a int = 0; +declare @b int = 500; +declare @c int = 1000; +CREATE PARTITION FUNCTION IntPartitionFunction (int) +AS RANGE RIGHT FOR VALUES (@a, @b, @c); +GO + + +-- explicit schema can also be specified with paramater type +CREATE PARTITION FUNCTION BigIntPartitionFunction (sys.bigint) +AS RANGE RIGHT FOR VALUES (0, 10000, 100, 1000); +GO + +CREATE PARTITION FUNCTION SmallIntPartitionFunction (smallint) +AS RANGE RIGHT FOR VALUES (cast(32767 as bigint), -32768, 0); +GO + +-- explicit schema can also be specified with paramater type +CREATE PARTITION FUNCTION TinyIntPartitionFunction (sys.tinyint) +AS RANGE RIGHT FOR VALUES (0, cast(255 as varchar), 128); +GO + +CREATE PARTITION FUNCTION DecimalPartitionFunction (decimal(10, 5)) +AS RANGE RIGHT FOR VALUES (0.0, 300.0, 200.0, 100.0); +GO + +CREATE PARTITION FUNCTION NumericPartitionFunction (numeric(5, 2)) +AS RANGE RIGHT FOR VALUES (0.0, 30.0, 10.0, 20.0); +GO + +CREATE PARTITION FUNCTION MoneyPartitionFunction (MONEY) +AS RANGE RIGHT FOR VALUES ($2.56789, ¥4.91, $3.56789); +GO + +CREATE PARTITION FUNCTION SmallMoneyPartitionFunction (SMALLMONEY) +AS RANGE RIGHT FOR VALUES ($2.56789, ¥4.91, $3.56789); +GO + +CREATE PARTITION FUNCTION DatePartitionFunction (date) +AS RANGE RIGHT FOR VALUES ('2022-07-01', '2022-01-01','2023-01-01'); +GO + +-- should implicity cast it to input type +CREATE PARTITION FUNCTION DateTimePartitionFunction (datetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01 00:00:00', '2019-01-01 00:00:00'); +GO + +CREATE PARTITION FUNCTION DateTime2PartitionFunction (datetime2(3)) +AS RANGE RIGHT FOR VALUES ('2022-01-01 00:00:00.000', '2022-07-01 00:00:00.000', '2019-01-01 00:00:00.000'); +GO + +CREATE PARTITION FUNCTION SmallDateTimePartitionFunction (smalldatetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01', '2019-01-01'); +GO + +CREATE PARTITION FUNCTION CharPartitionFunction (char(5)) +AS RANGE RIGHT FOR VALUES ('A', 'F', 'K', 'P', 'U', 'Z', 'D'); +GO + +CREATE PARTITION FUNCTION VarCharPartitionFunction (varchar(10)) +AS RANGE RIGHT FOR VALUES ('Apple', 'Banana', 'Mango', 'Cherry', 'Date'); +GO + +CREATE PARTITION FUNCTION NVarCharPartitionFunction (nvarchar(10)) +AS RANGE RIGHT FOR VALUES (N'Apple', N'Banana', N'Mango', N'Cherry', N'Date'); +GO + +CREATE PARTITION FUNCTION NCharPartitionFunction (nchar(5)) +AS RANGE RIGHT FOR VALUES (N'A', N'F', N'K', N'P', N'U', N'Z', N'B'); +GO + +CREATE PARTITION FUNCTION BinaryPartitionFunction (binary(4)) +AS RANGE RIGHT FOR VALUES (0x000, 0x800, 0x400, 0xC000); +GO + +CREATE PARTITION FUNCTION VarBinaryPartitionFunction (varbinary(8)) +AS RANGE RIGHT FOR VALUES (0x0000000000000000, 0x8000000000000000, 0x4000000000000000, 0xC000000000000000); +GO + +CREATE PARTITION FUNCTION UniqueIdentifierPartitionFunction (uniqueidentifier) +AS RANGE RIGHT FOR VALUES ('00000000-0000-0000-0000-000000000000', 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF', '6F9619FF-8B86-D011-B42D-00C04FC964FF'); +GO + + +-- identifier length greater than 64 +CREATE PARTITION FUNCTION PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz (bigint) +AS RANGE RIGHT FOR VALUES (0, 10000, 100, 1000); +GO + +CREATE PARTITION FUNCTION PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder (bigint) +AS RANGE RIGHT FOR VALUES (0, 10000, 100, 1000); +GO + +CREATE PARTITION FUNCTION PartitionFunctionHavingDifferentCollationInput (NVARCHAR(50)) +AS RANGE RIGHT +FOR VALUES ( + N'John Doe', + N'Jane Smith' COLLATE Latin1_General_CI_AS, + N'châu phố' COLLATE Vietnamese_CI_AS, + N'Müller GmbH' COLLATE Traditional_Spanish_CI_AS +); +GO + +-------------------------------------------------- +--- Partition Scheme +-------------------------------------------------- + +-- without all option +-- filegroups are equal to partition that will generated by function +CREATE PARTITION SCHEME IntPartitionScheme AS +PARTITION IntPartitionFunction +TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]); +GO + +-- filgroups are more than partition that will generated by function +CREATE PARTITION SCHEME BigIntPartitionScheme AS +PARTITION BigIntPartitionFunction +TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]); +GO + +-- with all option +CREATE PARTITION SCHEME SmallIntPartitionScheme AS +PARTITION SmallIntPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME TinyIntPartitionScheme AS +PARTITION TinyIntPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME DecimalPartitionScheme AS +PARTITION DecimalPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME NumericPartitionScheme AS +PARTITION NumericPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME MoneyPartitionScheme AS +PARTITION MoneyPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME SmallMoneyPartitionScheme AS +PARTITION SmallMoneyPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME DatePartitionScheme AS +PARTITION DatePartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME DateTimePartitionScheme AS +PARTITION DateTimePartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME DateTime2PartitionScheme AS +PARTITION DateTime2PartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME SmallDateTimePartitionScheme AS +PARTITION SmallDateTimePartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME CharPartitionScheme AS +PARTITION CharPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME VarCharPartitionScheme AS +PARTITION VarCharPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME NVarCharPartitionScheme AS +PARTITION NVarCharPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME NCharPartitionScheme AS +PARTITION NCharPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME BinaryPartitionScheme AS +PARTITION BinaryPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME VarBinaryPartitionScheme AS +PARTITION VarBinaryPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME UniqueIdentifierPartitionScheme AS +PARTITION UniqueIdentifierPartitionFunction +ALL TO ([PRIMARY]); +GO + +-- identifier length greater than 64 +CREATE PARTITION SCHEME PartitionSchemeNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz AS +PARTITION PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME PartitionSchemeNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder AS +PARTITION PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +ALL TO ([PRIMARY]); +GO + +CREATE SCHEMA PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz +GO + +CREATE TABLE PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz ( + PartitionColumnNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz BIGINT, + Value sys.varchar(50) +) ON PartitionSchemeNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz (PartitionColumnNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz); +GO + +CREATE INDEX PartitionIndexNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz +ON PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz(Value) +ON PartitionSchemeNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz +(PartitionColumnNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz); +GO + +CREATE TABLE PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder ( + PartitionColumnNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz BIGINT, + Value sys.varchar(50) +) ON PartitionSchemeNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +(PartitionColumnNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz); +GO + +CREATE INDEX PartitionIndexNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz +ON PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder(Value) +ON PartitionSchemeNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +(PartitionColumnNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz); +GO + +-------------------------------------------------- +--- name identifiers test +-------------------------------------------------- +CREATE PARTITION FUNCTION PARTITION_FUNCTIONログインαιώνια (int) +AS RANGE RIGHT FOR VALUES (0, 500, 1000); +GO + +CREATE PARTITION SCHEME PARTITION_SCHEMEログインαιώνια AS +PARTITION PARTITION_FUNCTIONログインαιώνια +ALL TO ([PRIMARY]); +GO + +CREATE TABLE PARTITION_TABLEログインαιώνια ( + PARTITION_COLUMNログインαιώνια INT, + Value sys.varchar(50) +) ON PARTITION_SCHEMEログインαιώνια(PARTITION_COLUMNログインαιώνια); +GO + +CREATE INDEX PARTITION_INDEXログインαιώνια +ON PARTITION_TABLEログインαιώνια(Value) +ON PARTITION_SCHEMEログインαιώνια(PARTITION_COLUMNログインαιώνια); +GO + +CREATE PARTITION FUNCTION [PARTITION_FUNCTION 유니코드스키마👻 ] (int) +AS RANGE RIGHT FOR VALUES (0, 500, 1000); +GO + +CREATE PARTITION SCHEME [PARTITION_SCHEME 유니코드스키마👻 ] AS +PARTITION [PARTITION_FUNCTION 유니코드스키마👻 ] +ALL TO ([PRIMARY]); +GO + +CREATE TABLE [PARTITION_TABLE 유니코드스키마👻 ]( + [PARTITION_COLUMN 유니코드스키마👻 ] INT, + Value sys.varchar(50) +) ON [PARTITION_SCHEME 유니코드스키마👻 ]([PARTITION_COLUMN 유니코드스키마👻 ]); +GO + +CREATE INDEX [PARTITION_INDEX 유니코드스키마👻 ] +ON [PARTITION_TABLE 유니코드스키마👻 ](Value) +ON [PARTITION_SCHEME 유니코드스키마👻 ]([PARTITION_COLUMN 유니코드스키마👻 ]); +GO + +-- qouted identifer +SET QUOTED_IDENTIFIER ON; +GO + +CREATE PARTITION FUNCTION "PARTITION_FUNCTION 😎$@ #123 🌍rder " (int) +AS RANGE RIGHT FOR VALUES (0, 500, 1000); +GO + +CREATE PARTITION SCHEME "PARTITION_SCHEME 😎$@ #123 🌍rder " AS +PARTITION "PARTITION_FUNCTION 😎$@ #123 🌍rder " +ALL TO ([PRIMARY]); +GO + + +CREATE TABLE "PARTITION_TABLE 😎$@ #123 🌍rder " ( + "PARTITION_COLUMN 😎$@ #123 🌍rder " INT, + Value sys.varchar(50) +) ON "PARTITION_SCHEME 😎$@ #123 🌍rder " ("PARTITION_COLUMN 😎$@ #123 🌍rder "); +GO + +CREATE INDEX "PARTITION_INDEX 😎$@ #123 🌍rder " +ON "PARTITION_TABLE 😎$@ #123 🌍rder " (Value) +ON "PARTITION_SCHEME 😎$@ #123 🌍rder "("PARTITION_COLUMN 😎$@ #123 🌍rder "); +GO + +SET QUOTED_IDENTIFIER OFF; +Go + + +-------------------------------------------------- +--- TO test Permission +-------------------------------------------------- +CREATE DATABASE PartitionDb; +GO + +USE PartitionDb; +GO + +CREATE PARTITION FUNCTION PartitionDb_PartitionFunction (int) +AS RANGE RIGHT FOR VALUES (500, 1000, 10000); +Go + +CREATE PARTITION SCHEME PartitionDb_PartitionScheme AS +PARTITION PartitionDb_PartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE TABLE PartitionDb_PartitionTable ( + Id INT, + Value sys.varchar(50) +) ON PartitionDb_PartitionScheme(Id); +GO + +CREATE INDEX PartitionDb_PartitionIndex +ON PartitionDb_PartitionTable(Id) +ON PartitionDb_PartitionScheme (Id); +GO + +USE MASTER +go + +--------------------------------------------------------------- +--- CREATE/DROP Partition Function/Scheme/Table inside Procedure +--------------------------------------------------------------- +CREATE PROCEDURE PartitionProcedureCreatePartitionFunction AS +BEGIN +CREATE PARTITION FUNCTION PartitionFunctionInsideProc1 (int) +AS RANGE RIGHT FOR VALUES (500, 1000, 10000) +END; +Go + +CREATE PROCEDURE PartitionProcedureCreatePartitionScheme AS +BEGIN +CREATE PARTITION SCHEME PartitionSchemeInsideProc1 AS +PARTITION PartitionFunctionInsideProc1 +ALL TO ([PRIMARY]) +END; +GO + +CREATE PROCEDURE PartitionProcedureCreatePartitionTable AS +BEGIN +CREATE TABLE PartitionTableInsideProc1( + Id INT, + Value sys.varchar(50) +) ON PartitionSchemeInsideProc1(Id); +END; +GO + +CREATE PROCEDURE PartitionProcedureCreatePartitionFunctionSchemeAndTable AS +BEGIN +CREATE PARTITION FUNCTION PartitionFunctionInsideProc2 (int) +AS RANGE RIGHT FOR VALUES (500, 1000, 10000); +CREATE PARTITION SCHEME PartitionSchemeInsideProc2 AS +PARTITION PartitionFunctionInsideProc2 +ALL TO ([PRIMARY]); +CREATE TABLE PartitionTableInsideProc2( + Id INT, + Value sys.varchar(50) +) ON PartitionSchemeInsideProc2(Id); +END; +Go + +CREATE PROCEDURE PartitionProcedureDropPartitionFunction AS +BEGIN +DROP PARTITION FUNCTION PartitionFunctionInsideProc1 +END; +Go + +CREATE PROCEDURE PartitionProcedureDropPartitionScheme AS +BEGIN +DROP PARTITION SCHEME PartitionSchemeInsideProc1 +END; +GO + +CREATE PROCEDURE PartitionProcedureDropPartitionTable AS +BEGIN +DROP TABLE PartitionTableInsideProc1 +END; +GO + +CREATE PROCEDURE PartitionProcedureDropPartitionFunctionSchemeAndTable AS +BEGIN +DROP TABLE PartitionTableInsideProc2; +DROP PARTITION SCHEME PartitionSchemeInsideProc2; +DROP PARTITION FUNCTION PartitionFunctionInsideProc2; +END; +Go + +USE master; +go +--------------------------------------------------------------------------- +--- CREATE PARTITIONED TABLES with PARTITION SCHEME for different datatypes +--------------------------------------------------------------------------- +-- int data type +CREATE TABLE partition_vu_prepare_int_table ( + Value sys.varchar(50), + Id INT UNIQUE +) ON IntPartitionScheme(Id); +GO + +-- add constraint +ALTER TABLE partition_vu_prepare_int_table ADD CONSTRAINT check_value_not_null CHECK(value IS NOT NULL); +GO + +-- bigint data type +CREATE TABLE partition_vu_prepare_bigint_table ( + Id BIGINT, + Value sys.varchar(50) +) ON BigIntPartitionScheme--this is comment should get ignored +(Id); +GO + +-- smallint data type +CREATE TABLE partition_vu_prepare_smallint_table ( + Id SMALLINT, + Value sys.varchar(50) +) ON SmallIntPartitionScheme(Id); +GO + +-- tinyint data type +CREATE TABLE partition_vu_prepare_tinyint_table ( + Id TINYINT, + Value sys.varchar(50) +) ON TinyIntPartitionScheme(Id); +GO + +-- decimal data type +CREATE TABLE partition_vu_prepare_decimal_table ( + Id DECIMAL(10, 5), + Value sys.varchar(50) +) ON DecimalPartitionScheme(Id); +GO + +-- numeric data type +CREATE TABLE partition_vu_prepare_numeric_table ( + Id NUMERIC(5, 2), + Value sys.varchar(50) +) ON NumericPartitionScheme(Id); +GO + +-- money data type +CREATE TABLE partition_vu_prepare_money_table ( + Id MONEY, + Value sys.varchar(50) +) ON MoneyPartitionScheme(Id); +GO + +-- smallmoney data type +CREATE TABLE partition_vu_prepare_smallmoney_table ( + Id SMALLMONEY, + Value sys.varchar(50) +) ON SmallMoneyPartitionScheme(Id); +GO + +-- date data type +CREATE TABLE partition_vu_prepare_date_table ( + Id DATE, + Value sys.varchar(50) +) ON DatePartitionScheme(Id); +GO + +-- datetime data type +CREATE TABLE partition_vu_prepare_datetime_table ( + Id DATETIME, + Value sys.varchar(50) +) ON DateTimePartitionScheme(Id); +GO + +-- datetime2 data type +CREATE TABLE partition_vu_prepare_datetime2_table ( + Id DATETIME2(3), + Value sys.varchar(50) +) ON DateTime2PartitionScheme(Id); +GO + +-- smalldatetime data type +CREATE TABLE partition_vu_prepare_smalldatetime_table ( + Id SMALLDATETIME, + Value sys.varchar(50) +) ON SmallDateTimePartitionScheme(Id); +GO + +-- char data type +CREATE TABLE partition_vu_prepare_char_table ( + Id CHAR(5), + Value sys.varchar(50) +) ON CharPartitionScheme(Id); +GO + +-- varchar data type +CREATE TABLE partition_vu_prepare_varchar_table ( + Id VARCHAR(10), + Value sys.varchar(50) +) ON VarCharPartitionScheme(Id); +GO + +-- nvarchar data type +CREATE TABLE partition_vu_prepare_nvarchar_table ( + Id NVARCHAR(10), + Value sys.varchar(50) +) ON NVarCharPartitionScheme(Id); +GO + +-- nchar data type +CREATE TABLE partition_vu_prepare_nchar_table ( + Id NCHAR(5), + Value sys.varchar(50) +) ON NCharPartitionScheme(Id); +GO + +-- binary data type +CREATE TABLE partition_vu_prepare_binary_table ( + Id BINARY(4), + Value sys.varchar(50) +) ON BinaryPartitionScheme(Id); +GO + +-- varbinary data type +CREATE TABLE partition_vu_prepare_varbinary_table ( + Id VARBINARY(8), + Value sys.varchar(50) +) ON VarBinaryPartitionScheme(Id); +GO + +-- uniqueidentifier data type +CREATE TABLE partition_vu_prepare_uniqueidentifier_table ( + Id UNIQUEIDENTIFIER, + Value sys.varchar(50) +) ON UniqueIdentifierPartitionScheme(Id); +GO + + +-- identifier length greater than 64 +CREATE TABLE PartitionTableNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz ( + Id INT, + Value sys.varchar(50) +) ON IntPartitionScheme(Id); +GO + +CREATE VIEW GetPartitionedTableListFromSysTablesView +AS +( + SELECT + name + FROM + sys.tables + WHERE + name like '%partition_vu_prepare%' + ORDER BY + name +) +GO + +--------------------------------------------------------------------------- +--- CREATE ALIGNED PARTITIONED INDEX with PARTITION SCHEME +--------------------------------------------------------------------------- +-- using schema name +CREATE INDEX partition_vu_prepare_int_index +ON dbo.partition_vu_prepare_int_table(Value) +ON IntPartitionScheme (Id); +GO + +-- without explicit schema name +CREATE INDEX partition_vu_prepare_bigint_index +ON partition_vu_prepare_bigint_table(Id) +ON BigIntPartitionScheme (Id); +GO + +-- without partition scheme should also work +CREATE INDEX partition_vu_prepare_smallint_index +ON partition_vu_prepare_smallint_table--this is comment should get ignored +(Id) +GO + +CREATE INDEX partition_vu_prepare_tinyint_index +ON partition_vu_prepare_tinyint_table(Id) +ON TinyIntPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_decimal_index +ON partition_vu_prepare_decimal_table(Id) +ON DecimalPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_numeric_index +ON partition_vu_prepare_numeric_table(Id) +ON NumericPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_money_index +ON partition_vu_prepare_money_table(Id) +ON MoneyPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_smallmoney_index +ON partition_vu_prepare_smallmoney_table(Id) +ON SmallMoneyPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_date_index +ON partition_vu_prepare_date_table(Id) +ON DatePartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_datetime_index +ON partition_vu_prepare_datetime_table(Id) +ON DateTimePartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_datetime2_index +ON partition_vu_prepare_datetime2_table(Id) +ON DateTime2PartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_smalldatetime_index +ON partition_vu_prepare_smalldatetime_table(Id) +ON SmallDateTimePartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_char_index +ON partition_vu_prepare_char_table(Id) +ON CharPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_varchar_index +ON partition_vu_prepare_varchar_table(Id) +ON VarCharPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_nvarchar_index +ON partition_vu_prepare_nvarchar_table(Id) +ON NVarCharPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_nchar_index +ON partition_vu_prepare_nchar_table(Id) +ON NCharPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_binary_index +ON partition_vu_prepare_binary_table(Id) +ON BinaryPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_varbinary_index +ON partition_vu_prepare_varbinary_table(Id) +ON VarBinaryPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_uniqueidentifier_index +ON partition_vu_prepare_uniqueidentifier_table(Id) +ON UniqueIdentifierPartitionScheme (Id); +GO + +CREATE VIEW GetPartitionedIndexListFromSysIndexesView +AS +( + SELECT + name + FROM + sys.indexes + WHERE + name like '%partition_vu_prepare%' + ORDER BY + name +) +GO + +--------------------------------------------------------------------------- +--- Insert data into partitioned tables +--------------------------------------------------------------------------- +-- Insert values into partition_vu_prepare_int_table +INSERT INTO partition_vu_prepare_int_table (Id, Value) VALUES (1, 'Value 1'); +INSERT INTO partition_vu_prepare_int_table (Id, Value) VALUES (100, 'Value 100'); +INSERT INTO partition_vu_prepare_int_table (Id, Value) VALUES (10000, 'Value 10000'); +INSERT INTO partition_vu_prepare_int_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO + +-- Insert values into partition_vu_prepare_bigint_table +INSERT INTO partition_vu_prepare_bigint_table (Id, Value) VALUES (1, 'Value 1'); +INSERT INTO partition_vu_prepare_bigint_table (Id, Value) VALUES (100, 'Value 100'); +INSERT INTO partition_vu_prepare_bigint_table (Id, Value) VALUES (10000, 'Value 10000'); +INSERT INTO partition_vu_prepare_bigint_table (Id, Value) VALUES (1000000000, 'Value 1000000000'); +INSERT INTO partition_vu_prepare_bigint_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO + +-- Insert values into partition_vu_prepare_smallint_table +INSERT INTO partition_vu_prepare_smallint_table (Id, Value) VALUES (1, 'Value 1'); +INSERT INTO partition_vu_prepare_smallint_table (Id, Value) VALUES (-32768, 'Value -32768'); +INSERT INTO partition_vu_prepare_smallint_table (Id, Value) VALUES (32767, 'Value 32767'); +INSERT INTO partition_vu_prepare_smallint_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO + +-- Insert values into partition_vu_prepare_tinyint_table +INSERT INTO partition_vu_prepare_tinyint_table (Id, Value) VALUES (1, 'Value 1'); +INSERT INTO partition_vu_prepare_tinyint_table (Id, Value) VALUES (128, 'Value 128'); +INSERT INTO partition_vu_prepare_tinyint_table (Id, Value) VALUES (255, 'Value 255'); +INSERT INTO partition_vu_prepare_tinyint_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO + +-- Insert values into partition_vu_prepare_decimal_table +INSERT INTO partition_vu_prepare_decimal_table (Id, Value) VALUES (1.0, 'Value 1.0'); +INSERT INTO partition_vu_prepare_decimal_table (Id, Value) VALUES (100.0, 'Value 100.0'); +INSERT INTO partition_vu_prepare_decimal_table (Id, Value) VALUES (200.0, 'Value 200.0'); +INSERT INTO partition_vu_prepare_decimal_table (Id, Value) VALUES (300.0, 'Value 300.0'); +INSERT INTO partition_vu_prepare_decimal_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO + +-- Insert values into partition_vu_prepare_numeric_table +INSERT INTO partition_vu_prepare_numeric_table (Id, Value) VALUES (1.0, 'Value 1.0'); +INSERT INTO partition_vu_prepare_numeric_table (Id, Value) VALUES (10.0, 'Value 10.0'); +INSERT INTO partition_vu_prepare_numeric_table (Id, Value) VALUES (20.0, 'Value 20.0'); +INSERT INTO partition_vu_prepare_numeric_table (Id, Value) VALUES (30.0, 'Value 30.0'); +INSERT INTO partition_vu_prepare_numeric_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO + +-- Insert values into partition_vu_prepare_money_table +INSERT INTO partition_vu_prepare_money_table (Id, Value) VALUES (1.0, 'Value 1.0'); +INSERT INTO partition_vu_prepare_money_table (Id, Value) VALUES (2.56789, 'Value 2.56789'); +INSERT INTO partition_vu_prepare_money_table (Id, Value) VALUES (4.91, 'Value 4.91'); +INSERT INTO partition_vu_prepare_money_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO + +-- Insert values into partition_vu_prepare_smallmoney_table +INSERT INTO partition_vu_prepare_smallmoney_table (Id, Value) VALUES (1.0, 'Value 1.0'); +INSERT INTO partition_vu_prepare_smallmoney_table (Id, Value) VALUES (2.56789, 'Value 2.56789'); +INSERT INTO partition_vu_prepare_smallmoney_table (Id, Value) VALUES (4.91, 'Value 4.91'); +INSERT INTO partition_vu_prepare_smallmoney_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO + +-- Insert values into partition_vu_prepare_date_table +INSERT INTO partition_vu_prepare_date_table (Id, Value) VALUES ('2022-01-01', 'Value 2022-01-01'); +INSERT INTO partition_vu_prepare_date_table (Id, Value) VALUES ('2022-07-01', 'Value 2022-07-01'); +INSERT INTO partition_vu_prepare_date_table (Id, Value) VALUES ('2023-01-01', 'Value 2023-01-01'); +INSERT INTO partition_vu_prepare_date_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO + +-- Insert values into partition_vu_prepare_datetime_table +INSERT INTO partition_vu_prepare_datetime_table (Id, Value) VALUES ('2019-01-01', 'Value 2019-01-01'); +INSERT INTO partition_vu_prepare_datetime_table (Id, Value) VALUES ('2022-01-01', 'Value 2022-01-01'); +INSERT INTO partition_vu_prepare_datetime_table (Id, Value) VALUES ('2022-07-01', 'Value 2022-07-01'); +INSERT INTO partition_vu_prepare_datetime_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO + +-- Insert values into partition_vu_prepare_datetime2_table +INSERT INTO partition_vu_prepare_datetime2_table (Id, Value) VALUES ('2019-01-01 00:00:00.000', 'Value 2019-01-01 00:00:00.000'); +INSERT INTO partition_vu_prepare_datetime2_table (Id, Value) VALUES ('2022-01-01 00:00:00.000', 'Value 2022-01-01 00:00:00.000'); +INSERT INTO partition_vu_prepare_datetime2_table (Id, Value) VALUES ('2022-07-01 00:00:00.000', 'Value 2022-07-01 00:00:00.000'); +INSERT INTO partition_vu_prepare_datetime2_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO + +-- Insert values into partition_vu_prepare_smalldatetime_table +INSERT INTO partition_vu_prepare_smalldatetime_table (Id, Value) VALUES ('2019-01-01', 'Value 2019-01-01'); +INSERT INTO partition_vu_prepare_smalldatetime_table (Id, Value) VALUES ('2022-01-01', 'Value 2022-01-01'); +INSERT INTO partition_vu_prepare_smalldatetime_table (Id, Value) VALUES ('2022-07-01', 'Value 2022-07-01'); +INSERT INTO partition_vu_prepare_smalldatetime_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO + +-- Insert values into partition_vu_prepare_char_table +INSERT INTO partition_vu_prepare_char_table (Id, Value) VALUES ('A', 'Value A'); +INSERT INTO partition_vu_prepare_char_table (Id, Value) VALUES ('K', 'Value K'); +INSERT INTO partition_vu_prepare_char_table (Id, Value) VALUES ('U', 'Value U'); +INSERT INTO partition_vu_prepare_char_table (Id, Value) VALUES ('D', 'Value D'); +INSERT INTO partition_vu_prepare_char_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO + +-- Insert values into partition_vu_prepare_varchar_table +INSERT INTO partition_vu_prepare_varchar_table (Id, Value) VALUES ('Apple', 'Value Apple'); +INSERT INTO partition_vu_prepare_varchar_table (Id, Value) VALUES ('Banana', 'Value Banana'); +INSERT INTO partition_vu_prepare_varchar_table (Id, Value) VALUES ('Mango', 'Value Mango'); +INSERT INTO partition_vu_prepare_varchar_table (Id, Value) VALUES ('Cherry', 'Value Cherry'); +INSERT INTO partition_vu_prepare_varchar_table (Id, Value) VALUES ('Date', 'Value Date'); +INSERT INTO partition_vu_prepare_varchar_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO + +-- Insert values into partition_vu_prepare_nvarchar_table +INSERT INTO partition_vu_prepare_nvarchar_table (Id, Value) VALUES (N'Apple', N'Value Apple'); +INSERT INTO partition_vu_prepare_nvarchar_table (Id, Value) VALUES (N'Banana', N'Value Banana'); +INSERT INTO partition_vu_prepare_nvarchar_table (Id, Value) VALUES (N'Mango', N'Value Mango'); +INSERT INTO partition_vu_prepare_nvarchar_table (Id, Value) VALUES (N'Cherry', N'Value Cherry'); +INSERT INTO partition_vu_prepare_nvarchar_table (Id, Value) VALUES (N'Date', N'Value Date'); +INSERT INTO partition_vu_prepare_nvarchar_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO + +-- Insert values into partition_vu_prepare_nchar_table +INSERT INTO partition_vu_prepare_nchar_table (Id, Value) VALUES (N'A', N'Value A'); +INSERT INTO partition_vu_prepare_nchar_table (Id, Value) VALUES (N'K', N'Value K'); +INSERT INTO partition_vu_prepare_nchar_table (Id, Value) VALUES (N'U', N'Value U'); +INSERT INTO partition_vu_prepare_nchar_table (Id, Value) VALUES (N'B', N'Value B'); +INSERT INTO partition_vu_prepare_nchar_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO + +-- BABEL-4957 needs to fixed first otherwise dump/restore will fail +INSERT INTO partition_vu_prepare_binary_table (Id, Value) VALUES (0x0000, 'Value 0x0000'); +INSERT INTO partition_vu_prepare_binary_table (Id, Value) VALUES (0x0400, 'Value 0x0400'); +INSERT INTO partition_vu_prepare_binary_table (Id, Value) VALUES (0x0800, 'Value 0x0800'); +INSERT INTO partition_vu_prepare_binary_table (Id, Value) VALUES (0x0C000, 'Value 0x0C000'); +INSERT INTO partition_vu_prepare_binary_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO + +-- Insert values into partition_vu_prepare_varbinary_table +INSERT INTO partition_vu_prepare_varbinary_table (Id, Value) VALUES (0x0000000000000000, 'Value 0x0000000000000000'); +INSERT INTO partition_vu_prepare_varbinary_table (Id, Value) VALUES (0x4000000000000000, 'Value 0x4000000000000000'); +INSERT INTO partition_vu_prepare_varbinary_table (Id, Value) VALUES (0x8000000000000000, 'Value 0x8000000000000000'); +INSERT INTO partition_vu_prepare_varbinary_table (Id, Value) VALUES (0xC000000000000000, 'Value 0xC000000000000000'); +INSERT INTO partition_vu_prepare_varbinary_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO + +-- Insert values into partition_vu_prepare_uniqueidentifier_table +INSERT INTO partition_vu_prepare_uniqueidentifier_table (Id, Value) VALUES ('00000000-0000-0000-0000-000000000000', 'Value 00000000-0000-0000-0000-000000000000'); +INSERT INTO partition_vu_prepare_uniqueidentifier_table (Id, Value) VALUES ('6F9619FF-8B86-D011-B42D-00C04FC964FF', 'Value 6F9619FF-8B86-D011-B42D-00C04FC964FF'); +INSERT INTO partition_vu_prepare_uniqueidentifier_table (Id, Value) VALUES ('FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF', 'Value FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF'); +INSERT INTO partition_vu_prepare_uniqueidentifier_table (Id, Value) VALUES (NULL, 'Value NULL'); +GO + +--------------------------------------------------- +--- Check for inconsistent metadata before upgrade +---------------------------------------------------- +SELECT COUNT(*) FROM sys.babelfish_inconsistent_metadata(); +GO + +--------------------------------------------------------------- +---- Views/Functions/Procedure to test DOLLAR PARTITION FUNCTION +---------------------------------------------------------------- + +CREATE VIEW DollarPartitionFunctionView +AS + SELECT $PARTITION.IntPartitionFunction(Id) AS PartitionNumber, Id + FROM partition_vu_prepare_int_table + ORDER BY PartitionNumber, Id; +GO + +CREATE PROCEDURE DollarPartitionFunctionProc +AS + SELECT $PARTITION.IntPartitionFunction(Id) AS PartitionNumber, Id + FROM partition_vu_prepare_int_table + ORDER BY PartitionNumber, Id; +GO + +CREATE FUNCTION DollarPartitionFunctionFunc() +RETURNS TABLE +AS + RETURN ( + SELECT $PARTITION.IntPartitionFunction(Id) AS PartitionNumber, Id + FROM partition_vu_prepare_int_table + ORDER BY PartitionNumber, Id + ) +GO + +CREATE VIEW DollarPartitionFunctionNullView +AS + SELECT $PARTITION.IntPartitionFunction(NULL) +GO + +CREATE PROCEDURE DollarPartitionFunctionNullProc +AS + SELECT $PARTITION.IntPartitionFunction(NULL) +GO + +CREATE FUNCTION DollarPartitionFunctionNullFunc() +RETURNS TABLE +AS + RETURN ( + SELECT $PARTITION.IntPartitionFunction(NULL) + ) +GO + +CREATE VIEW SysSearchPartitionDepView +AS + SELECT sys.search_partition('IntPartitionFunction', 10) +GO + +CREATE VIEW SysSearchPartitionNULLDepView +AS + SELECT sys.search_partition('IntPartitionFunction', 10, NULL) +GO \ No newline at end of file diff --git a/test/JDBC/input/PARTITION-vu-verify.mix b/test/JDBC/input/PARTITION-vu-verify.mix new file mode 100644 index 00000000000..093e8d89e32 --- /dev/null +++ b/test/JDBC/input/PARTITION-vu-verify.mix @@ -0,0 +1,1682 @@ +-- parallel_query_expected +--------------------------------------------------- +--- Check for inconsistent metadata after upgrade +---------------------------------------------------- +SELECT COUNT(*) FROM sys.babelfish_inconsistent_metadata(); +GO + +-------------------------------------------------- +--- CREATE PARTITION FUNCTION/SCHEME/TABLE using procedure +-------------------------------------------------- +EXEC PartitionProcedureCreatePartitionFunction +GO + +EXEC PartitionProcedureCreatePartitionScheme +GO + +EXEC PartitionProcedureCreatePartitionTable +GO + +EXEC PartitionProcedureCreatePartitionFunctionSchemeAndTable +GO + +-------------------------------------------------- +--- CREATE PARTITION FUNCTION/SCHEME/TABLE inside Function +-------------------------------------------------- +CREATE FUNCTION TestFunctionCreatePartitionFunction() +RETURNS INT +AS +BEGIN + CREATE PARTITION FUNCTION TestPartitionFunction (int) + AS RANGE RIGHT FOR VALUES (500, 1000, 10000); + RETURN 1; +END; +GO + +CREATE FUNCTION TestFunctionDropPartitionFunction() +RETURNS INT +AS +BEGIN + DROP PARTITION FUNCTION IntPartitionFunction; + RETURN 1; +END; +GO + +CREATE FUNCTION TestFunctionCreatePartitionScheme() +RETURNS INT +AS +BEGIN + CREATE PARTITION SCHEME TestPartitionScheme AS + PARTITION IntPartitionFunction + ALL TO ([PRIMARY]); + RETURN 1; +END; +GO + +CREATE FUNCTION TestFunctionDropPartitionScheme() +RETURNS INT +AS +BEGIN + DROP PARTITION SCHEME IntPartitionScheme; + RETURN 1; +END; +GO + +CREATE FUNCTION TestFunctionCreatePartitionTable() +RETURNS INT +AS +BEGIN + CREATE TABLE TestPartitionTable ( + Id INT, + Value sys.varchar(20) + ) ON IntPartitionScheme(Id); +END; +GO + +CREATE FUNCTION TestFunctionDropPartitionTable() +RETURNS INT +AS +BEGIN + DROP TABLE partition_vu_prepare_int_table; + RETURN 1; +END; +GO + +--------------------------------------------------------- +--- CREATE PARTITION FUNCTION/SCHEME using 2-part name +--------------------------------------------------------- + +CREATE PARTITION FUNCTION [TestDb].[TwoPartParitionFunction](DATE) +AS RANGE RIGHT FOR VALUES ('20230101', '20230201', '20230301', '20230401'); +GO + +CREATE PARTITION SCHEME [TestDb].[TwoPartParitionScheme] +AS PARTITION [TestDb].[TwoPartPF] +TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]); +GO + +-------------------------------------------------- +--- Unsupported Datatypes for Partition Function +-------------------------------------------------- +CREATE PARTITION FUNCTION VarcharMaxPartitionFunction (VARCHAR(MAX)) +AS RANGE RIGHT FOR VALUES ('A', 'B', 'C', 'D'); +GO + +CREATE PARTITION FUNCTION NVarcharMaxPartitionFunction (NVARCHAR(MAX)) +AS RANGE RIGHT FOR VALUES (N'A', N'B', N'C', N'D'); +GO + +CREATE PARTITION FUNCTION VarbinaryMaxPartitionFunction (VARBINARY(MAX)) +AS RANGE RIGHT FOR VALUES (0x000, 0x800, 0x400, 0xC000); +GO + +CREATE PARTITION FUNCTION BinaryMaxPartitionFunction (BINARY(MAX)) +AS RANGE RIGHT FOR VALUES (0x000, 0x800, 0x400, 0xC000); +GO + +CREATE PARTITION FUNCTION TextPartitionFunction (text) +AS RANGE RIGHT FOR VALUES ('a', 'b', 'c'); +GO + +CREATE PARTITION FUNCTION NTextPartitionFunction (ntext) +AS RANGE RIGHT FOR VALUES (N'a', N'b', N'c'); +GO + +CREATE PARTITION FUNCTION ImagePartitionFunction (image) +AS RANGE RIGHT FOR VALUES (0x123456, 0x789ABC, 0xDEF012); +GO + +CREATE PARTITION FUNCTION XmlPartitionFunction (xml) +AS RANGE RIGHT FOR VALUES ('1', '2', '3'); +GO + +CREATE PARTITION FUNCTION GeometryPartitionFunction (GEOMETRY) +AS RANGE RIGHT FOR VALUES (GEOMETRY::STGeomFromText('POINT(1 1)', 0)); +go + +CREATE PARTITION FUNCTION GeometryPartitionFunction (GEOGRAPHY) +AS RANGE RIGHT FOR VALUES (GEOMETRY::STGeomFromText('POINT(1 1)', 0)); +GO + +-- to test rowversion and timestamp +SELECT SET_CONFIG('babelfishpg_tsql.escape_hatch_rowversion', 'ignore', 'false') +go + +CREATE PARTITION FUNCTION RowVersionPartitionFunction (ROWVERSION) +AS RANGE RIGHT FOR VALUES (0x0000000000000000, 0x0000000000000001, 0x0000000000000002); +go + +CREATE PARTITION FUNCTION TimestampPartitionFunction (TIMESTAMP) +AS RANGE RIGHT FOR VALUES (0x0000000000000000, 0x0000000000000001, 0x0000000000000002); +go + +-- reset back the escape hatch +SELECT SET_CONFIG('babelfishpg_tsql.escape_hatch_rowversion', 'strict', 'true') +go + +-- user defined type +CREATE TYPE PartitionUserDefinedType FROM VARCHAR(10); +GO + +CREATE PARTITION FUNCTION UdtPartitionFunction (PartitionUserDefinedType) +AS RANGE RIGHT FOR VALUES ('a', 'b', 'c'); +GO + +DROP type PartitionUserDefinedType +GO + +------------------------------------------------------------------------------ +--- Duplicate range values for all supported datatypes in Partition Function +------------------------------------------------------------------------------ +CREATE PARTITION FUNCTION IntPartitionFunctionContainsDuplicateValue (int) +AS RANGE RIGHT FOR VALUES (0, 100, 1000, 100); +GO + +CREATE PARTITION FUNCTION BigIntPartitionFunctionContainsDuplicateValue (bigint) +AS RANGE RIGHT FOR VALUES (0, 500, 100, 500, 1000); +GO + +CREATE PARTITION FUNCTION SmallIntPartitionFunctionContainsDuplicateValue (smallint) +AS RANGE RIGHT FOR VALUES (32767, 10, -32768, 0, 10); +GO + +CREATE PARTITION FUNCTION TinyIntPartitionFunctionContainsDuplicateValue (tinyint) +AS RANGE RIGHT FOR VALUES (0, 255, 128, 255); +GO + +CREATE PARTITION FUNCTION DecimalPartitionFunctionContainsDuplicateValue (decimal(10, 5)) +AS RANGE RIGHT FOR VALUES (0.0, 300.0, 200.0, 100.0, 300.0); +GO + +CREATE PARTITION FUNCTION NumericPartitionFunctionContainsDuplicateValue (numeric(5, 2)) +AS RANGE RIGHT FOR VALUES (0.0, 30.0, 10.0, 20.0, 30.0); +GO + +CREATE PARTITION FUNCTION DatePartitionFunctionContainsDuplicateValue (date) +AS RANGE RIGHT FOR VALUES ('2022-07-01', '2022-01-01','2023-01-01','2022-01-01'); +GO + +CREATE PARTITION FUNCTION DateTimePartitionFunctionContainsDuplicateValue (datetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01 00:00:00', '2019-01-01 00:00:00', '2022-01-01'); +GO + +CREATE PARTITION FUNCTION DateTime2PartitionFunctionContainsDuplicateValue (datetime2(3)) +AS RANGE RIGHT FOR VALUES ('2022-01-01 00:00:00.000', '2022-07-01 00:00:00.000', '2019-01-01 00:00:00.000', '2022-07-01 00:00:00.000'); +GO + +CREATE PARTITION FUNCTION SmallDateTimePartitionFunctionContainsDuplicateValue (smalldatetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01', '2019-01-01', '2022-07-01'); +GO + +CREATE PARTITION FUNCTION CharPartitionFunctionContainsDuplicateValue (char(5)) +AS RANGE RIGHT FOR VALUES ('A', 'F', 'K', 'P', 'U', 'Z', 'D', 'K'); +GO + +CREATE PARTITION FUNCTION VarCharPartitionFunctionContainsDuplicateValue (varchar(10)) +AS RANGE RIGHT FOR VALUES ('Apple', 'Banana', 'Mango', 'Cherry', 'Date', 'Banana'); +GO + +CREATE PARTITION FUNCTION NVarCharPartitionFunctionContainsDuplicateValue (nvarchar(10)) +AS RANGE RIGHT FOR VALUES (N'Apple', N'Banana', N'Mango', N'Cherry', N'Date', N'Banana'); +GO + +CREATE PARTITION FUNCTION NCharPartitionFunctionContainsDuplicateValue (nchar(5)) +AS RANGE RIGHT FOR VALUES (N'A', N'F', N'K', N'P', N'U', N'Z', N'B', N'K'); +GO + +CREATE PARTITION FUNCTION BinaryPartitionFunctionContainsDuplicateValue (binary(4)) +AS RANGE RIGHT FOR VALUES (0x000, 0x800, 0x400, 0xC000, 0x800); +GO + +CREATE PARTITION FUNCTION VarBinaryPartitionFunctionContainsDuplicateValue (varbinary(8)) +AS RANGE RIGHT FOR VALUES (0x0000000000000000, 0x8000000000000000, 0x4000000000000000, 0xC000000000000000, 0x8000000000000000); +GO + +CREATE PARTITION FUNCTION UniqueIdentifierPartitionFunctionContainsDuplicateValue (uniqueidentifier) +AS RANGE RIGHT FOR VALUES ('00000000-0000-0000-0000-000000000000', '6F9619FF-8B86-D011-B42D-00C04FC964FF', 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF', '6F9619FF-8B86-D011-B42D-00C04FC964FF'); +GO + +-------------------------------------------------- +--- Unsupported Options with Partition Function +-------------------------------------------------- +-- LEFT option is not supported in Babelfish +CREATE PARTITION FUNCTION PartitionFunctionWithLeft (int) +AS RANGE LEFT FOR VALUES (10, 1000, 10000); +GO + +-- sql_variant is not yet supported in Babelfish +CREATE PARTITION FUNCTION SqlVariantPartitionFunction (sql_variant) +AS RANGE RIGHT +FOR VALUES ( + CAST('abc' AS char(5)), + CAST(N'xyz' AS nchar(5)), + CAST('Apple' AS VARCHAR(10)), + CAST(N'Banana' AS NVARCHAR(10)), + CAST('Some text' AS SQL_VARIANT) +); +go + +-- by default it is LEFT and it should throw error +CREATE PARTITION FUNCTION PartitionFunctionWithLeft (int) +AS RANGE FOR VALUES (10, 1000, 10000); +GO + +-- NULL value is not supported in range values +CREATE PARTITION FUNCTION PartitionFunctionWithNULL (int) +AS RANGE RIGHT FOR VALUES (10, 1000, NULL); +GO + +CREATE PARTITION FUNCTION PartitionFunctionWithNULL (int) +AS RANGE RIGHT FOR VALUES (10, 1000, NULL, NULL); +GO + +-------------------------------------------------- +--- Duplicate Create of Partition Function/Scheme +-------------------------------------------------- +CREATE PARTITION FUNCTION IntPartitionFunction (int) +AS RANGE RIGHT FOR VALUES (500, 1000, 10000); +GO + +-- duplicate partition function with invalid args +CREATE PARTITION FUNCTION IntPartitionFunction (int) +AS RANGE RIGHT FOR VALUES ('xyz', CONVERT(DATETIME, '2023-05-01'), 0x789ABC); +GO + +CREATE PARTITION SCHEME IntPartitionScheme AS +PARTITION IntPartitionFunction +ALL TO ([PRIMARY]); +GO + +-- duplicate partition scheme with invalid Partition function +CREATE PARTITION SCHEME IntPartitionScheme AS +PARTITION PartitionFunctionDoesNotExists +ALL TO ([PRIMARY]); +GO + +----------------------------------------------------------------------------------- +--- Drop of of Partition Function/Scheme when it does not exists +----------------------------------------------------------------------------------- +DROP PARTITION FUNCTION PartitionFunctionDoesNotExists +GO + +DROP PARTITION SCHEME PartitionSchemeDoesNotExists +GO + +----------------------------------------------------------------------------------- +--- Create of Partition Scheme when provided partition function doesn't exists +----------------------------------------------------------------------------------- +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION PartitionFunctionDoesNotExists +ALL TO ([PRIMARY]); +GO + +----------------------------------------------------------------------------------- +--- Drop of of Partition Function when there is dependent Partition Scheme +----------------------------------------------------------------------------------- +DROP PARTITION FUNCTION IntPartitionFunction +GO + +----------------------------------------------------------------------------------- +--- Drop of of Partition Scheme when there is dependent Table on it +----------------------------------------------------------------------------------- +DROP PARTITION SCHEME IntPartitionScheme +GO + + +----------------------------------------------- +--- Filegroup behaviour with Partition Scheme +----------------------------------------------- + +-- by default user filegroup will be treated as PRIMARY filegroup +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION IntPartitionFunction +ALL TO (user_filegroup); +GO + +DROP PARTITION SCHEME TestPartitionScheme +GO + +-- User can configure the "escape_hatch_storage_options" to STRICT to disallow user filegroups +SELECT SET_CONFIG('babelfishpg_tsql.escape_hatch_storage_options', 'strict', 'false') +GO + +-- should throw error +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION IntPartitionFunction +ALL TO (user_filegroup); +GO + +-- reset it back +SELECT SET_CONFIG('babelfishpg_tsql.escape_hatch_storage_options', 'ignore', 'false') +GO + +-- when more than one filegroup are specified with ALL option +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION IntPartitionFunction +ALL TO ([PRIMARY], [PRIMARY], [PRIMARY]); +GO + +-- when partition function generates more partition than specified filegroups +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION IntPartitionFunction +TO ([PRIMARY], [PRIMARY], [PRIMARY]); +GO + +--------------------------------- +--- Metadata Related Tests +--------------------------------- + +SELECT * FROM GetPartitionFunctionMetadataView +GO + +SELECT * FROM GetRangeMetadataView +GO + +SELECT * FROM GetRangeMetadataVarBinaryFunctionView +GO + +SELECT * FROM GetParameterMetadataView +GO + +SELECT * FROM GetPartitionSchemesMetadataView +GO + +SELECT * FROM PartitionFunctionContainsDuplicateName() +GO + +SELECT * FROM PartitionFunctionContainsDuplicateIDs() +GO + +SELECT * FROM PartitionSchemeContainsDuplicateName() +GO + +SELECT * FROM PartitionSchemeContainsDuplicateIDs() +GO + +SELECT * FROM GetPartitionSchemeOrFilegroupForTableOrIndex +GO + +SELECT * FROM GetFileGroupMappingOfPartitionScheme +GO + +SELECT * FROM GetPartitionedTablePartitioningColumn +GO + +SELECT * FROM GetPartitionedIndexPartitioningColumn +GO + +SELECT * FROM GetSysPartitionsMetadata +GO + +-------------------------------------------------- +--- Test Partition Function Argument Limit +-------------------------------------------------- +-- create with max allowed limit +DECLARE @partition_count INT = 14998; +DECLARE @partition_interval INT = 1000; +DECLARE @partition_function_definition VARCHAR(MAX) = 'CREATE PARTITION FUNCTION PartitionFunctionWith14999Arg (int) AS RANGE RIGHT FOR VALUES ('; + +-- Build the partition function definition + +DECLARE @i INT = 1; + +WHILE @i <= @partition_count + +BEGIN + SET @partition_function_definition = @partition_function_definition + CAST((@i * @partition_interval) AS VARCHAR(10)) + ', ' + SET @i = @i + 1; + +END +SET @partition_function_definition = @partition_function_definition + CAST((@i * @partition_interval) AS VARCHAR(10)) + ')' + +-- Execute the partition function creation +EXEC (@partition_function_definition) +GO + +SELECT fanout FROM sys.partition_functions WHERE name = 'PartitionFunctionWith14999Arg' +GO + +DROP PARTITION FUNCTION PartitionFunctionWith14999Arg +GO + +-- create when arg > max allowed limit should throw error +DECLARE @partition_count INT = 14999; +DECLARE @partition_interval INT = 1000; +DECLARE @partition_function_definition VARCHAR(MAX) = 'CREATE PARTITION FUNCTION PartitionFunctionWith15000Arg (int) AS RANGE RIGHT FOR VALUES ('; + +-- Build the partition function definition + +DECLARE @i INT = 1; + +WHILE @i <= @partition_count + +BEGIN + SET @partition_function_definition = @partition_function_definition + CAST((@i * @partition_interval) AS VARCHAR(10)) + ', ' + SET @i = @i + 1; + +END +SET @partition_function_definition = @partition_function_definition + CAST((@i * @partition_interval) AS VARCHAR(10)) + ')' + +-- Execute the partition function creation +EXEC (@partition_function_definition) +GO + + +-------------------------------------------------- +--- Test Partition Function/Scheme Name Limit +-------------------------------------------------- +CREATE PARTITION FUNCTION PartitionFunctionNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz (bigint) +AS RANGE RIGHT FOR VALUES (0, 10000, 100, 1000); +GO + +CREATE PARTITION SCHEME PartitionSchemeNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz AS +PARTITION PartitionFunctionDoesNotExists +ALL TO ([PRIMARY]); +GO + + +-------------------------------------------------- +--- TO test Permission +-------------------------------------------------- +USE PartitionDb; +GO + +CREATE LOGIN partition_l1 WITH PASSWORD = '12345678'; +GO + +CREATE USER partition_u1 FOR LOGIN partition_l1; +GO + +-- tsql user=partition_l1 password=12345678 +USE PartitionDb; +GO + +SELECT CURRENT_USER +GO + +-- CREATE/DROP should throw permission error + +------------------------------------------------------------ +--- only db owner and logins which are member of sysadmin +--- are allowed to create/drop partition function and scheme +------------------------------------------------------------ +CREATE PARTITION FUNCTION TestPartitionFunction (int) +AS RANGE RIGHT FOR VALUES (500, 1000, 10000); +Go + +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION PartitionFunctionDoesNotExists +ALL TO ([PRIMARY]); +GO + +DROP PARTITION FUNCTION IntPartitionFunction +go + +DROP PARTITION SCHEME IntPartitionScheme +go + +------------------------------------------ +--- all user can access the metadata +------------------------------------------ +SELECT + name, type, type_desc, fanout, boundary_value_on_right, is_system + FROM + sys.partition_functions +go + +SELECT + ps.name as scheme_name, pf.name as function_name, ps.type, ps.type_desc, ps.is_default, ps.is_system + FROM + sys.partition_schemes ps + INNER JOIN + sys.partition_functions pf on (ps.function_id = pf.function_id) +go + +------------------------------------------------------------ +--- all user can use the metadata of the partition scheme +--- to create table if they permission to create table +------------------------------------------------------------ + +-- grant create permission to user on schema so that it can create table +-- psql +DO $$ +DECLARE + schema_name TEXT; +BEGIN + IF current_setting('babelfishpg_tsql.migration_mode') = 'multi-db' THEN + schema_name := 'partitiondb_dbo'; + ELSE + schema_name := 'dbo'; + END IF; + + EXECUTE 'GRANT CREATE ON SCHEMA ' || quote_ident(schema_name) || ' TO partitiondb_partition_u1'; +END$$; +GO + +-- tsql user=partition_l1 password=12345678 +USE PartitionDb; +GO + +SELECT CURRENT_USER +GO + +CREATE TABLE PartitionDb_TestPartitionTable ( + Id INT, + Value sys.varchar(20) +) ON PartitionDb_PartitionScheme(Id); +GO + +DROP TABLE PartitionDb_TestPartitionTable +GO + +-- revoke create permission from user on schema +-- psql +DO $$ +DECLARE + schema_name TEXT; +BEGIN + IF current_setting('babelfishpg_tsql.migration_mode') = 'multi-db' THEN + schema_name := 'partitiondb_dbo'; + ELSE + schema_name := 'dbo'; + END IF; + + EXECUTE 'REVOKE CREATE ON SCHEMA ' || quote_ident(schema_name) || ' FROM partitiondb_partition_u1'; +END$$; +GO + +----------------------------------------------------------------------------------- +--- DB owner should be able to create/drop partition function and scheme +---------------------------------------------------------------------------------- +-- make the user a DB owner +-- tsql +USE PartitionDb; +GO + +DROP USER partition_u1; +GO + +execute sp_changedbowner 'partition_l1' +GO + +-- tsql user=partition_l1 password=12345678 +USE PartitionDb; +GO + +SELECT CURRENT_USER +GO +-- CREATE/DROP should work now +CREATE PARTITION FUNCTION TestPartitionFunction (int) +AS RANGE RIGHT FOR VALUES (500, 1000, 10000); +Go + +CREATE PARTITION SCHEME TestPartitionScheme AS +PARTITION TestPartitionFunction +ALL TO ([PRIMARY]); +GO + +DROP PARTITION SCHEME TestPartitionScheme +go + +DROP PARTITION FUNCTION TestPartitionFunction +go + +-- tsql +USE master +GO + +------------------------------------------------------------------------------------------------------------ +--- Test error during Implicit Conversion of range values in Partition Function for each datatypes +------------------------------------------------------------------------------------------------------------ +CREATE PARTITION FUNCTION NewIntPartitionFunction (int) +AS RANGE RIGHT FOR VALUES (500, 1000, cast('xyz' as varchar)); + +-- having duplicates also, but first it should try to convert and fail +CREATE PARTITION FUNCTION NewBigIntPartitionFunction (bigint) +AS RANGE RIGHT FOR VALUES (1000, 1000, 1000, cast('xyz' as varchar), 1000, 1000); +GO + +CREATE PARTITION FUNCTION NewSmallIntPartitionFunction (smallint) +AS RANGE RIGHT FOR VALUES ('xyz', 32767, -32768); +GO + +CREATE PARTITION FUNCTION NewTinyIntPartitionFunction (tinyint) +AS RANGE RIGHT FOR VALUES (0, 255, cast('xyz' as varchar)); +GO + +CREATE PARTITION FUNCTION NewDecimalPartitionFunction (decimal(10, 5)) +AS RANGE RIGHT FOR VALUES (0.0, 300.0, 200.0, 'xyz'); +GO + +CREATE PARTITION FUNCTION NewNumericPartitionFunction (numeric(5, 2)) +AS RANGE RIGHT FOR VALUES (0.0, 30.0, 10.0, 'xyz'); +GO + +CREATE PARTITION FUNCTION NewDatePartitionFunction (date) +AS RANGE RIGHT FOR VALUES ('2022-07-01', '2022-01-01','xyz'); +GO + +CREATE PARTITION FUNCTION NewDateTimePartitionFunction (datetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01 00:00:00', 'xyz'); +GO + +CREATE PARTITION FUNCTION NewDateTime2PartitionFunction (datetime2(3)) +AS RANGE RIGHT FOR VALUES ('2022-01-01 00:00:00.000', '2022-07-01 00:00:00.000', 'xyz'); +GO + +CREATE PARTITION FUNCTION NewSmallDateTimePartitionFunction (smalldatetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01', cast(0x123 as binary(4))); +GO + +CREATE PARTITION FUNCTION NewCharPartitionFunction (char(5)) +AS RANGE RIGHT FOR VALUES ('A', 'F', 'K', 'P', 'U', 'Z', cast(0x123 as binary(4))); +GO + +CREATE PARTITION FUNCTION NewNCharPartitionFunction (nchar(5)) +AS RANGE RIGHT FOR VALUES (N'A', N'F', N'K', N'P', N'U', N'Z', cast(0x123 as binary(4))); +GO + +CREATE PARTITION FUNCTION NewBinaryPartitionFunction (binary(4)) +AS RANGE RIGHT FOR VALUES (0x000, 0x800, 0x400, 'xyz'); +GO + +CREATE PARTITION FUNCTION NewVarBinaryPartitionFunction (varbinary(8)) +AS RANGE RIGHT FOR VALUES (0x0000000000000000, 0x8000000000000000, 0x4000000000000000, 'xyz'); +GO + +CREATE PARTITION FUNCTION NewUniqueIdentifierPartitionFunction (uniqueidentifier) +AS RANGE RIGHT FOR VALUES ('00000000-0000-0000-0000-000000000000', 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF', 123); +GO + + +-------------------------------------------------- +--- DROP PARTITION FUNCTION/SCHEME/TABLE using procedure +-------------------------------------------------- +EXEC PartitionProcedureDropPartitionTable +GO + +EXEC PartitionProcedureDropPartitionScheme +GO + +EXEC PartitionProcedureDropPartitionFunction +GO + +EXEC PartitionProcedureDropPartitionFunctionSchemeAndTable +GO + +--------------------------------------------------------------------------- +--- PARTITIONED TABLES test +--------------------------------------------------------------------------- + +SELECT * FROM GetPartitionedTableListFromSysTablesView +GO + +--------------------------------------------------------------------------- +--- PARTITIONED INDEX test +--------------------------------------------------------------------------- +SELECT * FROM GetPartitionedIndexListFromSysIndexesView +GO + + +---------------------------------------------------------------------------------------------- +--- System views should list only metadata of Partitioned table(not of the partitions) +---------------------------------------------------------------------------------------------- +SELECT count(*) from sys.tables where name = 'partition_vu_prepare_int_table' +GO + +SELECT count(*) from sys.all_columns where object_id = OBJECT_ID('partition_vu_prepare_int_table') +GO + +SELECT count(*) from sys.columns where object_id = OBJECT_ID('partition_vu_prepare_int_table') +GO + +SELECT count(*) from sys.indexes where object_id = OBJECT_ID('partition_vu_prepare_int_table') +GO + +SELECT count(*) from sys.index_columns where object_id = OBJECT_ID('partition_vu_prepare_int_table') +GO + +SELECT count(*) from sys.all_objects where name = 'partition_vu_prepare_int_table' +GO + +SELECT count(*) from sys.sp_tables_view where TABLE_NAME = 'partition_vu_prepare_int_table' +GO + +SELECT count(*) from information_schema.columns where TABLE_NAME = 'partition_vu_prepare_int_table' +GO + +SELECT count(*) from information_schema.tables where TABLE_NAME = 'partition_vu_prepare_int_table' +GO + +SELECT count(*) from information_schema.table_constraints where TABLE_NAME = 'partition_vu_prepare_int_table' +GO + +SELECT count(*) from information_schema.CONSTRAINT_COLUMN_USAGE where TABLE_NAME = 'partition_vu_prepare_int_table' +GO + +SELECT count(*) from information_schema.key_column_usage where TABLE_NAME = 'partition_vu_prepare_int_table' +GO + +--------------------------------------------------------- +--- System views should not list metadata of Partitions +--------------------------------------------------------- +SELECT count(*) from sys.tables where name = '363863941f079adaa9aa733200e57c9f_partition_0' +GO + +SELECT count(*) from sys.all_columns where object_id = OBJECT_ID('363863941f079adaa9aa733200e57c9f_partition_0') +GO + +SELECT count(*) from sys.columns where object_id = OBJECT_ID('363863941f079adaa9aa733200e57c9f_partition_0') +GO + +SELECT count(*) from sys.indexes where object_id = OBJECT_ID('363863941f079adaa9aa733200e57c9f_partition_0') +GO + +SELECT count(*) from sys.index_columns where object_id = OBJECT_ID('363863941f079adaa9aa733200e57c9f_partition_0') +GO + +SELECT count(*) from sys.all_objects where name = '363863941f079adaa9aa733200e57c9f_partition_0' +GO + +SELECT count(*) from sys.sp_tables_view where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO + +SELECT count(*) from information_schema.columns where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO + +SELECT count(*) from information_schema.tables where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO + +SELECT count(*) from information_schema.table_constraints where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO + +SELECT count(*) from information_schema.CONSTRAINT_COLUMN_USAGE where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO + +SELECT count(*) from information_schema.key_column_usage where TABLE_NAME = '363863941f079adaa9aa733200e57c9f_partition_0' +GO + + +--------------------------------------------------------------------------- +--- Run analyze on each table and enable query plan +--------------------------------------------------------------------------- + +-- psql +ANALYZE master_dbo.partition_vu_prepare_int_table; +ANALYZE master_dbo.partition_vu_prepare_bigint_table; +ANALYZE master_dbo.partition_vu_prepare_smallint_table; +ANALYZE master_dbo.partition_vu_prepare_tinyint_table; +ANALYZE master_dbo.partition_vu_prepare_decimal_table; +ANALYZE master_dbo.partition_vu_prepare_numeric_table; +ANALYZE master_dbo.partition_vu_prepare_money_table; +ANALYZE master_dbo.partition_vu_prepare_smallmoney_table; +ANALYZE master_dbo.partition_vu_prepare_date_table; +ANALYZE master_dbo.partition_vu_prepare_datetime_table; +ANALYZE master_dbo.partition_vu_prepare_datetime2_table; +ANALYZE master_dbo.partition_vu_prepare_smalldatetime_table; +ANALYZE master_dbo.partition_vu_prepare_char_table; +ANALYZE master_dbo.partition_vu_prepare_varchar_table; +ANALYZE master_dbo.partition_vu_prepare_nvarchar_table; +ANALYZE master_dbo.partition_vu_prepare_nchar_table; +ANALYZE master_dbo.partition_vu_prepare_binary_table; +ANALYZE master_dbo.partition_vu_prepare_varbinary_table; +ANALYZE master_dbo.partition_vu_prepare_uniqueidentifier_table; +GO + +-- tsql +SELECT set_config('babelfishpg_tsql.explain_costs', 'off', false) +GO + +SET BABELFISH_SHOWPLAN_ALL ON +GO + +--------------------------------------------------------------------------- +--- Query plan of select on partitioned tables +--------------------------------------------------------------------------- + +SELECT * FROM partition_vu_prepare_int_table; +GO + +SELECT * FROM partition_vu_prepare_bigint_table; +GO + +SELECT * FROM partition_vu_prepare_smallint_table; +GO + +SELECT * FROM partition_vu_prepare_tinyint_table; +GO + +SELECT * FROM partition_vu_prepare_decimal_table; +GO + +SELECT * FROM partition_vu_prepare_numeric_table; +GO + +SELECT * FROM partition_vu_prepare_money_table; +GO + +SELECT * FROM partition_vu_prepare_smallmoney_table; +GO + +SELECT * FROM partition_vu_prepare_date_table; +GO + +SELECT * FROM partition_vu_prepare_datetime_table; +GO + +SELECT * FROM partition_vu_prepare_datetime2_table; +GO + +SELECT * FROM partition_vu_prepare_smalldatetime_table; +GO + +SELECT * FROM partition_vu_prepare_char_table; +GO + +SELECT * FROM partition_vu_prepare_varchar_table; +GO + +SELECT * FROM partition_vu_prepare_nvarchar_table; +GO + +SELECT * FROM partition_vu_prepare_nchar_table; +GO + +SELECT * FROM partition_vu_prepare_binary_table; +GO + +SELECT * FROM partition_vu_prepare_varbinary_table; +GO + +SELECT * FROM partition_vu_prepare_uniqueidentifier_table; +GO + +----------------------------------------------------------------------------------------- +--- Query plan of select on partitioned tables with predicate and enforced index scan +----------------------------------------------------------------------------------------- +SET BABELFISH_SHOWPLAN_ALL OFF +GO + +SELECT set_config('enable_seqscan', 'off', false); +SELECT set_config('enable_bitmapscan', 'off', false); +GO + +SET BABELFISH_SHOWPLAN_ALL ON +GO + + +SELECT * FROM partition_vu_prepare_int_table WHERE Id >= 0 AND Id < 500; +GO + +SELECT * FROM partition_vu_prepare_bigint_table WHERE Id >= 0 AND Id < 100; +GO + +SELECT * FROM partition_vu_prepare_smallint_table WHERE Id >= -32768 AND Id < 0; +GO + +SELECT * FROM partition_vu_prepare_tinyint_table WHERE Id >= 0 AND Id < 128; +GO + +SELECT * FROM partition_vu_prepare_decimal_table WHERE Id >= 0.0 AND Id < 100.0; +GO + +SELECT * FROM partition_vu_prepare_numeric_table WHERE Id >= 0.0 AND Id < 10.0; +GO + +SELECT * FROM partition_vu_prepare_money_table WHERE Id >= 2.56789 AND Id < 3.56789; +GO + +SELECT * FROM partition_vu_prepare_smallmoney_table WHERE Id >= 2.56789 AND Id < 3.56789; +GO + +SELECT * FROM partition_vu_prepare_date_table WHERE Id >= '2022-01-01' AND Id < '2022-07-01'; +GO + +SELECT * FROM partition_vu_prepare_datetime_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01'; +GO + +SELECT * FROM partition_vu_prepare_datetime2_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01'; +GO + +SELECT * FROM partition_vu_prepare_smalldatetime_table WHERE Id >= '2019-01-01' AND Id < '2022-01-01'; +GO + +SELECT * FROM partition_vu_prepare_char_table WHERE Id >= 'A' AND Id < 'B'; +GO + +SELECT * FROM partition_vu_prepare_varchar_table WHERE Id >= 'Apple' AND Id < 'Banana'; +GO + +SELECT * FROM partition_vu_prepare_nvarchar_table WHERE Id >= N'Apple' AND Id < N'Banana'; +GO + +SELECT * FROM partition_vu_prepare_nchar_table WHERE Id >= N'A' AND Id < N'B'; +GO + +SELECT * FROM partition_vu_prepare_binary_table WHERE Id >= 0x0000 AND Id < 0x0400; +GO + +SELECT * FROM partition_vu_prepare_varbinary_table WHERE Id >= 0x0000000000000000 AND Id < 0x4000000000000000; +GO + +SELECT * FROM partition_vu_prepare_uniqueidentifier_table WHERE Id >= '00000000-0000-0000-0000-000000000000' AND Id < '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +GO + +SET BABELFISH_SHOWPLAN_ALL OFF +GO + +SELECT set_config('enable_seqscan', 'on', false); +SELECT set_config('enable_bitmapscan', 'on', false); +SELECT set_config('babelfishpg_tsql.explain_costs', 'on', false) +GO + + +------------------------------------------ +--- Blocked Operation For Partitioned Tables +------------------------------------------- +-- user should not be allowed to CREATE/ATTACH/DETACH partition +-- to babelfish partitioned table from psql endpoint + +-- psql +SET ROLE master_dbo; +GO + +-- Attempt to create new partition with random values +CREATE TABLE NonExistentTable PARTITION OF master_dbo.partition_vu_prepare_int_table +FOR VALUES FROM (0) TO (500); +GO + +-- Attempt to create new partition with DEFAULT +CREATE TABLE NonExistentTable PARTITION OF master_dbo.partition_vu_prepare_int_table +DEFAULT +GO + +-- Attempt to drop partition of babelfish partitioned table from psql endpoint +DROP TABLE master_dbo."363863941f079adaa9aa733200e57c9f_partition_0"; +GO + + +-- Attempt to detach +-- explicit schema name specified +ALTER TABLE master_dbo.partition_vu_prepare_int_table +DETACH PARTITION master_dbo."363863941f079adaa9aa733200e57c9f_partition_0"; +GO + +-- using search_path +SET search_path = public, master_dbo; +ALTER TABLE master_dbo.partition_vu_prepare_int_table +DETACH PARTITION master_dbo."363863941f079adaa9aa733200e57c9f_partition_0"; +RESET search_path; +GO + +-- Attempt to detach using CONCURRENTLY option +ALTER TABLE master_dbo.partition_vu_prepare_int_table +DETACH PARTITION master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +CONCURRENTLY; +GO + +-- Attempt to detach using FINALIZE option +ALTER TABLE master_dbo.partition_vu_prepare_int_table +DETACH PARTITION master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +FINALIZE; +GO + +-- Attempt to attach with Default value +ALTER TABLE master_dbo.partition_vu_prepare_int_table +ATTACH PARTITION NonExistentTable DEFAULT; +GO + +-- Attempt to attach with random value +ALTER TABLE master_dbo.partition_vu_prepare_int_table +ATTACH PARTITION NonExistentTable FOR VALUES FROM (10) TO (20); +GO + +-- user should not be allowed to modify partition +-- of babelfish partitioned table neither from psql nor tsql endpoint + +-- explicit schema name specified +ALTER TABLE master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +ADD CONSTRAINT xyz CHECK ( id > 10 and id < 20); +GO + +-- using search_path +SET search_path = public, master_dbo; +ALTER TABLE "363863941f079adaa9aa733200e57c9f_partition_0" +ADD CONSTRAINT xyz CHECK ( id > 10 and id < 20); +RESET search_path; +GO + +RESET ROLE; +GO + +-- Attempt to ADD storage parameter to babelfish partitioned table (not on the partitions) +SET babelfishpg_tsql.sql_dialect = "tsql"; +GO + +ALTER TABLE master_dbo.partition_vu_prepare_int_table SET (autovacuum_enabled = false); +GO + +RESET babelfishpg_tsql.sql_dialect; +GO + + +-- tsql +ALTER TABLE [363863941f079adaa9aa733200e57c9f_partition_0] +ADD new_col int +GO + + +ALTER TABLE [363863941f079adaa9aa733200e57c9f_partition_0] +ADD CONSTRAINT xyz DEFAULT 10 FOR id; +GO + +-- with explicity schema name +ALTER TABLE dbo.[363863941f079adaa9aa733200e57c9f_partition_0] +ADD new_col int +GO + +ALTER TABLE dbo.[363863941f079adaa9aa733200e57c9f_partition_0] +ADD CONSTRAINT xyz DEFAULT 10 FOR id; +GO + +-- Attempt to drop partition of babelfish partitioned table from tsql endpoint +DROP TABLE [363863941f079adaa9aa733200e57c9f_partition_0] +GO + +-------------------------------------------------------------------- +-- user should not be allowed to rename partition of +-- babelfish partitioned table neither from psql nor tsql endpoint +-------------------------------------------------------------------- +-- Attempt to rename partition of babelfish partitioned table from psql endpoint +-- psql +-- explicit schema name specified +ALTER TABLE master_dbo."363863941f079adaa9aa733200e57c9f_partition_0" +RENAME TO xyz +GO + +-- using search_path +SET search_path = public, master_dbo; +ALTER TABLE "363863941f079adaa9aa733200e57c9f_partition_1" +RENAME TO xyz1 +GO + +-- Attempt to rename partition of babelfish partitioned table from tsql endpoint +-- NOTE: object not found error because sp_rename lookup in sys.objects which +-- will not list child objects +-- tsql +EXEC sp_rename '363863941f079adaa9aa733200e57c9f_partition_2', 'xyz2', 'OBJECT' +GO +-------------------------------------------------------------------- + +--- Unsupported Option with CREATE TABLE with PARTITION SCHEME +-------------------------------------------------------------------- +-- Computed column as partitioning column is not yet supported in babelfish +CREATE TABLE TestPartitionedTable +( + id INT, + value INT, + computed_col AS id + value +) +ON IntPartitionScheme(computed_col); +GO + +CREATE TABLE TestPartitionedTable +( + id INT, + value INT, + computed_col AS id + value PERSISTED +) +ON IntPartitionScheme(computed_col); +GO + +-- temporary table +CREATE TABLE #TestPartitionedTable +( + id INT, + value INT +) +ON IntPartitionScheme(id); +GO + +--------------------------------------------------------------- +--- Negative Scenarios for CREATE TABLE with PARTITION SCHEME +--------------------------------------------------------------- + +-- Attempt to create with multiple columns as partitioning scheme +CREATE TABLE TestPartitionedTable +( + id INT, + value INT +) +ON IntPartitionScheme(id, value); +GO + +-- Attempt to create with a partition scheme that doesn't exist and column that doesn't exist in the table +CREATE TABLE TestPartitionedTable +( + id INT, + value INT +) +ON NonExistentPartitionScheme(NonExistentColumn); +GO + +-- Attempt to create with a partition scheme that doesn't exist +CREATE TABLE TestPartitionedTable +( + id INT, + value INT +) +ON NonExistentPartitionScheme(id); +GO + +-- Attempt to use two part name with partition scheme +CREATE TABLE TestPartitionedTable +( + id INT, + value INT +) +ON master.IntPartitionScheme(id); +GO + +-- Attempt to create with a unique constraint on a non-partition column +CREATE TABLE TestPartitionedTable +( + Id INT, + PartitionColumn INT, + Col1 INT UNIQUE +) +ON IntPartitionScheme(PartitionColumn); +GO + +-- Attempt to create with a primary key constraint on a non-partition column +CREATE TABLE TestPartitionedTable +( + Id INT, + PartitionColumn INT, + Col1 INT PRIMARY KEY +) +ON IntPartitionScheme(PartitionColumn); +GO + +--------------------------------------------------------------- +--- Negative Scenarios for CREATE TABLE with PARTITION SCHEME +--- Attempt to create with an incompatible partition column data type +--------------------------------------------------------------- +CREATE TABLE TestPartitionedTable1 +( + Id INT, + PartitionColumn DECIMAL(10, 2) +) +ON IntPartitionScheme(PartitionColumn); +GO + +CREATE TABLE TestPartitionedTable2 +( + Id INT, + PartitionColumn DATETIME +) +ON DatePartitionScheme(PartitionColumn); +GO + +CREATE TABLE TestPartitionedTable3 +( + Id INT, + PartitionColumn VARCHAR(10) +) +ON CharPartitionScheme(PartitionColumn); +GO + +CREATE TABLE TestPartitionedTable4 +( + Id INT, + PartitionColumn VARBINARY(10) +) +ON BinaryPartitionScheme(PartitionColumn); +GO + +CREATE TABLE TestPartitionedTable5 +( + Id INT, + PartitionColumn SMALLINT +) +ON BigIntPartitionScheme(PartitionColumn); +GO + +CREATE TABLE TestPartitionedTable6 +( + Id INT, + PartitionColumn DECIMAL(10, 2) +) +ON SmallIntPartitionScheme(PartitionColumn); +GO + +CREATE TABLE TestPartitionedTable7 +( + Id INT, + PartitionColumn DECIMAL(10, 5) +) +ON TinyIntPartitionScheme(PartitionColumn); +GO + +CREATE TABLE TestPartitionedTable8 +( + Id INT, + PartitionColumn BIGINT +) +ON DecimalPartitionScheme(PartitionColumn); +GO + +CREATE TABLE TestPartitionedTable9 +( + Id INT, + PartitionColumn MONEY +) +ON NumericPartitionScheme(PartitionColumn); +GO + +CREATE TABLE TestPartitionedTable10 +( + Id INT, + PartitionColumn INT +) +ON MoneyPartitionScheme(PartitionColumn); +GO + +CREATE TABLE TestPartitionedTable11 +( + Id INT, + PartitionColumn DATETIME +) +ON SmallMoneyPartitionScheme(PartitionColumn); +GO + +CREATE TABLE TestPartitionedTable12 +( + Id INT, + PartitionColumn DATETIME2(3) +) +ON DateTimePartitionScheme(PartitionColumn); +GO + +CREATE TABLE TestPartitionedTable13 +( + Id INT, + PartitionColumn SMALLDATETIME +) +ON DateTime2PartitionScheme(PartitionColumn); +GO + +CREATE TABLE TestPartitionedTable14 +( + Id INT, + PartitionColumn NVARCHAR(10) +) +ON SmallDateTimePartitionScheme(PartitionColumn); +GO + +CREATE TABLE TestPartitionedTable15 +( + Id INT, + PartitionColumn INT +) +ON NVarCharPartitionScheme(PartitionColumn); +GO + +CREATE TABLE TestPartitionedTable16 +( + Id INT, + PartitionColumn NCHAR(5) +) +ON VarCharPartitionScheme(PartitionColumn); +GO + +CREATE TABLE TestPartitionedTable17 +( + Id INT, + PartitionColumn INT +) +ON NCharPartitionScheme(PartitionColumn); +GO + +-- using user defined type +CREATE TYPE PartitionUserDefinedType FROM SMALLINT; +GO + +CREATE TABLE TestPartitionedTable18 +( + Id INT, + PartitionColumn PartitionUserDefinedType +) +ON BigIntPartitionScheme(PartitionColumn); +GO + +DROP TYPE PartitionUserDefinedType +GO + +--------------------------------------------------------------- +--- Negative Scenarios for CREATE Index with PARTITION SCHEME +--------------------------------------------------------------- +CREATE TABLE TestPartitionedTable ( + PartitionColumn INT, + NonPartitionColumn INT +) ON IntPartitionScheme(PartitionColumn); +GO + +CREATE TABLE TestNonPartitionedTable ( + a INT, + b INT +) +GO + +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonExistentColumn1) +ON NonExistentPartitionScheme (NonExistentColumn2); +GO + +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonPartitionColumn) +ON NonExistentPartitionScheme (NonExistentColumn2); +GO + +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonPartitionColumn) +ON NonExistentPartitionScheme (NonPartitionColumn); +GO + +-- scheme is different from the partition scheme used in the table +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonPartitionColumn) +ON BigIntPartitionScheme (NonPartitionColumn); +GO + +-- column specified with partition scheme is different +-- from the partition column used in the table +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonPartitionColumn) +ON IntPartitionScheme (NonPartitionColumn); +GO + +-- should work +CREATE INDEX TestPartitionIndex +ON TestPartitionedTable(NonPartitionColumn) +ON IntPartitionScheme (PartitionColumn); +GO + +DROP INDEX TestPartitionIndex ON TestPartitionedTable +GO + +-- usage of partition scheme on non-partitioned table (should fail) +CREATE INDEX TestPartitionIndex +ON TestNonPartitionedTable(a) +ON IntPartitionScheme (a); +GO + + +DROP TABLE TestPartitionedTable +GO + +DROP TABLE TestNonPartitionedTable +GO +------------------------------------------------------------------------------------------- +--- Rename Operation on Partitioned Tables should update name in babelfish_partition_depend +--- and it should also update the name of all the partitions +------------------------------------------------------------------------------------------- +-- psql +SELECT sys.db_name(dbid) as db_name, partition_scheme_name, schema_name, table_name FROM sys.babelfish_partition_depend where table_name = 'partition_vu_prepare_int_table'; +GO + +SELECT inhrelid::regclass as partition_name from pg_inherits where inhparent = (select oid from pg_class where relname = 'partition_vu_prepare_int_table')::regclass; +GO + +-- tsql +-- trigger rename from TSQL endpoint +EXEC sp_rename 'partition_vu_prepare_int_table', 'partition_vu_prepare_int_table_renamed', 'OBJECT' +GO + +-- psql +SELECT sys.db_name(dbid) as db_name, partition_scheme_name, schema_name, table_name FROM sys.babelfish_partition_depend where table_name = 'partition_vu_prepare_int_table_renamed'; +GO + +SELECT inhrelid::regclass as partition_name from pg_inherits where inhparent = (select oid from pg_class where relname = 'partition_vu_prepare_int_table_renamed')::regclass; +GO + +-- trigger rename from PSQL endpoint +ALTER TABLE master_dbo.partition_vu_prepare_int_table_renamed RENAME TO partition_vu_prepare_int_table; +GO + +-- we should get orginal here +SELECT sys.db_name(dbid) as db_name, partition_scheme_name, schema_name, table_name FROM sys.babelfish_partition_depend where table_name = 'partition_vu_prepare_int_table'; +GO + +SELECT inhrelid::regclass as partition_name from pg_inherits where inhparent = (select oid from pg_class where relname = 'partition_vu_prepare_int_table')::regclass; +GO + +-- tsql +---------------------------------------------------------- +--- DOLLAR PARTITION FUNCTION name identifiers tests +---------------------------------------------------------- +SET QUOTED_IDENTIFIER ON; +GO + +SELECT $PARTITION."IntPartitionFunction" (100) +GO + +SELECT $PARTITION."PARTITION_FUNCTION 😎$@ #123 🌍rder "(100) +GO + +SELECT "master".$PARTITION."PARTITION_FUNCTION 😎$@ #123 🌍rder "(100) +GO + +SET QUOTED_IDENTIFIER OFF; +GO + + +SELECT $PARTITION.[PARTITION_FUNCTION 유니코드스키마👻 ] (100) +GO + +SELECT [master].$PARTITION.[PARTITION_FUNCTION 유니코드스키마👻 ] (100) +GO + +SELECT $PARTITION.[IntPartitionFunction] (100) +GO + +SELECT [master].$PARTITION.[IntPartitionFunction] (100) +GO + +SELECT $PARTITION.PARTITION_FUNCTIONログインαιώνια (100) +GO + +SELECT master.$PARTITION.PARTITION_FUNCTIONログインαιώνια (100) +GO + +------------------------------------------ +--- DOLLAR PARTITION FUNCTION Negative test +------------------------------------------ +-- explicit NULL value test +SELECT $PARTITION.IntPartitionFunction(NULL) +GO + +SELECT master.$PARTITION.IntPartitionFunction(NULL) +GO + +-- variable as NULL value +declare @var int = NULL +SELECT $PARTITION.IntPartitionFunction(@var) +GO + +-- non-existent database +SELECT NonExistentDatabase.$PARTITION.IntPartitionFunction(10) +GO + +-- error during implicit Conversion of values to partition function parameter type +SELECT $PARTITION.IntPartitionFunction('xyz') +GO + +-- using query +SELECT $PARTITION.IntPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_varchar_table +ORDER BY PartitionNumber, Id; +GO +--------------------------------------------------------------------- +--- Test for all the Supported Datatypes for Dollar Partition Function +--------------------------------------------------------------------- +SELECT $PARTITION.IntPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_int_table +ORDER BY PartitionNumber, Id; +GO + +SELECT $PARTITION.BigIntPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_bigint_table +ORDER BY PartitionNumber, Id; +GO + +SELECT $PARTITION.SmallIntPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_smallint_table +ORDER BY PartitionNumber, Id; +GO + +SELECT $PARTITION.TinyIntPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_tinyint_table +ORDER BY PartitionNumber, Id; +GO + +SELECT $PARTITION.DecimalPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_decimal_table +ORDER BY PartitionNumber, Id; +GO + +SELECT $PARTITION.NumericPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_numeric_table +ORDER BY PartitionNumber, Id; +GO + +SELECT $PARTITION.MoneyPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_money_table +ORDER BY PartitionNumber, Id; +GO + +SELECT $PARTITION.SmallMoneyPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_smallmoney_table +ORDER BY PartitionNumber, Id; +GO + +SELECT $PARTITION.DatePartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_date_table +ORDER BY PartitionNumber, Id; +GO + +SELECT $PARTITION.DateTimePartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_datetime_table +ORDER BY PartitionNumber, Id; +GO + +SELECT $PARTITION.DateTime2PartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_datetime2_table +ORDER BY PartitionNumber, Id; +GO + +SELECT $PARTITION.SmallDateTimePartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_smalldatetime_table +ORDER BY PartitionNumber, Id; +GO + +SELECT $PARTITION.CharPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_char_table +ORDER BY PartitionNumber, Id; +GO + +SELECT $PARTITION.VarCharPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_varchar_table +ORDER BY PartitionNumber, Id; +GO + +SELECT $PARTITION.NVarCharPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_nvarchar_table +ORDER BY PartitionNumber, Id; +GO + +SELECT $PARTITION.NCharPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_nchar_table +ORDER BY PartitionNumber, Id; +GO + +SELECT $PARTITION.BinaryPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_binary_table +ORDER BY PartitionNumber, Id; +GO + +SELECT $PARTITION.VarBinaryPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_varbinary_table +ORDER BY PartitionNumber, Id; +GO + +SELECT $PARTITION.UniqueIdentifierPartitionFunction(Id) AS PartitionNumber, Id +FROM partition_vu_prepare_uniqueidentifier_table +ORDER BY PartitionNumber, Id; +GO + +---------------------------------------------- +--- DOLLAR PARTITION FUNCTION Dependency test +---------------------------------------------- +-- non-null test +SELECT * FROM DollarPartitionFunctionView +GO + +EXEC DollarPartitionFunctionProc +GO + +SELECT * FROM DollarPartitionFunctionFunc() +GO + +-- null test +SELECT * FROM DollarPartitionFunctionNullView +GO + +EXEC DollarPartitionFunctionNullProc +GO + +SELECT * FROM DollarPartitionFunctionNullFunc() +GO + +SELECT * FROM SysSearchPartitionDepView +GO + +SELECT * FROM SysSearchPartitionNULLDepView +GO +------------------------------------------------------ +--- DOLLAR PARTITION FUNCTION Cross Database test +------------------------------------------------------ +-- in current database with explicity lookup +SELECT master.$PARTITION.[IntPartitionFunction] (100) +GO + +-- use different database +USE PartitionDb; +GO + +SELECT CURRENT_USER +GO + +SELECT master.$PARTITION.[IntPartitionFunction] (100) +GO + +-- test using guest login +CREATE LOGIN partition_l2 WITH PASSWORD = '12345678'; +GO + +CREATE USER partition_u2 FOR LOGIN partition_l2; +GO + +-- tsql user=partition_l2 password=12345678 database=partitiondb +SELECT CURRENT_USER +GO + +SELECT master.$PARTITION.[IntPartitionFunction] (100) +GO + +-- tsql +USE PartitionDb; +GO + +DROP USER partition_u2 +GO \ No newline at end of file diff --git a/test/JDBC/input/SP_TABLES-dep-vu-cleanup.sql b/test/JDBC/input/SP_TABLES-dep-vu-cleanup.sql new file mode 100644 index 00000000000..2abfe444892 --- /dev/null +++ b/test/JDBC/input/SP_TABLES-dep-vu-cleanup.sql @@ -0,0 +1,23 @@ +USE babel_5010_vu_prepare_db1; +GO + +DROP TABLE IF EXISTS babel_5010_temp_table; +GO + +DROP TABLE IF EXISTS babel_5010_vu_prepare_t1; +GO + +DROP TABLE IF EXISTS babel_5010_vu_prepare_t2; +GO + +DROP VIEW IF EXISTS babel_5010_vu_prepare_v1; +GO + +DROP VIEW IF EXISTS babel_5010_vu_prepare_v2; +GO + +USE master; +GO + +DROP DATABASE IF EXISTS babel_5010_vu_prepare_db1; +GO \ No newline at end of file diff --git a/test/JDBC/input/SP_TABLES-dep-vu-prepare.sql b/test/JDBC/input/SP_TABLES-dep-vu-prepare.sql new file mode 100644 index 00000000000..3cca03af301 --- /dev/null +++ b/test/JDBC/input/SP_TABLES-dep-vu-prepare.sql @@ -0,0 +1,29 @@ +CREATE DATABASE babel_5010_vu_prepare_db1; +GO + +USE babel_5010_vu_prepare_db1; +GO + +CREATE TABLE babel_5010_temp_table ( + TABLE_QUALIFIER sys.sysname, + TABLE_OWNER sys.nvarchar(384), + TABLE_NAME sys.nvarchar(384), + TABLE_TYPE sys.nvarchar(100), + REMARKS sys.bit +); +GO + +CREATE TABLE babel_5010_vu_prepare_t1(a INT) +GO + +CREATE TABLE babel_5010_vu_prepare_t2(a INT) +GO + +CREATE VIEW babel_5010_vu_prepare_v1 AS SELECT 1; +GO + +CREATE VIEW babel_5010_vu_prepare_v2 AS SELECT 1; +GO + +USE master; +GO \ No newline at end of file diff --git a/test/JDBC/input/SP_TABLES-dep-vu-verify.sql b/test/JDBC/input/SP_TABLES-dep-vu-verify.sql new file mode 100644 index 00000000000..8bf5bf9d5a4 --- /dev/null +++ b/test/JDBC/input/SP_TABLES-dep-vu-verify.sql @@ -0,0 +1,132 @@ +USE babel_5010_vu_prepare_db1; +GO + +SET NOCOUNT ON; +GO + +-- special case: when table_qualifier only contains one % wildcard character and 0 or more space characters + +-- should enumerate all databases +declare @p1 sys.nvarchar='' +declare @P2 sys.nvarchar='' +declare @P3 sys.nvarchar='% ' +declare @P4 sys.nvarchar=NULL +declare @fUsePattern bit = 1 +INSERT INTO babel_5010_temp_table EXEC [sys].sp_tables @p1, @P2, @P3, @P4, @fUsePattern = @fUsePattern; +SELECT * FROM babel_5010_temp_table WHERE TABLE_QUALIFIER IN ('master', 'tempdb', 'msdb', 'babel_5010_vu_prepare_db1'); +DELETE FROM babel_5010_temp_table; +GO + +declare @p1 sys.nvarchar='' +declare @P2 sys.nvarchar='' +declare @P3 sys.nvarchar='%' +declare @P4 sys.nvarchar=NULL +declare @fUsePattern bit = 1 +INSERT INTO babel_5010_temp_table EXEC [sys].sp_tables @p1, @P2, @P3, @P4, @fUsePattern = @fUsePattern; +SELECT * FROM babel_5010_temp_table WHERE TABLE_QUALIFIER IN ('master', 'tempdb', 'msdb', 'babel_5010_vu_prepare_db1'); +DELETE FROM babel_5010_temp_table; +GO + +INSERT INTO babel_5010_temp_table EXEC [sys].sp_tables @table_name = '', @table_owner = '', @table_qualifier = '% ', @table_type = NULL, @fUsePattern = 1; +SELECT * FROM babel_5010_temp_table WHERE TABLE_QUALIFIER IN ('master', 'tempdb', 'msdb', 'babel_5010_vu_prepare_db1'); +DELETE FROM babel_5010_temp_table; +GO + +INSERT INTO babel_5010_temp_table EXEC [sys].sp_tables @table_name = '', @table_owner = '', @table_qualifier = '%', @table_type = NULL, @fUsePattern = 1; +SELECT * FROM babel_5010_temp_table WHERE TABLE_QUALIFIER IN ('master', 'tempdb', 'msdb', 'babel_5010_vu_prepare_db1'); +DELETE FROM babel_5010_temp_table; +GO + +-- should return empty set +declare @p1 sys.nvarchar='' +declare @P2 sys.nvarchar='' +declare @P3 sys.nvarchar=' %' +declare @P4 sys.nvarchar=NULL +declare @fUsePattern bit = 1 +EXEC [sys].sp_tables @p1, @P2, @P3, @P4, @fUsePattern = @fUsePattern +GO + +declare @p1 sys.nvarchar='' +declare @P2 sys.nvarchar='' +declare @P3 sys.nvarchar=' % ' +declare @P4 sys.nvarchar=NULL +declare @fUsePattern bit = 1 +EXEC [sys].sp_tables @p1, @P2, @P3, @P4, @fUsePattern = @fUsePattern +GO + +declare @p1 sys.nvarchar=' ' +declare @P2 sys.nvarchar='' +declare @P3 sys.nvarchar=NULL +declare @P4 sys.nvarchar=NULL +declare @fUsePattern bit = 1 +EXEC [sys].sp_tables @p1, @P2, @P3, @P4, @fUsePattern = @fUsePattern +GO + +-- should throw error +EXEC [sys].sp_tables @table_name = '', @table_owner = '', @table_qualifier = ' %', @table_type = NULL, @fUsePattern = 1; +GO + +EXEC [sys].sp_tables @table_name = '', @table_owner = '', @table_qualifier = ' % ', @table_type = NULL, @fUsePattern = 1; +GO + +EXEC [sys].sp_tables @table_name = '', @table_owner = '', @table_qualifier = '%%', @table_type = NULL, @fUsePattern = 1; +GO + +EXEC [sys].sp_tables @table_name = '', @table_owner = '', @table_qualifier = '%_', @table_type = NULL, @fUsePattern = 1; +GO + +EXEC [sys].sp_tables @table_name = '', @table_owner = '', @table_qualifier = 'mast%', @table_type = NULL, @fUsePattern = 1; +GO + +EXEC [sys].sp_tables @table_name = '', @table_owner = '', @table_qualifier = '%db', @table_type = NULL, @fUsePattern = 1; +GO + +-- special case: when all parameters are empty string, should return empty set +EXEC [sys].sp_tables @table_name = '', @table_owner = '', @table_qualifier = '', @table_type = '', @fUsePattern = 0; +GO + +EXEC [sys].sp_tables @table_name = '', @table_owner = '', @table_qualifier = '', @table_type = ''; +GO + +-- special case: when all parameters are NULL, should return all tables and views of current database i.e. babel_5010_vu_prepare_db1 +EXEC [sys].sp_tables; +GO + +-- NULL value tests + +-- case 1: when table name is NULL +-- should return matching objects +EXEC [sys].sp_tables @table_owner = 'dbo', @table_qualifier = 'babel_5010_vu_prepare_db1', @table_type = "'TABLE'"; +GO + +EXEC [sys].sp_tables @table_owner = 'dbo', @table_qualifier = 'babel_5010_vu_prepare_db1', @table_type = "'VIEW'"; +GO + +EXEC [sys].sp_tables @table_owner = 'dbo', @table_qualifier = 'babel_5010_vu_prepare_db1', @table_type = "'TABLE','VIEW'"; +GO + +-- case 2: when table owner is NULL +-- should return matching objects +EXEC [sys].sp_tables @table_name = 'babel_5010_vu_prepare_t1', @table_qualifier = 'babel_5010_vu_prepare_db1', @table_type = "'TABLE'"; +GO + +EXEC [sys].sp_tables @table_name = 'babel_5010_vu_prepare_v1', @table_qualifier = 'babel_5010_vu_prepare_db1', @table_type = "'VIEW'"; +GO + +-- should return empty set +EXEC [sys].sp_tables @table_name = 'babel_5010_vu_prepare_v1', @table_qualifier = 'babel_5010_vu_prepare_db1', @table_type = "'TABLE'"; +GO + +-- case 3: when table qualifier is NULL +-- should return matching objects +EXEC [sys].sp_tables @table_name = 'babel_5010_vu_prepare_t1', @table_owner = 'dbo', @table_type = "'TABLE'"; +GO + +EXEC [sys].sp_tables @table_name = 'babel_5010_vu_prepare_v1', @table_owner = 'dbo', @table_type = "'VIEW'"; +GO + +SET NOCOUNT OFF; +GO + +USE master; +GO \ No newline at end of file diff --git a/test/JDBC/input/Test_rename_db_single-db.sql b/test/JDBC/input/Test_rename_db_single-db.sql index 5d9d6cea9a1..75766e8366e 100644 --- a/test/JDBC/input/Test_rename_db_single-db.sql +++ b/test/JDBC/input/Test_rename_db_single-db.sql @@ -13,10 +13,10 @@ Create login rename_db_login1 with password = '1234', default_database = rename_ go -- sanity checks for metadata stored in babelfish catalog -select owner, name from sys.babelfish_sysdatabases where name LIKE 'rename_db_database%'; -select nspname, orig_name from sys.babelfish_namespace_ext where nspname IN ('dbo', 'guest', 'rename_db_schema1'); -select rolname, login_name, orig_username, database_name from sys.babelfish_authid_user_ext where database_name LIKE 'rename_db_database%'; -select rolname, default_database_name from sys.babelfish_authid_login_ext where default_database_name LIKE 'rename_db_database%'; +select owner, name from sys.babelfish_sysdatabases where name LIKE 'rename_db_database%' ORDER BY name; +select nspname, orig_name from sys.babelfish_namespace_ext where nspname IN ('dbo', 'guest', 'rename_db_schema1') ORDER BY nspname; +select rolname, login_name, orig_username, database_name from sys.babelfish_authid_user_ext where database_name LIKE 'rename_db_database%' ORDER BY rolname; +select rolname, default_database_name from sys.babelfish_authid_login_ext where default_database_name LIKE 'rename_db_database%' ORDER BY rolname; go -- Test Alter Database @@ -32,10 +32,10 @@ use master; go -- should return updated rows -select owner, name from sys.babelfish_sysdatabases where name LIKE 'rename_db_database%'; -select nspname, orig_name from sys.babelfish_namespace_ext where nspname IN ('dbo', 'guest', 'rename_db_schema1'); -select rolname, login_name, orig_username, database_name from sys.babelfish_authid_user_ext where database_name LIKE 'rename_db_database%'; -select rolname, default_database_name from sys.babelfish_authid_login_ext where default_database_name LIKE 'rename_db_database%'; +select owner, name from sys.babelfish_sysdatabases where name LIKE 'rename_db_database%' ORDER BY name; +select nspname, orig_name from sys.babelfish_namespace_ext where nspname IN ('dbo', 'guest', 'rename_db_schema1') ORDER BY nspname; +select rolname, login_name, orig_username, database_name from sys.babelfish_authid_user_ext where database_name LIKE 'rename_db_database%' ORDER BY rolname; +select rolname, default_database_name from sys.babelfish_authid_login_ext where default_database_name LIKE 'rename_db_database%' ORDER BY rolname; go -- Test sp_renamedb @@ -51,10 +51,10 @@ use master; go -- should return updated rows -select owner, name from sys.babelfish_sysdatabases where name LIKE 'rename_db_database%'; -select nspname, orig_name from sys.babelfish_namespace_ext where nspname IN ('dbo', 'guest', 'rename_db_schema1'); -select rolname, login_name, orig_username, database_name from sys.babelfish_authid_user_ext where database_name LIKE 'rename_db_database%'; -select rolname, default_database_name from sys.babelfish_authid_login_ext where default_database_name LIKE 'rename_db_database%'; +select owner, name from sys.babelfish_sysdatabases where name LIKE 'rename_db_database%' ORDER BY name; +select nspname, orig_name from sys.babelfish_namespace_ext where nspname IN ('dbo', 'guest', 'rename_db_schema1') ORDER BY nspname; +select rolname, login_name, orig_username, database_name from sys.babelfish_authid_user_ext where database_name LIKE 'rename_db_database%' ORDER BY rolname; +select rolname, default_database_name from sys.babelfish_authid_login_ext where default_database_name LIKE 'rename_db_database%' ORDER BY rolname; go -- Test sp_rename @@ -70,10 +70,10 @@ use master; go -- should return updated rows -select owner, name from sys.babelfish_sysdatabases where name LIKE 'rename_db_database%'; -select nspname, orig_name from sys.babelfish_namespace_ext where nspname IN ('dbo', 'guest', 'rename_db_schema1'); -select rolname, login_name, orig_username, database_name from sys.babelfish_authid_user_ext where database_name LIKE 'rename_db_database%'; -select rolname, default_database_name from sys.babelfish_authid_login_ext where default_database_name LIKE 'rename_db_database%'; +select owner, name from sys.babelfish_sysdatabases where name LIKE 'rename_db_database%' ORDER BY name; +select nspname, orig_name from sys.babelfish_namespace_ext where nspname IN ('dbo', 'guest', 'rename_db_schema1') ORDER BY nspname; +select rolname, login_name, orig_username, database_name from sys.babelfish_authid_user_ext where database_name LIKE 'rename_db_database%' ORDER BY rolname; +select rolname, default_database_name from sys.babelfish_authid_login_ext where default_database_name LIKE 'rename_db_database%' ORDER BY rolname; go -- cleanup diff --git a/test/JDBC/input/alter/alter-procedure-before-15_8-or-16_4-vu-cleanup.sql b/test/JDBC/input/alter/alter-procedure-before-15_8-or-16_4-vu-cleanup.sql new file mode 100644 index 00000000000..71b54d0e922 --- /dev/null +++ b/test/JDBC/input/alter/alter-procedure-before-15_8-or-16_4-vu-cleanup.sql @@ -0,0 +1,21 @@ +DROP PROCEDURE alter_proc_p1 +GO + +DROP PROCEDURE alter_proc_p2 +GO + +DROP PROCEDURE alter_proc_p3 +GO + +DROP PROCEDURE alter_proc_p4 +GO + +DROP PROCEDURE alter_proc_p5 +GO + +DROP TABLE alter_proc_users +DROP TABLE alter_proc_orders +GO + +drop function alter_proc_f1 +go \ No newline at end of file diff --git a/test/JDBC/input/alter/alter-procedure-before-15_8-or-16_4-vu-prepare.sql b/test/JDBC/input/alter/alter-procedure-before-15_8-or-16_4-vu-prepare.sql new file mode 100644 index 00000000000..0e29df5320e --- /dev/null +++ b/test/JDBC/input/alter/alter-procedure-before-15_8-or-16_4-vu-prepare.sql @@ -0,0 +1,69 @@ +CREATE TABLE alter_proc_users ([Id] int, [firstname] varchar(50), [lastname] varchar(50), [email] varchar(50)); +CREATE TABLE alter_proc_orders ([Id] int, [userid] int, [productid] int, [quantity] int, [orderdate] Date); + +INSERT INTO alter_proc_users VALUES (1, 'j', 'o', 'testemail'), (1, 'e', 'l', 'testemail2'); +INSERT INTO alter_proc_orders VALUES (1, 1, 1, 5, '2023-06-25'), (2, 1, 1, 6, '2023-06-25'); +GO + +CREATE PROCEDURE alter_proc_p1 +AS + select * from alter_proc_users +GO + +-- Test Case: Modify the procedure body +ALTER -- test comment + PROCEDURE alter_proc_p1 +AS + select * from alter_proc_orders +GO + +create procedure alter_proc_p2 +AS + exec alter_proc_p1 +go + +create procedure alter_proc_p3 as select 1 +go + +-- Test Case: Transaction - begin, alter proc, modify row, commit +-- - expect both changes to take place +BEGIN TRANSACTION +go + +alter procedure alter_proc_p3 @z int as select 500 + @z +go + +INSERT INTO alter_proc_users VALUES (3, 'newuser', 'lastname', 'testemail3') +go + +COMMIT +GO + +create procedure alter_proc_p4 as select 1 +go + +-- Test Case: confirm information_schema.routines is updated properly with comments +alter + +/* + * test comment 1 + */ + +-- test comment 2 + +procedure alter_proc_p4 as select 3 +go + +create function alter_proc_f1() +returns int +AS BEGIN + return 1 +END + +go + +create procedure alter_proc_p5 as select 10 +go + +alter procedure alter_proc_p5 @dateParam date as select @dateParam +go \ No newline at end of file diff --git a/test/JDBC/input/alter/alter-procedure-before-15_8-or-16_4-vu-verify.sql b/test/JDBC/input/alter/alter-procedure-before-15_8-or-16_4-vu-verify.sql new file mode 100644 index 00000000000..5a4f19673d0 --- /dev/null +++ b/test/JDBC/input/alter/alter-procedure-before-15_8-or-16_4-vu-verify.sql @@ -0,0 +1,105 @@ +-- Test Case: Expect error for procedure with same name +CREATE PROCEDURE alter_proc_p1 @param1 int +AS + select * from alter_proc_orders +GO + +-- Test Case: Expect error for altering proc that does not exist +ALTER PROCEDURE alter_fake_proc @param1 int +AS + select * from alter_proc_orders +GO + +-- Test Case: Expect p1 and p2 to be altered properly with new definition +exec alter_proc_p1 +go + +exec alter_proc_p2 +go + +-- Information_schema routine definition should still show "alter" +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p1'; +go + +-- Test Case: Modify the procedure body, add a parameter, use "proc" +-- instead of "procedure" + ALTER /* TEST COMMENT */ + PROC alter_proc_p1 + @param INT +AS + IF (@param = 1) + BEGIN + select * from alter_proc_users + END + + ELSE + BEGIN + select * from alter_proc_orders + END +GO + +exec alter_proc_p1 @param = 1 +GO + +exec alter_proc_p1 @param = 2 +GO + +-- Test Case: Expect error because no parameter provided +exec alter_proc_p2 +go + +-- Test Case: Alter the parameter type and procedure body +ALTER PROCEDURE alter_proc_p1 + @param date +AS + IF (@param = '2020-01-01') + BEGIN + select * from alter_proc_users + END + + ELSE + BEGIN + select * from alter_proc_orders + END +GO + +exec alter_proc_p1 @param = '2020-01-01' +GO + +exec alter_proc_p1 @param = '2020-01-02' +GO + +-- Test Case: attempt to alter function, expect error for being unsupported +alter function alter_proc_f1() +returns int +as +BEGIN + return 5 +END +go + +-- Test Case: Confirm transaction updates procedure correctly +exec alter_proc_p3 @z = 500 +go + +-- Ensure information schema uses "CREATE" instead of "ALTER" with updated definition +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p3'; +go + +-- Expect this to error with no param provided +exec alter_proc_p3 +go + +-- Expect procedure altered correctly and information_schema contains comments +exec alter_proc_p4 +go + +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p4'; +go + +-- Test Case: confirm procedure altered to add parameter +exec alter_proc_p5 @dateParam = '2000-01-01' +go + +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p5'; +go \ No newline at end of file diff --git a/test/JDBC/input/alter/alter-procedure-schema.mix b/test/JDBC/input/alter/alter-procedure-schema.mix index 046eec81608..df87dc0edf8 100644 --- a/test/JDBC/input/alter/alter-procedure-schema.mix +++ b/test/JDBC/input/alter/alter-procedure-schema.mix @@ -306,4 +306,32 @@ go -- tsql drop login alter_proc_l4; -go \ No newline at end of file +go + +-- psql currentSchema=master_dbo,public +-- Test psql procedures altered with security definer do not throw StartTransactionCommand: unexpected state STARTED error +-- Test alter procedure using tsql dialect in PSQL port throws error +CREATE PROCEDURE master_dbo.p1() AS $$ BEGIN SELECT 1; END $$ LANGUAGE plpgsql; +go + +alter procedure master_dbo.p1 security definer; +go + +drop procedure master_dbo.p1; +go + +set babelfishpg_tsql.sql_dialect = "tsql"; +GO + +CREATE PROCEDURE tsqlp1 as select 1 +go + +ALTER PROCEDURE tsqlp1 as select 2 +go + +drop procedure tsqlp1 +go + +-- Set dialect back to postgres +select set_config('babelfishpg_tsql.sql_dialect', 'postgres', null); +GO \ No newline at end of file diff --git a/test/JDBC/input/alter/alter-procedure-vu-cleanup.sql b/test/JDBC/input/alter/alter-procedure-vu-cleanup.sql index 0179516fc4e..71b54d0e922 100644 --- a/test/JDBC/input/alter/alter-procedure-vu-cleanup.sql +++ b/test/JDBC/input/alter/alter-procedure-vu-cleanup.sql @@ -7,6 +7,12 @@ GO DROP PROCEDURE alter_proc_p3 GO +DROP PROCEDURE alter_proc_p4 +GO + +DROP PROCEDURE alter_proc_p5 +GO + DROP TABLE alter_proc_users DROP TABLE alter_proc_orders GO diff --git a/test/JDBC/input/alter/alter-procedure-vu-prepare.sql b/test/JDBC/input/alter/alter-procedure-vu-prepare.sql index 6ac2d1f9092..d7d78d6cf45 100644 --- a/test/JDBC/input/alter/alter-procedure-vu-prepare.sql +++ b/test/JDBC/input/alter/alter-procedure-vu-prepare.sql @@ -18,10 +18,19 @@ go create procedure alter_proc_p3 as select 1 go +create procedure alter_proc_p4 as select 1 +go + create function alter_proc_f1() returns int AS BEGIN return 1 END +go + +create procedure alter_proc_p5 as select 10 +go + +alter procedure alter_proc_p5 @dateParam date as select @dateParam go \ No newline at end of file diff --git a/test/JDBC/input/alter/alter-procedure-vu-verify.sql b/test/JDBC/input/alter/alter-procedure-vu-verify.sql index 3f6995f398a..aef3b214fa2 100644 --- a/test/JDBC/input/alter/alter-procedure-vu-verify.sql +++ b/test/JDBC/input/alter/alter-procedure-vu-verify.sql @@ -13,8 +13,9 @@ AS select * from alter_proc_orders GO --- Test Case: Modify the procedure body -ALTER PROCEDURE alter_proc_p1 +-- Test Case: Modify the procedure body, and check information_schema updated with spaces +/* Leading comment not included: BABEL-5140 */ ALTER -- test comment + PROCEDURE alter_proc_p1 AS select * from alter_proc_orders GO @@ -25,10 +26,14 @@ go exec alter_proc_p2 go --- Test Case: Modify the procedure body, add a parameter, use "proc" --- instead of "procedure" +-- Ensure information schema uses "CREATE" instead of "ALTER" with updated definition +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p1'; +go -ALTER PROC alter_proc_p1 +-- Test Case: Modify the procedure body, add a parameter, use "proc" +-- instead of "procedure" + ALTER /* TEST COMMENT */ + PROC alter_proc_p1 @param INT AS IF (@param = 1) @@ -48,6 +53,10 @@ GO exec alter_proc_p1 @param = 2 GO +-- Ensure information schema uses "CREATE" instead of "ALTER" with updated definition +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p1'; +go + -- Test Case: Expect error because no parameter provided exec alter_proc_p2 go @@ -73,6 +82,10 @@ GO exec alter_proc_p1 @param = '2020-01-02' GO +-- Ensure information schema uses "CREATE" instead of "ALTER" with updated definition +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p1'; +go + -- Test Case: Modify the procedure body to call another modified proc alter procedure alter_proc_p2 AS @@ -82,6 +95,10 @@ GO exec alter_proc_p2 go +-- Ensure information schema uses "CREATE" instead of "ALTER" with updated definition +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p2'; +go + -- Test Case: attempt to alter function, expect error for being unsupported alter function alter_proc_f1() @@ -126,6 +143,10 @@ go select * from alter_proc_users go +-- Ensure information schema uses "CREATE" instead of "ALTER" with updated definition +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p3'; +go + -- Test Case: Transaction - begin, alter proc, modify row, commit -- - expect both changes to not go through @@ -163,4 +184,44 @@ GO -- Expect this to error with no param provided exec alter_proc_p3 +go + + +-- Test Case: confirm information_schema.routines is updated properly with comments +alter + +/* + * test comment 1 + */ + +-- test comment 2 + +procedure alter_proc_p4 as select 3 +go + +exec alter_proc_p4 +go + +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p4'; +go + +-- Test Case: confirm information_schema.routines is updated properly with comments +alter + +-- test comment 1 + +procedure alter_proc_p4 as select 4 +go + +exec alter_proc_p4 +go + +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p4'; +go + +-- Test Case: confirm procedure altered in 'alter-procedure-vu-prepare' is properly updated +exec alter_proc_p5 @dateParam = '2000-01-01' +go + +select ROUTINE_NAME, ROUTINE_BODY, ROUTINE_DEFINITION from information_schema.routines where SPECIFIC_NAME LIKE 'alter_proc_p4'; go \ No newline at end of file diff --git a/test/JDBC/input/babel_collation.sql b/test/JDBC/input/babel_collation.sql index f7bf6eb5c46..51c8605340b 100644 --- a/test/JDBC/input/babel_collation.sql +++ b/test/JDBC/input/babel_collation.sql @@ -75,7 +75,7 @@ go DECLARE @haystack VARCHAR(100); SELECT @haystack = 'This is a haystack'; -SELECT CHARINDEX('', @haystack); -- empty string - expect 1 +SELECT CHARINDEX('', @haystack); -- empty string - expect 0 go DECLARE @haystack VARCHAR(100); diff --git a/test/JDBC/input/babel_numeric.sql b/test/JDBC/input/babel_numeric.sql index 2dab904ac1c..5717e3e540a 100644 --- a/test/JDBC/input/babel_numeric.sql +++ b/test/JDBC/input/babel_numeric.sql @@ -60,4 +60,197 @@ select * from t1; go drop table t1; -go \ No newline at end of file +go + +select * from +( + select cast(1.23 as decimal(18,2)) as col + union all + select cast(1.23 as decimal(7,2)) as col +) dummy order by col; +go + +select * from +( + select cast(NULL as decimal(18,2)) as col + union all + select cast(1.23 as decimal(7,2)) as col +) dummy order by col; +go + +select * from +( + select cast(9999999999999999.99 as decimal(18,2)) as col + union all + select cast(99999.99 as decimal(7,2)) as col +) dummy order by col; +go + +create type decimal_18_2 from decimal(18,2); +go + +create type decimal_7_2 from decimal(7,2); +go + +select * from +( + select cast(1.23 as decimal_18_2) as col + union all + select cast(1.23 as decimal_7_2) as col +) dummy order by col; +go + +select * from +( + select cast(1.23 as decimal_18_2) as col + union all + select cast(NULL as decimal_7_2) as col +) dummy order by col; +go + +select * from +( + select cast(9999999999999999.99 as decimal_18_2) as col + union all + select cast(99999.99 as decimal_7_2) as col +) dummy order by col; +go + +create table babel_5086_t1 (a decimal(18,2), b decimal(7,2), c decimal_18_2, d decimal_7_2); +go + +insert into babel_5086_t1 values (1.23, 1.23, 1.23, 1.23); +insert into babel_5086_t1 values (9999999999999999.99, NULL, 9999999999999999.99, NULL); +insert into babel_5086_t1 values (NULL, 99999.99, NULL, 99999.99); +go + +select * from +( + select a as col from babel_5086_t1 + union all + select b as col from babel_5086_t1 +) dummy order by col; +go + +select * from +( + select c as col from babel_5086_t1 + union all + select d as col from babel_5086_t1 +) dummy order by col; +go + +select * from +( + select a as col from babel_5086_t1 + union all + select b as col from babel_5086_t1 + union all + select c as col from babel_5086_t1 + union all + select d as col from babel_5086_t1 +) dummy order by col; +go + +select * from +( + select a as col from babel_5086_t1 + union all + select c as col from babel_5086_t1 +) dummy order by col; +go + +select * from +( + select b as col from babel_5086_t1 + union all + select d as col from babel_5086_t1 +) dummy order by col; +go + +create type numeric_18_2 from numeric(18,2); +go + +create type numeric_7_2 from numeric(7,2); +go + +select * from +( + select cast(1.23 as numeric_18_2) as col + union all + select cast(1.23 as numeric_7_2) as col +) dummy order by col; +go + +select * from +( + select cast(12344.234 as numeric_18_2) as col + union all + select cast(1.23 as numeric_7_2) as col +) dummy order by col; +go + +create table babel_5086_t2 (a numeric(18,2), b numeric(7,2), c numeric_18_2, d numeric_7_2); +go + +insert into babel_5086_t2 values (1.23, 1.23, 1.23, 1.23); +insert into babel_5086_t2 values (9999999999999999.99, NULL, 9999999999999999.99, NULL); +insert into babel_5086_t2 values (NULL, 99999.99, NULL, 99999.99); +go + +select * from +( + select a as col from babel_5086_t2 + union all + select b as col from babel_5086_t2 +) dummy order by col; +go + +select * from +( + select c as col from babel_5086_t2 + union all + select d as col from babel_5086_t2 +) dummy order by col; +go + +select * from +( + select a as col from babel_5086_t2 + union all + select b as col from babel_5086_t2 + union all + select c as col from babel_5086_t2 + union all + select d as col from babel_5086_t2 +) dummy order by col; +go + +select * from +( + select a as col from babel_5086_t2 + union all + select c as col from babel_5086_t2 +) dummy order by col; +go + + +select * from +( + select b as col from babel_5086_t2 + union all + select d as col from babel_5086_t2 +) dummy order by col; +go + +drop table babel_5086_t1; +go + +drop table babel_5086_t2; +go + +drop type decimal_18_2; +drop type decimal_7_2; +drop type numeric_18_2; +drop type numeric_7_2; +go diff --git a/test/JDBC/input/babel_trigger.sql b/test/JDBC/input/babel_trigger.sql index afab668bc63..3a7cbe6e042 100644 --- a/test/JDBC/input/babel_trigger.sql +++ b/test/JDBC/input/babel_trigger.sql @@ -343,6 +343,19 @@ GO select name,schema_name(schema_id) from sys.objects where name in ('babel_trigger_trig1','babel_trigger_trig2','babel_trigger_trig3','babel_trigger_trig4') order by name; GO +CREATE TABLE #babel_2177(id int) +go + +-- will fail and print error when trying to create trigger on temp table +CREATE TRIGGER trigger_babel_2177 ON #babel_2177 +AFTER INSERT +AS + INSERT into #babel_2177 VALUES (7) +go + +drop table #babel_2177; +GO + -- clean up drop trigger babel_trigger_sch1.babel_trigger_trig1 GO diff --git a/test/JDBC/input/babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-cleanup.sql b/test/JDBC/input/babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-cleanup.sql new file mode 100644 index 00000000000..89eb8dc81b1 --- /dev/null +++ b/test/JDBC/input/babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-cleanup.sql @@ -0,0 +1,54 @@ +DROP VIEW babel_2877_vu_prepare_view1; +GO + +DROP VIEW babel_2877_vu_prepare_view2; +GO + +DROP VIEW babel_2877_vu_prepare_view3; +GO + +DROP FUNCTION IF EXISTS babel_2877_vu_prepare_func1; +GO + +DROP FUNCTION IF EXISTS babel_2877_vu_prepare_func2; +GO + +DROP FUNCTION IF EXISTS babel_2877_vu_prepare_func3; +GO + +DROP PROCEDURE IF EXISTS babel_2877_vu_prepare_proc1; +GO + +DROP PROCEDURE IF EXISTS babel_2877_vu_prepare_proc2; +GO + +DROP PROCEDURE IF EXISTS babel_2877_vu_prepare_proc3; +GO + +DROP FUNCTION IF EXISTS [BABEL-2877-vu-prepare_FUNC_ANSI_NULLON_QIDON]; +GO + +DROP FUNCTION IF EXISTS [BABEL-2877-vu-prepare_FUNC_ANSI_NULLOFF_QIDON]; +GO + +DROP FUNCTION IF EXISTS [BABEL-2877-vu-prepare_FUNC_ANSI_NULLOFF_QIDOFF]; +GO + +DROP FUNCTION IF EXISTS [BABEL-2877-vu-prepare_FUNC_ANSI_NULLON_QIDOFF]; +GO + +DROP FUNCTION [BABEL-2877-vu-prepare_FUNC_Schema].[BABEL-2877-vu-prepare_FUNC]; +GO + +DROP FUNCTION [BABEL-2877-vu-prepare Schema . WITH .. DOTS].[BABEL-2877-vu-prepare Function . WITH .. DOTS2]; +GO + +DROP SCHEMA [BABEL-2877-vu-prepare_FUNC_Schema]; +GO + +DROP SCHEMA [BABEL-2877-vu-prepare Schema . WITH .. DOTS]; +GO + +-- babelfish_function_ext entry should have been removed after dropping all these functions/procedure +SELECT * FROM sys.babelfish_function_ext WHERE funcname LIKE 'babel_2877_vu_prepare%'; +GO \ No newline at end of file diff --git a/test/JDBC/input/babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-prepare.sql b/test/JDBC/input/babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-prepare.sql new file mode 100644 index 00000000000..34f13e297af --- /dev/null +++ b/test/JDBC/input/babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-prepare.sql @@ -0,0 +1,115 @@ +-- Function +-- Defaults at different positions +CREATE FUNCTION babel_2877_vu_prepare_func1 (@a int, @b varchar(10) = 'abc', @c money, @d float = 1.2) +RETURNS varchar(100) AS +BEGIN + RETURN CAST(@a AS varchar(10)) + @b + CAST(@c AS varchar(10)) + CAST(@d AS varchar(10)); +END +GO + +-- All parameters with defaults +CREATE FUNCTION babel_2877_vu_prepare_func2 (@a int = 10, @b varchar(10) = 'abc', @c money = $5, @d float = 1.2) +RETURNS varchar(100) AS +BEGIN + RETURN CAST(@a AS varchar(10)) + @b + CAST(@c AS varchar(10)) + CAST(@d AS varchar(10)); +END +GO + +-- No defaults +CREATE FUNCTION babel_2877_vu_prepare_func3 (@a int, @b varchar(10), @c money, @d float) +RETURNS varchar(100) AS +BEGIN + RETURN CAST(@a AS varchar(10)) + @b + CAST(@c AS varchar(10)) + CAST(@d AS varchar(10)); +END +GO + +-- Procedure +-- Defaults at different positions +CREATE PROCEDURE babel_2877_vu_prepare_proc1 (@a int, @b varchar(10) = 'abc', @c money = $5, @d float) +AS +BEGIN + SELECT @a, @b, @c, @d; +END +GO + +-- All parameters with defaults +CREATE PROCEDURE babel_2877_vu_prepare_proc2 (@a int = 10, @b varchar(10) = 'abc', @c money = $5, @d float = 1.2) +AS +BEGIN + SELECT @a, @b, @c, @d; +END +GO + +-- No defaults +CREATE PROCEDURE babel_2877_vu_prepare_proc3 (@a int, @b varchar(10), @c money, @d float) +AS +BEGIN + SELECT @a, @b, @c, @d; +END +GO + +-- Views +CREATE VIEW babel_2877_vu_prepare_view1 AS SELECT babel_2877_vu_prepare_func1(20, 'def', $5); +GO + +CREATE VIEW babel_2877_vu_prepare_view2 AS SELECT babel_2877_vu_prepare_func2(); +GO + +CREATE VIEW babel_2877_vu_prepare_view3 AS SELECT babel_2877_vu_prepare_func1(20, 'def', $10, 1.8); +GO + +-- CASE: Check for session properties like ANSI_NULLS and QUOTED_IDENTIFIER +-- ANSI_NULLS - Last bit from left in flag_values +-- QUOTED_IDENTIFIER - Second last bit from left in flag_values +SET ANSI_NULLS ON; +GO + +SET QUOTED_IDENTIFIER ON; +GO + +CREATE FUNCTION [BABEL-2877-vu-prepare_FUNC_ANSI_NULLON_QIDON] (@a int) +RETURNS INT AS BEGIN RETURN 1; END; +GO + +SET ANSI_NULLS OFF; +GO + +CREATE FUNCTION [BABEL-2877-vu-prepare_FUNC_ANSI_NULLOFF_QIDON] (@a int) +RETURNS INT AS BEGIN RETURN 1; END; +GO + +SET QUOTED_IDENTIFIER OFF; +GO + +CREATE FUNCTION [BABEL-2877-vu-prepare_FUNC_ANSI_NULLOFF_QIDOFF] (@a int) +RETURNS INT AS BEGIN RETURN 1; END; +GO + +SET ANSI_NULLS ON; +GO + +CREATE FUNCTION [BABEL-2877-vu-prepare_FUNC_ANSI_NULLON_QIDOFF] (@a int) +RETURNS INT AS BEGIN RETURN 1; END; +GO + +-- reset session properties +SET ANSI_NULLS ON; +GO + +SET QUOTED_IDENTIFIER ON; +GO + +CREATE SCHEMA [BABEL-2877-vu-prepare_FUNC_Schema] +GO + +CREATE SCHEMA [BABEL-2877-vu-prepare Schema . WITH .. DOTS] +GO + +-- Function name which is prefix of schema name +CREATE FUNCTION [BABEL-2877-vu-prepare_FUNC_Schema] . [BABEL-2877-vu-prepare_FUNC] (@a int) +RETURNS INT AS BEGIN RETURN 1; END; +GO + +CREATE FUNCTION [BABEL-2877-vu-prepare Schema . WITH .. DOTS] . [BABEL-2877-vu-prepare Function . WITH .. DOTS] (@a int) +RETURNS INT AS BEGIN RETURN 1; END; +GO diff --git a/test/JDBC/input/babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-verify.sql b/test/JDBC/input/babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-verify.sql new file mode 100644 index 00000000000..5d074621583 --- /dev/null +++ b/test/JDBC/input/babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-verify.sql @@ -0,0 +1,141 @@ +SELECT pg_get_functiondef(cast('babel_2877_vu_prepare_func1' as regproc)); +GO + +SELECT pg_get_functiondef(cast('babel_2877_vu_prepare_func2' as regproc)); +GO + +SELECT pg_get_functiondef(cast('babel_2877_vu_prepare_func3' as regproc)); +GO + +SELECT pg_get_functiondef(cast('babel_2877_vu_prepare_proc1' as regproc)); +GO + +SELECT pg_get_functiondef(cast('babel_2877_vu_prepare_proc2' as regproc)); +GO + +SELECT pg_get_functiondef(cast('babel_2877_vu_prepare_proc3' as regproc)); +GO + +SELECT * FROM babel_2877_vu_prepare_func1(10); -- should fail, required argument @c not supplied +GO + +SELECT * FROM babel_2877_vu_prepare_func1(10, 'abc', $5); +GO + +SELECT * FROM babel_2877_vu_prepare_func2(); +GO + +SELECT * FROM babel_2877_vu_prepare_func3(); -- should fail, all parameters are required +GO + +SELECT * FROM babel_2877_vu_prepare_func3(10, 'abc', $5, 1.2); +GO + +SELECT * FROM babel_2877_vu_prepare_view1; +GO + +SELECT * FROM babel_2877_vu_prepare_view2; +GO + +SELECT * FROM babel_2877_vu_prepare_view3; +GO + +EXEC babel_2877_vu_prepare_proc1; -- should fail, required arguments @a and @d not supplied +GO + +EXEC babel_2877_vu_prepare_proc1 10; -- should fail, required argument @d not supplied +GO + +EXEC babel_2877_vu_prepare_proc1 @d=40; -- should fail, required argument @a not supplied +GO + +EXEC babel_2877_vu_prepare_proc1 @a = 10, @d = 1.8; +GO + +EXEC babel_2877_vu_prepare_proc1 @a = 10, @b = 20, @c = 30, @d = 40; +GO + +EXEC babel_2877_vu_prepare_proc2; +GO + +EXEC babel_2877_vu_prepare_proc2 @d = 1.5; +GO + +EXEC babel_2877_vu_prepare_proc3; -- should fail, all parameters are required +GO + +EXEC babel_2877_vu_prepare_proc3 10, 'def', $10, 1.8; -- should fail, all parameters are required +GO + +-- babelfish_function_ext table should have entry for all the above functions and procedures +SELECT nspname, + funcname, + funcsignature, + default_positions +FROM sys.babelfish_function_ext + WHERE funcname LIKE 'babel_2877_vu_prepare%' + AND funcname NOT LIKE '%ansi%' ORDER BY funcname; +GO + +SELECT orig_name, + CASE flag_validity & 1 + WHEN 0 + THEN NULL + ELSE + CASE flag_values & 1 + WHEN 0 + THEN 0 + ELSE 1 + END + END AS ansi_null, + CASE flag_validity & 2 + WHEN 0 + THEN NULL + ELSE + CASE flag_values & 2 + WHEN 0 + THEN 0 + ELSE 1 + END + END AS quoted_identifier +FROM sys.babelfish_function_ext WHERE funcname LIKE 'babel-2877-vu-prepare%' ORDER BY funcname; +GO + +-- Rename the existing functions to fix the originally stored incorrect orig_name +EXEC sp_rename 'BABEL-2877-vu-prepare_FUNC_Schema.BABEL-2877-vu-prepare_FUNC', 'BABEL-2877-vu-prepare_FUNC2', 'OBJECT' +GO + +EXEC sp_rename '"BABEL-2877-vu-prepare Schema . WITH .. DOTS"."BABEL-2877-vu-prepare Function . WITH .. DOTS"', 'BABEL-2877-vu-prepare Function . WITH .. DOTS2', 'OBJECT' +GO + +-- create a new function with name which is prefix of schema name to verify new behavior +CREATE FUNCTION [BABEL-2877-vu-prepare_FUNC_Schema] . [BABEL-2877-vu-prepare_FUNC] (@a int) +RETURNS INT AS BEGIN RETURN 1; END; +GO + +SELECT orig_name, + CASE flag_validity & 1 + WHEN 0 + THEN NULL + ELSE + CASE flag_values & 1 + WHEN 0 + THEN 0 + ELSE 1 + END + END AS ansi_null, + CASE flag_validity & 2 + WHEN 0 + THEN NULL + ELSE + CASE flag_values & 2 + WHEN 0 + THEN 0 + ELSE 1 + END + END AS quoted_identifier +FROM sys.babelfish_function_ext WHERE funcname LIKE 'babel-2877-vu-prepare%' ORDER BY funcname; +GO + +DROP FUNCTION [BABEL-2877-vu-prepare_FUNC_Schema] . [BABEL-2877-vu-prepare_FUNC2] +GO diff --git a/test/JDBC/input/BABEL-2877-vu-cleanup.sql b/test/JDBC/input/babelfish_function_ext-vu-cleanup.sql similarity index 75% rename from test/JDBC/input/BABEL-2877-vu-cleanup.sql rename to test/JDBC/input/babelfish_function_ext-vu-cleanup.sql index 55bbbf383e7..b99b446a9de 100644 --- a/test/JDBC/input/BABEL-2877-vu-cleanup.sql +++ b/test/JDBC/input/babelfish_function_ext-vu-cleanup.sql @@ -37,6 +37,18 @@ GO DROP FUNCTION IF EXISTS [BABEL-2877-vu-prepare_FUNC_ANSI_NULLON_QIDOFF]; GO +DROP FUNCTION [BABEL-2877-vu-prepare_FUNC_Schema].[BABEL-2877-vu-prepare_FUNC]; +GO + +DROP FUNCTION [BABEL-2877-vu-prepare Schema . WITH .. DOTS].[BABEL-2877-vu-prepare Function . WITH .. DOTS]; +GO + +DROP SCHEMA [BABEL-2877-vu-prepare_FUNC_Schema]; +GO + +DROP SCHEMA [BABEL-2877-vu-prepare Schema . WITH .. DOTS]; +GO + -- babelfish_function_ext entry should have been removed after dropping all these functions/procedure SELECT * FROM sys.babelfish_function_ext WHERE funcname LIKE 'babel_2877_vu_prepare%'; GO \ No newline at end of file diff --git a/test/JDBC/input/babelfish_function_ext-vu-prepare.sql b/test/JDBC/input/babelfish_function_ext-vu-prepare.sql new file mode 100644 index 00000000000..34f13e297af --- /dev/null +++ b/test/JDBC/input/babelfish_function_ext-vu-prepare.sql @@ -0,0 +1,115 @@ +-- Function +-- Defaults at different positions +CREATE FUNCTION babel_2877_vu_prepare_func1 (@a int, @b varchar(10) = 'abc', @c money, @d float = 1.2) +RETURNS varchar(100) AS +BEGIN + RETURN CAST(@a AS varchar(10)) + @b + CAST(@c AS varchar(10)) + CAST(@d AS varchar(10)); +END +GO + +-- All parameters with defaults +CREATE FUNCTION babel_2877_vu_prepare_func2 (@a int = 10, @b varchar(10) = 'abc', @c money = $5, @d float = 1.2) +RETURNS varchar(100) AS +BEGIN + RETURN CAST(@a AS varchar(10)) + @b + CAST(@c AS varchar(10)) + CAST(@d AS varchar(10)); +END +GO + +-- No defaults +CREATE FUNCTION babel_2877_vu_prepare_func3 (@a int, @b varchar(10), @c money, @d float) +RETURNS varchar(100) AS +BEGIN + RETURN CAST(@a AS varchar(10)) + @b + CAST(@c AS varchar(10)) + CAST(@d AS varchar(10)); +END +GO + +-- Procedure +-- Defaults at different positions +CREATE PROCEDURE babel_2877_vu_prepare_proc1 (@a int, @b varchar(10) = 'abc', @c money = $5, @d float) +AS +BEGIN + SELECT @a, @b, @c, @d; +END +GO + +-- All parameters with defaults +CREATE PROCEDURE babel_2877_vu_prepare_proc2 (@a int = 10, @b varchar(10) = 'abc', @c money = $5, @d float = 1.2) +AS +BEGIN + SELECT @a, @b, @c, @d; +END +GO + +-- No defaults +CREATE PROCEDURE babel_2877_vu_prepare_proc3 (@a int, @b varchar(10), @c money, @d float) +AS +BEGIN + SELECT @a, @b, @c, @d; +END +GO + +-- Views +CREATE VIEW babel_2877_vu_prepare_view1 AS SELECT babel_2877_vu_prepare_func1(20, 'def', $5); +GO + +CREATE VIEW babel_2877_vu_prepare_view2 AS SELECT babel_2877_vu_prepare_func2(); +GO + +CREATE VIEW babel_2877_vu_prepare_view3 AS SELECT babel_2877_vu_prepare_func1(20, 'def', $10, 1.8); +GO + +-- CASE: Check for session properties like ANSI_NULLS and QUOTED_IDENTIFIER +-- ANSI_NULLS - Last bit from left in flag_values +-- QUOTED_IDENTIFIER - Second last bit from left in flag_values +SET ANSI_NULLS ON; +GO + +SET QUOTED_IDENTIFIER ON; +GO + +CREATE FUNCTION [BABEL-2877-vu-prepare_FUNC_ANSI_NULLON_QIDON] (@a int) +RETURNS INT AS BEGIN RETURN 1; END; +GO + +SET ANSI_NULLS OFF; +GO + +CREATE FUNCTION [BABEL-2877-vu-prepare_FUNC_ANSI_NULLOFF_QIDON] (@a int) +RETURNS INT AS BEGIN RETURN 1; END; +GO + +SET QUOTED_IDENTIFIER OFF; +GO + +CREATE FUNCTION [BABEL-2877-vu-prepare_FUNC_ANSI_NULLOFF_QIDOFF] (@a int) +RETURNS INT AS BEGIN RETURN 1; END; +GO + +SET ANSI_NULLS ON; +GO + +CREATE FUNCTION [BABEL-2877-vu-prepare_FUNC_ANSI_NULLON_QIDOFF] (@a int) +RETURNS INT AS BEGIN RETURN 1; END; +GO + +-- reset session properties +SET ANSI_NULLS ON; +GO + +SET QUOTED_IDENTIFIER ON; +GO + +CREATE SCHEMA [BABEL-2877-vu-prepare_FUNC_Schema] +GO + +CREATE SCHEMA [BABEL-2877-vu-prepare Schema . WITH .. DOTS] +GO + +-- Function name which is prefix of schema name +CREATE FUNCTION [BABEL-2877-vu-prepare_FUNC_Schema] . [BABEL-2877-vu-prepare_FUNC] (@a int) +RETURNS INT AS BEGIN RETURN 1; END; +GO + +CREATE FUNCTION [BABEL-2877-vu-prepare Schema . WITH .. DOTS] . [BABEL-2877-vu-prepare Function . WITH .. DOTS] (@a int) +RETURNS INT AS BEGIN RETURN 1; END; +GO diff --git a/test/JDBC/input/BABEL-2877-vu-verify.sql b/test/JDBC/input/babelfish_function_ext-vu-verify.sql similarity index 100% rename from test/JDBC/input/BABEL-2877-vu-verify.sql rename to test/JDBC/input/babelfish_function_ext-vu-verify.sql diff --git a/test/JDBC/input/catalogs_dbo_sys_schema-upgrade-vu-cleanup.mix b/test/JDBC/input/catalogs_dbo_sys_schema-upgrade-vu-cleanup.mix new file mode 100644 index 00000000000..e93ab979d84 --- /dev/null +++ b/test/JDBC/input/catalogs_dbo_sys_schema-upgrade-vu-cleanup.mix @@ -0,0 +1,42 @@ +use master +go +drop database myschematest_mydb +go +use master +go +drop table tb_myschematest_master +go +drop type type_myschematest_master +go +drop user user_myschematest_master +go +drop schema myschema +go +drop procedure p_myschematest +go +drop view vw_myschematest +go +use tempdb +go +drop table tb_myschematest_tempdb +go +drop type type_myschematest_tempdb +go +drop user user_myschematest_tempdb +go +drop schema myschema +go +drop procedure p_myschematest +go +drop view vw_myschematest +go +use master +go +drop login login_myschematest_master +go +drop login login_myschematest_tempdb +go +drop login login_myschematest_mydb +go + + diff --git a/test/JDBC/input/catalogs_dbo_sys_schema-upgrade-vu-prepare.mix b/test/JDBC/input/catalogs_dbo_sys_schema-upgrade-vu-prepare.mix new file mode 100644 index 00000000000..f5148c41ddc --- /dev/null +++ b/test/JDBC/input/catalogs_dbo_sys_schema-upgrade-vu-prepare.mix @@ -0,0 +1,291 @@ +use master +go +create database myschematest_mydb +go +create login login_myschematest_master with password = '12345678' +go +create login login_myschematest_tempdb with password = '12345678' +go +create login login_myschematest_mydb with password = '12345678' +go + +use master +go +create table tb_myschematest_master(col_master int) +go +create type type_myschematest_master from int +go +create user user_myschematest_master for login login_myschematest_master +go +create schema myschema +go +create procedure p_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +create view vw_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' +union +select name from .sysdatabases where name = 'myschematest_mydb' +union +select name from ..sysdatabases where name = 'myschematest_mydb' +union +select name from ...sysdatabases where name = 'myschematest_mydb' +union +select name from dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from master..sysdatabases where name = 'myschematest_mydb' +union +select name from .master..sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +go + +use tempdb +go +create table tb_myschematest_tempdb(col_tempdb int) +go +create type type_myschematest_tempdb from int +go +create user user_myschematest_tempdb for login login_myschematest_tempdb +go +create schema myschema +go +create procedure p_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +create view vw_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' +union +select name from .sysdatabases where name = 'myschematest_mydb' +union +select name from ..sysdatabases where name = 'myschematest_mydb' +union +select name from ...sysdatabases where name = 'myschematest_mydb' +union +select name from dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from master..sysdatabases where name = 'myschematest_mydb' +union +select name from .master..sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +go + +use myschematest_mydb +go +create table dbo.tb_myschematest_mydb(col_mydb varchar(40)) +insert dbo.tb_myschematest_mydb values ('dbo.tb_myschematest_mydb') +go +grant select on dbo.tb_myschematest_mydb to public +go +create type type_myschematest_mydb from int +go +create schema myschema +go +create table myschema.tb_myschematest_mydb(col_myschema varchar(40)) +insert myschema.tb_myschematest_mydb values ('myschema.tb_myschematest_mydb') +go +grant select on myschema.tb_myschematest_mydb to public +go +create user user_myschematest_mydb for login login_myschematest_mydb with default_schema = myschema +go +create procedure p_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +create view vw_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' +union +select name from .sysdatabases where name = 'myschematest_mydb' +union +select name from ..sysdatabases where name = 'myschematest_mydb' +union +select name from ...sysdatabases where name = 'myschematest_mydb' +union +select name from dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from master..sysdatabases where name = 'myschematest_mydb' +union +select name from .master..sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +go diff --git a/test/JDBC/input/catalogs_dbo_sys_schema-upgrade-vu-verify.mix b/test/JDBC/input/catalogs_dbo_sys_schema-upgrade-vu-verify.mix new file mode 100644 index 00000000000..5c0acdb1f37 --- /dev/null +++ b/test/JDBC/input/catalogs_dbo_sys_schema-upgrade-vu-verify.mix @@ -0,0 +1,1993 @@ +-- sla 200000 +-- Note: this test is identical to catalogs_dbo_sys_schema, but has different output in 3 places for negative tests +-- since these upgrade tests report the schema name for a not-found object from PG perspective, while the regular +-- tests report the T-SQL schema name +use master +go +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select distinct type from syscharsets order by 1 +go +select distinct type from .syscharsets order by 1 +go +select distinct type from ..syscharsets order by 1 +go +select distinct type from ...syscharsets order by 1 +go +select distinct type from dbo.syscharsets order by 1 +go +select distinct type from .dbo.syscharsets order by 1 +go +select distinct type from ..dbo.syscharsets order by 1 +go +select distinct type from master.dbo.syscharsets order by 1 +go +select distinct type from .master.dbo.syscharsets order by 1 +go +select distinct type from master.sys.syscharsets order by 1 +go +select distinct type from .master.sys.syscharsets order by 1 +go +select distinct type from master..syscharsets order by 1 +go +select distinct type from .master..syscharsets order by 1 +go +select distinct type from tempdb.dbo.syscharsets order by 1 +go +select distinct type from .tempdb.dbo.syscharsets order by 1 +go +select distinct type from tempdb.sys.syscharsets order by 1 +go +select distinct type from .tempdb.sys.syscharsets order by 1 +go +select distinct type from tempdb..syscharsets order by 1 +go +select distinct type from .tempdb..syscharsets order by 1 +go +select distinct type from myschematest_mydb.dbo.syscharsets order by 1 +go +select distinct type from .myschematest_mydb.dbo.syscharsets order by 1 +go +select distinct type from myschematest_mydb.sys.syscharsets order by 1 +go +select distinct type from .myschematest_mydb.sys.syscharsets order by 1 +go +select distinct type from myschematest_mydb..syscharsets order by 1 +go +select distinct type from .myschematest_mydb..syscharsets order by 1 +go +select top 3 config from sysconfigures order by 1 +go +select top 3 config from .sysconfigures order by 1 +go +select top 3 config from ..sysconfigures order by 1 +go +select top 3 config from ...sysconfigures order by 1 +go +select top 3 config from dbo.sysconfigures order by 1 +go +select top 3 config from .dbo.sysconfigures order by 1 +go +select top 3 config from ..dbo.sysconfigures order by 1 +go +select top 3 config from master.dbo.sysconfigures order by 1 +go +select top 3 config from .master.dbo.sysconfigures order by 1 +go +select top 3 config from master.sys.sysconfigures order by 1 +go +select top 3 config from .master.sys.sysconfigures order by 1 +go +select top 3 config from master..sysconfigures order by 1 +go +select top 3 config from .master..sysconfigures order by 1 +go +select top 3 config from tempdb.dbo.sysconfigures order by 1 +go +select top 3 config from .tempdb.dbo.sysconfigures order by 1 +go +select top 3 config from tempdb.sys.sysconfigures order by 1 +go +select top 3 config from .tempdb.sys.sysconfigures order by 1 +go +select top 3 config from tempdb..sysconfigures order by 1 +go +select top 3 config from .tempdb..sysconfigures order by 1 +go +select top 3 config from myschematest_mydb.dbo.sysconfigures order by 1 +go +select top 3 config from .myschematest_mydb.dbo.sysconfigures order by 1 +go +select top 3 config from myschematest_mydb.sys.sysconfigures order by 1 +go +select top 3 config from .myschematest_mydb.sys.sysconfigures order by 1 +go +select top 3 config from myschematest_mydb..sysconfigures order by 1 +go +select top 3 config from .myschematest_mydb..sysconfigures order by 1 +go +select top 3 config from syscurconfigs order by 1 +go +select top 3 config from .syscurconfigs order by 1 +go +select top 3 config from ..syscurconfigs order by 1 +go +select top 3 config from ...syscurconfigs order by 1 +go +select top 3 config from dbo.syscurconfigs order by 1 +go +select top 3 config from .dbo.syscurconfigs order by 1 +go +select top 3 config from ..dbo.syscurconfigs order by 1 +go +select top 3 config from master.dbo.syscurconfigs order by 1 +go +select top 3 config from .master.dbo.syscurconfigs order by 1 +go +select top 3 config from master.sys.syscurconfigs order by 1 +go +select top 3 config from .master.sys.syscurconfigs order by 1 +go +select top 3 config from master..syscurconfigs order by 1 +go +select top 3 config from .master..syscurconfigs order by 1 +go +select top 3 config from tempdb.dbo.syscurconfigs order by 1 +go +select top 3 config from .tempdb.dbo.syscurconfigs order by 1 +go +select top 3 config from tempdb.sys.syscurconfigs order by 1 +go +select top 3 config from .tempdb.sys.syscurconfigs order by 1 +go +select top 3 config from tempdb..syscurconfigs order by 1 +go +select top 3 config from .tempdb..syscurconfigs order by 1 +go +select top 3 config from myschematest_mydb.dbo.syscurconfigs order by 1 +go +select top 3 config from .myschematest_mydb.dbo.syscurconfigs order by 1 +go +select top 3 config from myschematest_mydb.sys.syscurconfigs order by 1 +go +select top 3 config from .myschematest_mydb.sys.syscurconfigs order by 1 +go +select top 3 config from myschematest_mydb..syscurconfigs order by 1 +go +select top 3 config from .myschematest_mydb..syscurconfigs order by 1 +go +select top 3 alias from syslanguages order by 1 +go +select top 3 alias from .syslanguages order by 1 +go +select top 3 alias from ..syslanguages order by 1 +go +select top 3 alias from ...syslanguages order by 1 +go +select top 3 alias from dbo.syslanguages order by 1 +go +select top 3 alias from .dbo.syslanguages order by 1 +go +select top 3 alias from ..dbo.syslanguages order by 1 +go +select top 3 alias from master.dbo.syslanguages order by 1 +go +select top 3 alias from .master.dbo.syslanguages order by 1 +go +select top 3 alias from master.sys.syslanguages order by 1 +go +select top 3 alias from .master.sys.syslanguages order by 1 +go +select top 3 alias from master..syslanguages order by 1 +go +select top 3 alias from .master..syslanguages order by 1 +go +select top 3 alias from tempdb.dbo.syslanguages order by 1 +go +select top 3 alias from .tempdb.dbo.syslanguages order by 1 +go +select top 3 alias from tempdb.sys.syslanguages order by 1 +go +select top 3 alias from .tempdb.sys.syslanguages order by 1 +go +select top 3 alias from tempdb..syslanguages order by 1 +go +select top 3 alias from .tempdb..syslanguages order by 1 +go +select top 3 alias from myschematest_mydb.dbo.syslanguages order by 1 +go +select top 3 alias from .myschematest_mydb.dbo.syslanguages order by 1 +go +select top 3 alias from myschematest_mydb.sys.syslanguages order by 1 +go +select top 3 alias from .myschematest_mydb.sys.syslanguages order by 1 +go +select top 3 alias from myschematest_mydb..syslanguages order by 1 +go +select top 3 alias from .myschematest_mydb..syslanguages order by 1 +go +select name from syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .syslogins where name like 'login_myschematest_%' order by 1 +go +select name from ..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from ...syslogins where name like 'login_myschematest_%' order by 1 +go +select name from dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from ..dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from master..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .master..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +select 0 from sysprocesses where 0 = 1 order by 1 +go +select 0 from .sysprocesses where 0 = 1 order by 1 +go +select 0 from ..sysprocesses where 0 = 1 order by 1 +go +select 0 from ...sysprocesses where 0 = 1 order by 1 +go +select 0 from dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from ..dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from master.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .master.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from master.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from .master.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from master..sysprocesses where 0 = 1 order by 1 +go +select 0 from .master..sysprocesses where 0 = 1 order by 1 +go +select 0 from tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from .tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from tempdb..sysprocesses where 0 = 1 order by 1 +go +select 0 from .tempdb..sysprocesses where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +select object_name(id) from syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ...syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select 0 from sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .sysforeignkeys where 0 = 1 order by 1 +go +select 0 from ..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from ...sysforeignkeys where 0 = 1 order by 1 +go +select 0 from dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from ..dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from master.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .master.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from master..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .master..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from tempdb..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .tempdb..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +select object_name(id) from sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ...sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_name(id) from sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ...sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select schema_name(uid), object_name(id) from myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select name from systypes where name like 'type_myschematest_%' order by 1 +go +select name from .systypes where name like 'type_myschematest_%' order by 1 +go +select name from ..systypes where name like 'type_myschematest_%' order by 1 +go +select name from ...systypes where name like 'type_myschematest_%' order by 1 +go +select name from dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from ..dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from master..systypes where name like 'type_myschematest_%' order by 1 +go +select name from .master..systypes where name like 'type_myschematest_%' order by 1 +go +select name from myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +select name from .myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +select name from sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .sysusers where name like 'user_myschematest_%' order by 1 +go +select name from ..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from ...sysusers where name like 'user_myschematest_%' order by 1 +go +select name from dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from ..dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from master..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .master..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +exec p_myschematest +go +select name from vw_myschematest order by 1 +go + +-- non-catalog table +select * from master..tb_myschematest_master +go +select * from .master..tb_myschematest_master +go +go +select * from master.dbo.tb_myschematest_master +go +select * from .master.dbo.tb_myschematest_master +go + +select * from tempdb..tb_myschematest_tempdb +go +select * from .tempdb..tb_myschematest_tempdb +go +go +select * from tempdb.dbo.tb_myschematest_tempdb +go +select * from .tempdb.dbo.tb_myschematest_tempdb +go + +select * from myschematest_mydb..tb_myschematest_mydb +go +select * from .myschematest_mydb..tb_myschematest_mydb +go +go +select * from myschematest_mydb.dbo.tb_myschematest_mydb +go +select * from .myschematest_mydb.dbo.tb_myschematest_mydb +go + +-- negative tests +select count(*) from master.myschema.sysobjects +go +select count(*) from tempdb.myschema.sysobjects +go +select count(*) from myschematest_mydb.myschema.sysobjects +go + + +use tempdb +go +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select distinct type from syscharsets order by 1 +go +select distinct type from .syscharsets order by 1 +go +select distinct type from ..syscharsets order by 1 +go +select distinct type from ...syscharsets order by 1 +go +select distinct type from dbo.syscharsets order by 1 +go +select distinct type from .dbo.syscharsets order by 1 +go +select distinct type from ..dbo.syscharsets order by 1 +go +select distinct type from master.dbo.syscharsets order by 1 +go +select distinct type from .master.dbo.syscharsets order by 1 +go +select distinct type from master.sys.syscharsets order by 1 +go +select distinct type from .master.sys.syscharsets order by 1 +go +select distinct type from master..syscharsets order by 1 +go +select distinct type from .master..syscharsets order by 1 +go +select distinct type from tempdb.dbo.syscharsets order by 1 +go +select distinct type from .tempdb.dbo.syscharsets order by 1 +go +select distinct type from tempdb.sys.syscharsets order by 1 +go +select distinct type from .tempdb.sys.syscharsets order by 1 +go +select distinct type from tempdb..syscharsets order by 1 +go +select distinct type from .tempdb..syscharsets order by 1 +go +select distinct type from myschematest_mydb.dbo.syscharsets order by 1 +go +select distinct type from .myschematest_mydb.dbo.syscharsets order by 1 +go +select distinct type from myschematest_mydb.sys.syscharsets order by 1 +go +select distinct type from .myschematest_mydb.sys.syscharsets order by 1 +go +select distinct type from myschematest_mydb..syscharsets order by 1 +go +select distinct type from .myschematest_mydb..syscharsets order by 1 +go +select top 3 config from sysconfigures order by 1 +go +select top 3 config from .sysconfigures order by 1 +go +select top 3 config from ..sysconfigures order by 1 +go +select top 3 config from ...sysconfigures order by 1 +go +select top 3 config from dbo.sysconfigures order by 1 +go +select top 3 config from .dbo.sysconfigures order by 1 +go +select top 3 config from ..dbo.sysconfigures order by 1 +go +select top 3 config from master.dbo.sysconfigures order by 1 +go +select top 3 config from .master.dbo.sysconfigures order by 1 +go +select top 3 config from master.sys.sysconfigures order by 1 +go +select top 3 config from .master.sys.sysconfigures order by 1 +go +select top 3 config from master..sysconfigures order by 1 +go +select top 3 config from .master..sysconfigures order by 1 +go +select top 3 config from tempdb.dbo.sysconfigures order by 1 +go +select top 3 config from .tempdb.dbo.sysconfigures order by 1 +go +select top 3 config from tempdb.sys.sysconfigures order by 1 +go +select top 3 config from .tempdb.sys.sysconfigures order by 1 +go +select top 3 config from tempdb..sysconfigures order by 1 +go +select top 3 config from .tempdb..sysconfigures order by 1 +go +select top 3 config from myschematest_mydb.dbo.sysconfigures order by 1 +go +select top 3 config from .myschematest_mydb.dbo.sysconfigures order by 1 +go +select top 3 config from myschematest_mydb.sys.sysconfigures order by 1 +go +select top 3 config from .myschematest_mydb.sys.sysconfigures order by 1 +go +select top 3 config from myschematest_mydb..sysconfigures order by 1 +go +select top 3 config from .myschematest_mydb..sysconfigures order by 1 +go +select top 3 config from syscurconfigs order by 1 +go +select top 3 config from .syscurconfigs order by 1 +go +select top 3 config from ..syscurconfigs order by 1 +go +select top 3 config from ...syscurconfigs order by 1 +go +select top 3 config from dbo.syscurconfigs order by 1 +go +select top 3 config from .dbo.syscurconfigs order by 1 +go +select top 3 config from ..dbo.syscurconfigs order by 1 +go +select top 3 config from master.dbo.syscurconfigs order by 1 +go +select top 3 config from .master.dbo.syscurconfigs order by 1 +go +select top 3 config from master.sys.syscurconfigs order by 1 +go +select top 3 config from .master.sys.syscurconfigs order by 1 +go +select top 3 config from master..syscurconfigs order by 1 +go +select top 3 config from .master..syscurconfigs order by 1 +go +select top 3 config from tempdb.dbo.syscurconfigs order by 1 +go +select top 3 config from .tempdb.dbo.syscurconfigs order by 1 +go +select top 3 config from tempdb.sys.syscurconfigs order by 1 +go +select top 3 config from .tempdb.sys.syscurconfigs order by 1 +go +select top 3 config from tempdb..syscurconfigs order by 1 +go +select top 3 config from .tempdb..syscurconfigs order by 1 +go +select top 3 config from myschematest_mydb.dbo.syscurconfigs order by 1 +go +select top 3 config from .myschematest_mydb.dbo.syscurconfigs order by 1 +go +select top 3 config from myschematest_mydb.sys.syscurconfigs order by 1 +go +select top 3 config from .myschematest_mydb.sys.syscurconfigs order by 1 +go +select top 3 config from myschematest_mydb..syscurconfigs order by 1 +go +select top 3 config from .myschematest_mydb..syscurconfigs order by 1 +go +select top 3 alias from syslanguages order by 1 +go +select top 3 alias from .syslanguages order by 1 +go +select top 3 alias from ..syslanguages order by 1 +go +select top 3 alias from ...syslanguages order by 1 +go +select top 3 alias from dbo.syslanguages order by 1 +go +select top 3 alias from .dbo.syslanguages order by 1 +go +select top 3 alias from ..dbo.syslanguages order by 1 +go +select top 3 alias from master.dbo.syslanguages order by 1 +go +select top 3 alias from .master.dbo.syslanguages order by 1 +go +select top 3 alias from master.sys.syslanguages order by 1 +go +select top 3 alias from .master.sys.syslanguages order by 1 +go +select top 3 alias from master..syslanguages order by 1 +go +select top 3 alias from .master..syslanguages order by 1 +go +select top 3 alias from tempdb.dbo.syslanguages order by 1 +go +select top 3 alias from .tempdb.dbo.syslanguages order by 1 +go +select top 3 alias from tempdb.sys.syslanguages order by 1 +go +select top 3 alias from .tempdb.sys.syslanguages order by 1 +go +select top 3 alias from tempdb..syslanguages order by 1 +go +select top 3 alias from .tempdb..syslanguages order by 1 +go +select top 3 alias from myschematest_mydb.dbo.syslanguages order by 1 +go +select top 3 alias from .myschematest_mydb.dbo.syslanguages order by 1 +go +select top 3 alias from myschematest_mydb.sys.syslanguages order by 1 +go +select top 3 alias from .myschematest_mydb.sys.syslanguages order by 1 +go +select top 3 alias from myschematest_mydb..syslanguages order by 1 +go +select top 3 alias from .myschematest_mydb..syslanguages order by 1 +go +select name from syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .syslogins where name like 'login_myschematest_%' order by 1 +go +select name from ..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from ...syslogins where name like 'login_myschematest_%' order by 1 +go +select name from dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from ..dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from master..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .master..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +select 0 from sysprocesses where 0 = 1 order by 1 +go +select 0 from .sysprocesses where 0 = 1 order by 1 +go +select 0 from ..sysprocesses where 0 = 1 order by 1 +go +select 0 from ...sysprocesses where 0 = 1 order by 1 +go +select 0 from dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from ..dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from master.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .master.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from master.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from .master.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from master..sysprocesses where 0 = 1 order by 1 +go +select 0 from .master..sysprocesses where 0 = 1 order by 1 +go +select 0 from tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from .tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from tempdb..sysprocesses where 0 = 1 order by 1 +go +select 0 from .tempdb..sysprocesses where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +select object_name(id) from syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ...syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select 0 from sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .sysforeignkeys where 0 = 1 order by 1 +go +select 0 from ..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from ...sysforeignkeys where 0 = 1 order by 1 +go +select 0 from dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from ..dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from master.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .master.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from master..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .master..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from tempdb..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .tempdb..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +select object_name(id) from sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ...sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_name(id) from sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ...sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select schema_name(uid), object_name(id) from myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select name from master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from master..systypes where name like 'type_myschematest_%' order by 1 +go +select name from .master..systypes where name like 'type_myschematest_%' order by 1 +go +select name from myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +select name from .myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +select name from master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from master..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .master..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +exec p_myschematest +go +select name from vw_myschematest order by 1 +go + +-- non-catalog table +select * from master..tb_myschematest_master +go +select * from .master..tb_myschematest_master +go +go +select * from master.dbo.tb_myschematest_master +go +select * from .master.dbo.tb_myschematest_master +go + +select * from tempdb..tb_myschematest_tempdb +go +select * from .tempdb..tb_myschematest_tempdb +go +go +select * from tempdb.dbo.tb_myschematest_tempdb +go +select * from .tempdb.dbo.tb_myschematest_tempdb +go + +select * from myschematest_mydb..tb_myschematest_mydb +go +select * from .myschematest_mydb..tb_myschematest_mydb +go +go +select * from myschematest_mydb.dbo.tb_myschematest_mydb +go +select * from .myschematest_mydb.dbo.tb_myschematest_mydb +go + +-- negative tests +select count(*) from master.myschema.sysobjects +go +select count(*) from tempdb.myschema.sysobjects +go +select count(*) from myschematest_mydb.myschema.sysobjects +go + +use myschematest_mydb +go +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select distinct type from syscharsets order by 1 +go +select distinct type from .syscharsets order by 1 +go +select distinct type from ..syscharsets order by 1 +go +select distinct type from ...syscharsets order by 1 +go +select distinct type from dbo.syscharsets order by 1 +go +select distinct type from .dbo.syscharsets order by 1 +go +select distinct type from ..dbo.syscharsets order by 1 +go +select distinct type from master.dbo.syscharsets order by 1 +go +select distinct type from .master.dbo.syscharsets order by 1 +go +select distinct type from master.sys.syscharsets order by 1 +go +select distinct type from .master.sys.syscharsets order by 1 +go +select distinct type from master..syscharsets order by 1 +go +select distinct type from .master..syscharsets order by 1 +go +select distinct type from tempdb.dbo.syscharsets order by 1 +go +select distinct type from .tempdb.dbo.syscharsets order by 1 +go +select distinct type from tempdb.sys.syscharsets order by 1 +go +select distinct type from .tempdb.sys.syscharsets order by 1 +go +select distinct type from tempdb..syscharsets order by 1 +go +select distinct type from .tempdb..syscharsets order by 1 +go +select distinct type from myschematest_mydb.dbo.syscharsets order by 1 +go +select distinct type from .myschematest_mydb.dbo.syscharsets order by 1 +go +select distinct type from myschematest_mydb.sys.syscharsets order by 1 +go +select distinct type from .myschematest_mydb.sys.syscharsets order by 1 +go +select distinct type from myschematest_mydb..syscharsets order by 1 +go +select distinct type from .myschematest_mydb..syscharsets order by 1 +go +select top 3 config from sysconfigures order by 1 +go +select top 3 config from .sysconfigures order by 1 +go +select top 3 config from ..sysconfigures order by 1 +go +select top 3 config from ...sysconfigures order by 1 +go +select top 3 config from dbo.sysconfigures order by 1 +go +select top 3 config from .dbo.sysconfigures order by 1 +go +select top 3 config from ..dbo.sysconfigures order by 1 +go +select top 3 config from master.dbo.sysconfigures order by 1 +go +select top 3 config from .master.dbo.sysconfigures order by 1 +go +select top 3 config from master.sys.sysconfigures order by 1 +go +select top 3 config from .master.sys.sysconfigures order by 1 +go +select top 3 config from master..sysconfigures order by 1 +go +select top 3 config from .master..sysconfigures order by 1 +go +select top 3 config from tempdb.dbo.sysconfigures order by 1 +go +select top 3 config from .tempdb.dbo.sysconfigures order by 1 +go +select top 3 config from tempdb.sys.sysconfigures order by 1 +go +select top 3 config from .tempdb.sys.sysconfigures order by 1 +go +select top 3 config from tempdb..sysconfigures order by 1 +go +select top 3 config from .tempdb..sysconfigures order by 1 +go +select top 3 config from myschematest_mydb.dbo.sysconfigures order by 1 +go +select top 3 config from .myschematest_mydb.dbo.sysconfigures order by 1 +go +select top 3 config from myschematest_mydb.sys.sysconfigures order by 1 +go +select top 3 config from .myschematest_mydb.sys.sysconfigures order by 1 +go +select top 3 config from myschematest_mydb..sysconfigures order by 1 +go +select top 3 config from .myschematest_mydb..sysconfigures order by 1 +go +select top 3 config from syscurconfigs order by 1 +go +select top 3 config from .syscurconfigs order by 1 +go +select top 3 config from ..syscurconfigs order by 1 +go +select top 3 config from ...syscurconfigs order by 1 +go +select top 3 config from dbo.syscurconfigs order by 1 +go +select top 3 config from .dbo.syscurconfigs order by 1 +go +select top 3 config from ..dbo.syscurconfigs order by 1 +go +select top 3 config from master.dbo.syscurconfigs order by 1 +go +select top 3 config from .master.dbo.syscurconfigs order by 1 +go +select top 3 config from master.sys.syscurconfigs order by 1 +go +select top 3 config from .master.sys.syscurconfigs order by 1 +go +select top 3 config from master..syscurconfigs order by 1 +go +select top 3 config from .master..syscurconfigs order by 1 +go +select top 3 config from tempdb.dbo.syscurconfigs order by 1 +go +select top 3 config from .tempdb.dbo.syscurconfigs order by 1 +go +select top 3 config from tempdb.sys.syscurconfigs order by 1 +go +select top 3 config from .tempdb.sys.syscurconfigs order by 1 +go +select top 3 config from tempdb..syscurconfigs order by 1 +go +select top 3 config from .tempdb..syscurconfigs order by 1 +go +select top 3 config from myschematest_mydb.dbo.syscurconfigs order by 1 +go +select top 3 config from .myschematest_mydb.dbo.syscurconfigs order by 1 +go +select top 3 config from myschematest_mydb.sys.syscurconfigs order by 1 +go +select top 3 config from .myschematest_mydb.sys.syscurconfigs order by 1 +go +select top 3 config from myschematest_mydb..syscurconfigs order by 1 +go +select top 3 config from .myschematest_mydb..syscurconfigs order by 1 +go +select top 3 alias from syslanguages order by 1 +go +select top 3 alias from .syslanguages order by 1 +go +select top 3 alias from ..syslanguages order by 1 +go +select top 3 alias from ...syslanguages order by 1 +go +select top 3 alias from dbo.syslanguages order by 1 +go +select top 3 alias from .dbo.syslanguages order by 1 +go +select top 3 alias from ..dbo.syslanguages order by 1 +go +select top 3 alias from master.dbo.syslanguages order by 1 +go +select top 3 alias from .master.dbo.syslanguages order by 1 +go +select top 3 alias from master.sys.syslanguages order by 1 +go +select top 3 alias from .master.sys.syslanguages order by 1 +go +select top 3 alias from master..syslanguages order by 1 +go +select top 3 alias from .master..syslanguages order by 1 +go +select top 3 alias from tempdb.dbo.syslanguages order by 1 +go +select top 3 alias from .tempdb.dbo.syslanguages order by 1 +go +select top 3 alias from tempdb.sys.syslanguages order by 1 +go +select top 3 alias from .tempdb.sys.syslanguages order by 1 +go +select top 3 alias from tempdb..syslanguages order by 1 +go +select top 3 alias from .tempdb..syslanguages order by 1 +go +select top 3 alias from myschematest_mydb.dbo.syslanguages order by 1 +go +select top 3 alias from .myschematest_mydb.dbo.syslanguages order by 1 +go +select top 3 alias from myschematest_mydb.sys.syslanguages order by 1 +go +select top 3 alias from .myschematest_mydb.sys.syslanguages order by 1 +go +select top 3 alias from myschematest_mydb..syslanguages order by 1 +go +select top 3 alias from .myschematest_mydb..syslanguages order by 1 +go +select name from syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .syslogins where name like 'login_myschematest_%' order by 1 +go +select name from ..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from ...syslogins where name like 'login_myschematest_%' order by 1 +go +select name from dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from ..dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from master..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .master..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +select 0 from sysprocesses where 0 = 1 order by 1 +go +select 0 from .sysprocesses where 0 = 1 order by 1 +go +select 0 from ..sysprocesses where 0 = 1 order by 1 +go +select 0 from ...sysprocesses where 0 = 1 order by 1 +go +select 0 from dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from ..dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from master.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .master.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from master.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from .master.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from master..sysprocesses where 0 = 1 order by 1 +go +select 0 from .master..sysprocesses where 0 = 1 order by 1 +go +select 0 from tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from .tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from tempdb..sysprocesses where 0 = 1 order by 1 +go +select 0 from .tempdb..sysprocesses where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ...syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ..dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_name(id) from master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select 0 from sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .sysforeignkeys where 0 = 1 order by 1 +go +select 0 from ..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from ...sysforeignkeys where 0 = 1 order by 1 +go +select 0 from dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from ..dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from master.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .master.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from master..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .master..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from tempdb..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .tempdb..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ...sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ..dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_name(id) from master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from ..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from ...sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from ..dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_name(id) from master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select schema_name(uid), object_name(id) from myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select name from systypes where name like 'type_myschematest_%' order by 1 +go +select name from .systypes where name like 'type_myschematest_%' order by 1 +go +select name from ..systypes where name like 'type_myschematest_%' order by 1 +go +select name from ...systypes where name like 'type_myschematest_%' order by 1 +go +select name from dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from ..dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from master..systypes where name like 'type_myschematest_%' order by 1 +go +select name from .master..systypes where name like 'type_myschematest_%' order by 1 +go +select name from myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +select name from .myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +select name from sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .sysusers where name like 'user_myschematest_%' order by 1 +go +select name from ..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from ...sysusers where name like 'user_myschematest_%' order by 1 +go +select name from dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from ..dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from master..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .master..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +exec p_myschematest +go +select name from vw_myschematest order by 1 +go + +-- non-catalog table +select * from master..tb_myschematest_master +go +select * from .master..tb_myschematest_master +go +go +select * from master.dbo.tb_myschematest_master +go +select * from .master.dbo.tb_myschematest_master +go + +select * from tempdb..tb_myschematest_tempdb +go +select * from .tempdb..tb_myschematest_tempdb +go +go +select * from tempdb.dbo.tb_myschematest_tempdb +go +select * from .tempdb.dbo.tb_myschematest_tempdb +go + +select * from myschematest_mydb..tb_myschematest_mydb +go +select * from .myschematest_mydb..tb_myschematest_mydb +go +go +select * from myschematest_mydb.dbo.tb_myschematest_mydb +go +select * from .myschematest_mydb.dbo.tb_myschematest_mydb +go + +-- negative tests +select count(*) from master.myschema.sysobjects +go +select count(*) from tempdb.myschema.sysobjects +go +select count(*) from myschematest_mydb.myschema.sysobjects +go + diff --git a/test/JDBC/input/catalogs_dbo_sys_schema-vu-cleanup.mix b/test/JDBC/input/catalogs_dbo_sys_schema-vu-cleanup.mix new file mode 100644 index 00000000000..e93ab979d84 --- /dev/null +++ b/test/JDBC/input/catalogs_dbo_sys_schema-vu-cleanup.mix @@ -0,0 +1,42 @@ +use master +go +drop database myschematest_mydb +go +use master +go +drop table tb_myschematest_master +go +drop type type_myschematest_master +go +drop user user_myschematest_master +go +drop schema myschema +go +drop procedure p_myschematest +go +drop view vw_myschematest +go +use tempdb +go +drop table tb_myschematest_tempdb +go +drop type type_myschematest_tempdb +go +drop user user_myschematest_tempdb +go +drop schema myschema +go +drop procedure p_myschematest +go +drop view vw_myschematest +go +use master +go +drop login login_myschematest_master +go +drop login login_myschematest_tempdb +go +drop login login_myschematest_mydb +go + + diff --git a/test/JDBC/input/catalogs_dbo_sys_schema-vu-prepare.mix b/test/JDBC/input/catalogs_dbo_sys_schema-vu-prepare.mix new file mode 100644 index 00000000000..c6979a5af22 --- /dev/null +++ b/test/JDBC/input/catalogs_dbo_sys_schema-vu-prepare.mix @@ -0,0 +1,293 @@ +use master +go +create database myschematest_mydb +go +create login login_myschematest_master with password = '12345678' +go +create login login_myschematest_tempdb with password = '12345678' +go +create login login_myschematest_mydb with password = '12345678' +go + +use master +go +create table tb_myschematest_master(col_master int) +go +create type type_myschematest_master from int +go +create user user_myschematest_master for login login_myschematest_master +go +create schema myschema +go +create procedure p_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +create view vw_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' +union +select name from .sysdatabases where name = 'myschematest_mydb' +union +select name from ..sysdatabases where name = 'myschematest_mydb' +union +select name from ...sysdatabases where name = 'myschematest_mydb' +union +select name from dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from master..sysdatabases where name = 'myschematest_mydb' +union +select name from .master..sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +go + +use tempdb +go +create table tb_myschematest_tempdb(col_tempdb int) +go +create type type_myschematest_tempdb from int +go +create user user_myschematest_tempdb for login login_myschematest_tempdb +go +create schema myschema +go +create procedure p_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +create view vw_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' +union +select name from .sysdatabases where name = 'myschematest_mydb' +union +select name from ..sysdatabases where name = 'myschematest_mydb' +union +select name from ...sysdatabases where name = 'myschematest_mydb' +union +select name from dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from master..sysdatabases where name = 'myschematest_mydb' +union +select name from .master..sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +go + + +use myschematest_mydb +go +create table dbo.tb_myschematest_mydb(col_mydb varchar(40)) +insert dbo.tb_myschematest_mydb values ('dbo.tb_myschematest_mydb') +go +grant select on dbo.tb_myschematest_mydb to public +go +create type type_myschematest_mydb from int +go +create schema myschema +go +create table myschema.tb_myschematest_mydb(col_myschema varchar(40)) +insert myschema.tb_myschematest_mydb values ('myschema.tb_myschematest_mydb') +go +grant select on myschema.tb_myschematest_mydb to public +go +create user user_myschematest_mydb for login login_myschematest_mydb with default_schema = myschema +go +create procedure p_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +create view vw_myschematest +as +select name from sysdatabases where name = 'myschematest_mydb' +union +select name from .sysdatabases where name = 'myschematest_mydb' +union +select name from ..sysdatabases where name = 'myschematest_mydb' +union +select name from ...sysdatabases where name = 'myschematest_mydb' +union +select name from dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from master..sysdatabases where name = 'myschematest_mydb' +union +select name from .master..sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' +union +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +union +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' +go + diff --git a/test/JDBC/input/catalogs_dbo_sys_schema-vu-verify.mix b/test/JDBC/input/catalogs_dbo_sys_schema-vu-verify.mix new file mode 100644 index 00000000000..a4c180b3418 --- /dev/null +++ b/test/JDBC/input/catalogs_dbo_sys_schema-vu-verify.mix @@ -0,0 +1,2017 @@ +-- sla 200000 +use master +go +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select distinct type from syscharsets order by 1 +go +select distinct type from .syscharsets order by 1 +go +select distinct type from ..syscharsets order by 1 +go +select distinct type from ...syscharsets order by 1 +go +select distinct type from dbo.syscharsets order by 1 +go +select distinct type from .dbo.syscharsets order by 1 +go +select distinct type from ..dbo.syscharsets order by 1 +go +select distinct type from master.dbo.syscharsets order by 1 +go +select distinct type from .master.dbo.syscharsets order by 1 +go +select distinct type from master.sys.syscharsets order by 1 +go +select distinct type from .master.sys.syscharsets order by 1 +go +select distinct type from master..syscharsets order by 1 +go +select distinct type from .master..syscharsets order by 1 +go +select distinct type from tempdb.dbo.syscharsets order by 1 +go +select distinct type from .tempdb.dbo.syscharsets order by 1 +go +select distinct type from tempdb.sys.syscharsets order by 1 +go +select distinct type from .tempdb.sys.syscharsets order by 1 +go +select distinct type from tempdb..syscharsets order by 1 +go +select distinct type from .tempdb..syscharsets order by 1 +go +select distinct type from myschematest_mydb.dbo.syscharsets order by 1 +go +select distinct type from .myschematest_mydb.dbo.syscharsets order by 1 +go +select distinct type from myschematest_mydb.sys.syscharsets order by 1 +go +select distinct type from .myschematest_mydb.sys.syscharsets order by 1 +go +select distinct type from myschematest_mydb..syscharsets order by 1 +go +select distinct type from .myschematest_mydb..syscharsets order by 1 +go +select top 3 config from sysconfigures order by 1 +go +select top 3 config from .sysconfigures order by 1 +go +select top 3 config from ..sysconfigures order by 1 +go +select top 3 config from ...sysconfigures order by 1 +go +select top 3 config from dbo.sysconfigures order by 1 +go +select top 3 config from .dbo.sysconfigures order by 1 +go +select top 3 config from ..dbo.sysconfigures order by 1 +go +select top 3 config from master.dbo.sysconfigures order by 1 +go +select top 3 config from .master.dbo.sysconfigures order by 1 +go +select top 3 config from master.sys.sysconfigures order by 1 +go +select top 3 config from .master.sys.sysconfigures order by 1 +go +select top 3 config from master..sysconfigures order by 1 +go +select top 3 config from .master..sysconfigures order by 1 +go +select top 3 config from tempdb.dbo.sysconfigures order by 1 +go +select top 3 config from .tempdb.dbo.sysconfigures order by 1 +go +select top 3 config from tempdb.sys.sysconfigures order by 1 +go +select top 3 config from .tempdb.sys.sysconfigures order by 1 +go +select top 3 config from tempdb..sysconfigures order by 1 +go +select top 3 config from .tempdb..sysconfigures order by 1 +go +select top 3 config from myschematest_mydb.dbo.sysconfigures order by 1 +go +select top 3 config from .myschematest_mydb.dbo.sysconfigures order by 1 +go +select top 3 config from myschematest_mydb.sys.sysconfigures order by 1 +go +select top 3 config from .myschematest_mydb.sys.sysconfigures order by 1 +go +select top 3 config from myschematest_mydb..sysconfigures order by 1 +go +select top 3 config from .myschematest_mydb..sysconfigures order by 1 +go +select top 3 config from syscurconfigs order by 1 +go +select top 3 config from .syscurconfigs order by 1 +go +select top 3 config from ..syscurconfigs order by 1 +go +select top 3 config from ...syscurconfigs order by 1 +go +select top 3 config from dbo.syscurconfigs order by 1 +go +select top 3 config from .dbo.syscurconfigs order by 1 +go +select top 3 config from ..dbo.syscurconfigs order by 1 +go +select top 3 config from master.dbo.syscurconfigs order by 1 +go +select top 3 config from .master.dbo.syscurconfigs order by 1 +go +select top 3 config from master.sys.syscurconfigs order by 1 +go +select top 3 config from .master.sys.syscurconfigs order by 1 +go +select top 3 config from master..syscurconfigs order by 1 +go +select top 3 config from .master..syscurconfigs order by 1 +go +select top 3 config from tempdb.dbo.syscurconfigs order by 1 +go +select top 3 config from .tempdb.dbo.syscurconfigs order by 1 +go +select top 3 config from tempdb.sys.syscurconfigs order by 1 +go +select top 3 config from .tempdb.sys.syscurconfigs order by 1 +go +select top 3 config from tempdb..syscurconfigs order by 1 +go +select top 3 config from .tempdb..syscurconfigs order by 1 +go +select top 3 config from myschematest_mydb.dbo.syscurconfigs order by 1 +go +select top 3 config from .myschematest_mydb.dbo.syscurconfigs order by 1 +go +select top 3 config from myschematest_mydb.sys.syscurconfigs order by 1 +go +select top 3 config from .myschematest_mydb.sys.syscurconfigs order by 1 +go +select top 3 config from myschematest_mydb..syscurconfigs order by 1 +go +select top 3 config from .myschematest_mydb..syscurconfigs order by 1 +go +select top 3 alias from syslanguages order by 1 +go +select top 3 alias from .syslanguages order by 1 +go +select top 3 alias from ..syslanguages order by 1 +go +select top 3 alias from ...syslanguages order by 1 +go +select top 3 alias from dbo.syslanguages order by 1 +go +select top 3 alias from .dbo.syslanguages order by 1 +go +select top 3 alias from ..dbo.syslanguages order by 1 +go +select top 3 alias from master.dbo.syslanguages order by 1 +go +select top 3 alias from .master.dbo.syslanguages order by 1 +go +select top 3 alias from master.sys.syslanguages order by 1 +go +select top 3 alias from .master.sys.syslanguages order by 1 +go +select top 3 alias from master..syslanguages order by 1 +go +select top 3 alias from .master..syslanguages order by 1 +go +select top 3 alias from tempdb.dbo.syslanguages order by 1 +go +select top 3 alias from .tempdb.dbo.syslanguages order by 1 +go +select top 3 alias from tempdb.sys.syslanguages order by 1 +go +select top 3 alias from .tempdb.sys.syslanguages order by 1 +go +select top 3 alias from tempdb..syslanguages order by 1 +go +select top 3 alias from .tempdb..syslanguages order by 1 +go +select top 3 alias from myschematest_mydb.dbo.syslanguages order by 1 +go +select top 3 alias from .myschematest_mydb.dbo.syslanguages order by 1 +go +select top 3 alias from myschematest_mydb.sys.syslanguages order by 1 +go +select top 3 alias from .myschematest_mydb.sys.syslanguages order by 1 +go +select top 3 alias from myschematest_mydb..syslanguages order by 1 +go +select top 3 alias from .myschematest_mydb..syslanguages order by 1 +go +select name from syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .syslogins where name like 'login_myschematest_%' order by 1 +go +select name from ..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from ...syslogins where name like 'login_myschematest_%' order by 1 +go +select name from dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from ..dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from master..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .master..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +select 0 from sysprocesses where 0 = 1 order by 1 +go +select 0 from .sysprocesses where 0 = 1 order by 1 +go +select 0 from ..sysprocesses where 0 = 1 order by 1 +go +select 0 from ...sysprocesses where 0 = 1 order by 1 +go +select 0 from dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from ..dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from master.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .master.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from master.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from .master.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from master..sysprocesses where 0 = 1 order by 1 +go +select 0 from .master..sysprocesses where 0 = 1 order by 1 +go +select 0 from tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from .tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from tempdb..sysprocesses where 0 = 1 order by 1 +go +select 0 from .tempdb..sysprocesses where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +select object_name(id) from syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ...syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select 0 from sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .sysforeignkeys where 0 = 1 order by 1 +go +select 0 from ..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from ...sysforeignkeys where 0 = 1 order by 1 +go +select 0 from dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from ..dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from master.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .master.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from master..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .master..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from tempdb..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .tempdb..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +select object_name(id) from sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ...sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_name(id) from sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ...sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select schema_name(uid), object_name(id) from myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select name from systypes where name like 'type_myschematest_%' order by 1 +go +select name from .systypes where name like 'type_myschematest_%' order by 1 +go +select name from ..systypes where name like 'type_myschematest_%' order by 1 +go +select name from ...systypes where name like 'type_myschematest_%' order by 1 +go +select name from dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from ..dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from master..systypes where name like 'type_myschematest_%' order by 1 +go +select name from .master..systypes where name like 'type_myschematest_%' order by 1 +go +select name from myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +select name from .myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +select name from sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .sysusers where name like 'user_myschematest_%' order by 1 +go +select name from ..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from ...sysusers where name like 'user_myschematest_%' order by 1 +go +select name from dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from ..dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from master..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .master..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +exec p_myschematest +go +select name from vw_myschematest order by 1 +go + +-- non-catalog table +select * from master..tb_myschematest_master +go +select * from .master..tb_myschematest_master +go +go +select * from master.dbo.tb_myschematest_master +go +select * from .master.dbo.tb_myschematest_master +go + +select * from tempdb..tb_myschematest_tempdb +go +select * from .tempdb..tb_myschematest_tempdb +go +go +select * from tempdb.dbo.tb_myschematest_tempdb +go +select * from .tempdb.dbo.tb_myschematest_tempdb +go + +select * from myschematest_mydb..tb_myschematest_mydb +go +select * from .myschematest_mydb..tb_myschematest_mydb +go +go +select * from myschematest_mydb.dbo.tb_myschematest_mydb +go +select * from .myschematest_mydb.dbo.tb_myschematest_mydb +go + +-- negative tests +select count(*) from master.myschema.sysobjects +go +select count(*) from tempdb.myschema.sysobjects +go +select count(*) from myschematest_mydb.myschema.sysobjects +go + + +use tempdb +go +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select distinct type from syscharsets order by 1 +go +select distinct type from .syscharsets order by 1 +go +select distinct type from ..syscharsets order by 1 +go +select distinct type from ...syscharsets order by 1 +go +select distinct type from dbo.syscharsets order by 1 +go +select distinct type from .dbo.syscharsets order by 1 +go +select distinct type from ..dbo.syscharsets order by 1 +go +select distinct type from master.dbo.syscharsets order by 1 +go +select distinct type from .master.dbo.syscharsets order by 1 +go +select distinct type from master.sys.syscharsets order by 1 +go +select distinct type from .master.sys.syscharsets order by 1 +go +select distinct type from master..syscharsets order by 1 +go +select distinct type from .master..syscharsets order by 1 +go +select distinct type from tempdb.dbo.syscharsets order by 1 +go +select distinct type from .tempdb.dbo.syscharsets order by 1 +go +select distinct type from tempdb.sys.syscharsets order by 1 +go +select distinct type from .tempdb.sys.syscharsets order by 1 +go +select distinct type from tempdb..syscharsets order by 1 +go +select distinct type from .tempdb..syscharsets order by 1 +go +select distinct type from myschematest_mydb.dbo.syscharsets order by 1 +go +select distinct type from .myschematest_mydb.dbo.syscharsets order by 1 +go +select distinct type from myschematest_mydb.sys.syscharsets order by 1 +go +select distinct type from .myschematest_mydb.sys.syscharsets order by 1 +go +select distinct type from myschematest_mydb..syscharsets order by 1 +go +select distinct type from .myschematest_mydb..syscharsets order by 1 +go +select top 3 config from sysconfigures order by 1 +go +select top 3 config from .sysconfigures order by 1 +go +select top 3 config from ..sysconfigures order by 1 +go +select top 3 config from ...sysconfigures order by 1 +go +select top 3 config from dbo.sysconfigures order by 1 +go +select top 3 config from .dbo.sysconfigures order by 1 +go +select top 3 config from ..dbo.sysconfigures order by 1 +go +select top 3 config from master.dbo.sysconfigures order by 1 +go +select top 3 config from .master.dbo.sysconfigures order by 1 +go +select top 3 config from master.sys.sysconfigures order by 1 +go +select top 3 config from .master.sys.sysconfigures order by 1 +go +select top 3 config from master..sysconfigures order by 1 +go +select top 3 config from .master..sysconfigures order by 1 +go +select top 3 config from tempdb.dbo.sysconfigures order by 1 +go +select top 3 config from .tempdb.dbo.sysconfigures order by 1 +go +select top 3 config from tempdb.sys.sysconfigures order by 1 +go +select top 3 config from .tempdb.sys.sysconfigures order by 1 +go +select top 3 config from tempdb..sysconfigures order by 1 +go +select top 3 config from .tempdb..sysconfigures order by 1 +go +select top 3 config from myschematest_mydb.dbo.sysconfigures order by 1 +go +select top 3 config from .myschematest_mydb.dbo.sysconfigures order by 1 +go +select top 3 config from myschematest_mydb.sys.sysconfigures order by 1 +go +select top 3 config from .myschematest_mydb.sys.sysconfigures order by 1 +go +select top 3 config from myschematest_mydb..sysconfigures order by 1 +go +select top 3 config from .myschematest_mydb..sysconfigures order by 1 +go +select top 3 config from syscurconfigs order by 1 +go +select top 3 config from .syscurconfigs order by 1 +go +select top 3 config from ..syscurconfigs order by 1 +go +select top 3 config from ...syscurconfigs order by 1 +go +select top 3 config from dbo.syscurconfigs order by 1 +go +select top 3 config from .dbo.syscurconfigs order by 1 +go +select top 3 config from ..dbo.syscurconfigs order by 1 +go +select top 3 config from master.dbo.syscurconfigs order by 1 +go +select top 3 config from .master.dbo.syscurconfigs order by 1 +go +select top 3 config from master.sys.syscurconfigs order by 1 +go +select top 3 config from .master.sys.syscurconfigs order by 1 +go +select top 3 config from master..syscurconfigs order by 1 +go +select top 3 config from .master..syscurconfigs order by 1 +go +select top 3 config from tempdb.dbo.syscurconfigs order by 1 +go +select top 3 config from .tempdb.dbo.syscurconfigs order by 1 +go +select top 3 config from tempdb.sys.syscurconfigs order by 1 +go +select top 3 config from .tempdb.sys.syscurconfigs order by 1 +go +select top 3 config from tempdb..syscurconfigs order by 1 +go +select top 3 config from .tempdb..syscurconfigs order by 1 +go +select top 3 config from myschematest_mydb.dbo.syscurconfigs order by 1 +go +select top 3 config from .myschematest_mydb.dbo.syscurconfigs order by 1 +go +select top 3 config from myschematest_mydb.sys.syscurconfigs order by 1 +go +select top 3 config from .myschematest_mydb.sys.syscurconfigs order by 1 +go +select top 3 config from myschematest_mydb..syscurconfigs order by 1 +go +select top 3 config from .myschematest_mydb..syscurconfigs order by 1 +go +select top 3 alias from syslanguages order by 1 +go +select top 3 alias from .syslanguages order by 1 +go +select top 3 alias from ..syslanguages order by 1 +go +select top 3 alias from ...syslanguages order by 1 +go +select top 3 alias from dbo.syslanguages order by 1 +go +select top 3 alias from .dbo.syslanguages order by 1 +go +select top 3 alias from ..dbo.syslanguages order by 1 +go +select top 3 alias from master.dbo.syslanguages order by 1 +go +select top 3 alias from .master.dbo.syslanguages order by 1 +go +select top 3 alias from master.sys.syslanguages order by 1 +go +select top 3 alias from .master.sys.syslanguages order by 1 +go +select top 3 alias from master..syslanguages order by 1 +go +select top 3 alias from .master..syslanguages order by 1 +go +select top 3 alias from tempdb.dbo.syslanguages order by 1 +go +select top 3 alias from .tempdb.dbo.syslanguages order by 1 +go +select top 3 alias from tempdb.sys.syslanguages order by 1 +go +select top 3 alias from .tempdb.sys.syslanguages order by 1 +go +select top 3 alias from tempdb..syslanguages order by 1 +go +select top 3 alias from .tempdb..syslanguages order by 1 +go +select top 3 alias from myschematest_mydb.dbo.syslanguages order by 1 +go +select top 3 alias from .myschematest_mydb.dbo.syslanguages order by 1 +go +select top 3 alias from myschematest_mydb.sys.syslanguages order by 1 +go +select top 3 alias from .myschematest_mydb.sys.syslanguages order by 1 +go +select top 3 alias from myschematest_mydb..syslanguages order by 1 +go +select top 3 alias from .myschematest_mydb..syslanguages order by 1 +go +select name from syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .syslogins where name like 'login_myschematest_%' order by 1 +go +select name from ..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from ...syslogins where name like 'login_myschematest_%' order by 1 +go +select name from dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from ..dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from master..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .master..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +select 0 from sysprocesses where 0 = 1 order by 1 +go +select 0 from .sysprocesses where 0 = 1 order by 1 +go +select 0 from ..sysprocesses where 0 = 1 order by 1 +go +select 0 from ...sysprocesses where 0 = 1 order by 1 +go +select 0 from dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from ..dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from master.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .master.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from master.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from .master.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from master..sysprocesses where 0 = 1 order by 1 +go +select 0 from .master..sysprocesses where 0 = 1 order by 1 +go +select 0 from tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from .tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from tempdb..sysprocesses where 0 = 1 order by 1 +go +select 0 from .tempdb..sysprocesses where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +select object_name(id) from syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ...syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select 0 from sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .sysforeignkeys where 0 = 1 order by 1 +go +select 0 from ..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from ...sysforeignkeys where 0 = 1 order by 1 +go +select 0 from dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from ..dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from master.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .master.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from master..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .master..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from tempdb..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .tempdb..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +select object_name(id) from sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ...sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_name(id) from sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ...sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from ..dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select schema_name(uid), object_name(id) from myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select name from master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from master..systypes where name like 'type_myschematest_%' order by 1 +go +select name from .master..systypes where name like 'type_myschematest_%' order by 1 +go +select name from myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +select name from .myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +select name from master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from master..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .master..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +exec p_myschematest +go +select name from vw_myschematest order by 1 +go + +-- non-catalog table +select * from master..tb_myschematest_master +go +select * from .master..tb_myschematest_master +go +go +select * from master.dbo.tb_myschematest_master +go +select * from .master.dbo.tb_myschematest_master +go + +select * from tempdb..tb_myschematest_tempdb +go +select * from .tempdb..tb_myschematest_tempdb +go +go +select * from tempdb.dbo.tb_myschematest_tempdb +go +select * from .tempdb.dbo.tb_myschematest_tempdb +go + +select * from myschematest_mydb..tb_myschematest_mydb +go +select * from .myschematest_mydb..tb_myschematest_mydb +go +go +select * from myschematest_mydb.dbo.tb_myschematest_mydb +go +select * from .myschematest_mydb.dbo.tb_myschematest_mydb +go + +-- negative tests +select count(*) from master.myschema.sysobjects +go +select count(*) from tempdb.myschema.sysobjects +go +select count(*) from myschematest_mydb.myschema.sysobjects +go + +use myschematest_mydb +go +select name from sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from ..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from ...sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from ..dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .master.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .master.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .master..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .tempdb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .tempdb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .tempdb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .myschematest_mydb.dbo.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .myschematest_mydb.sys.sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select name from .myschematest_mydb..sysdatabases where name = 'myschematest_mydb' order by 1 +go +select distinct type from syscharsets order by 1 +go +select distinct type from .syscharsets order by 1 +go +select distinct type from ..syscharsets order by 1 +go +select distinct type from ...syscharsets order by 1 +go +select distinct type from dbo.syscharsets order by 1 +go +select distinct type from .dbo.syscharsets order by 1 +go +select distinct type from ..dbo.syscharsets order by 1 +go +select distinct type from master.dbo.syscharsets order by 1 +go +select distinct type from .master.dbo.syscharsets order by 1 +go +select distinct type from master.sys.syscharsets order by 1 +go +select distinct type from .master.sys.syscharsets order by 1 +go +select distinct type from master..syscharsets order by 1 +go +select distinct type from .master..syscharsets order by 1 +go +select distinct type from tempdb.dbo.syscharsets order by 1 +go +select distinct type from .tempdb.dbo.syscharsets order by 1 +go +select distinct type from tempdb.sys.syscharsets order by 1 +go +select distinct type from .tempdb.sys.syscharsets order by 1 +go +select distinct type from tempdb..syscharsets order by 1 +go +select distinct type from .tempdb..syscharsets order by 1 +go +select distinct type from myschematest_mydb.dbo.syscharsets order by 1 +go +select distinct type from .myschematest_mydb.dbo.syscharsets order by 1 +go +select distinct type from myschematest_mydb.sys.syscharsets order by 1 +go +select distinct type from .myschematest_mydb.sys.syscharsets order by 1 +go +select distinct type from myschematest_mydb..syscharsets order by 1 +go +select distinct type from .myschematest_mydb..syscharsets order by 1 +go +select top 3 config from sysconfigures order by 1 +go +select top 3 config from .sysconfigures order by 1 +go +select top 3 config from ..sysconfigures order by 1 +go +select top 3 config from ...sysconfigures order by 1 +go +select top 3 config from dbo.sysconfigures order by 1 +go +select top 3 config from .dbo.sysconfigures order by 1 +go +select top 3 config from ..dbo.sysconfigures order by 1 +go +select top 3 config from master.dbo.sysconfigures order by 1 +go +select top 3 config from .master.dbo.sysconfigures order by 1 +go +select top 3 config from master.sys.sysconfigures order by 1 +go +select top 3 config from .master.sys.sysconfigures order by 1 +go +select top 3 config from master..sysconfigures order by 1 +go +select top 3 config from .master..sysconfigures order by 1 +go +select top 3 config from tempdb.dbo.sysconfigures order by 1 +go +select top 3 config from .tempdb.dbo.sysconfigures order by 1 +go +select top 3 config from tempdb.sys.sysconfigures order by 1 +go +select top 3 config from .tempdb.sys.sysconfigures order by 1 +go +select top 3 config from tempdb..sysconfigures order by 1 +go +select top 3 config from .tempdb..sysconfigures order by 1 +go +select top 3 config from myschematest_mydb.dbo.sysconfigures order by 1 +go +select top 3 config from .myschematest_mydb.dbo.sysconfigures order by 1 +go +select top 3 config from myschematest_mydb.sys.sysconfigures order by 1 +go +select top 3 config from .myschematest_mydb.sys.sysconfigures order by 1 +go +select top 3 config from myschematest_mydb..sysconfigures order by 1 +go +select top 3 config from .myschematest_mydb..sysconfigures order by 1 +go +select top 3 config from syscurconfigs order by 1 +go +select top 3 config from .syscurconfigs order by 1 +go +select top 3 config from ..syscurconfigs order by 1 +go +select top 3 config from ...syscurconfigs order by 1 +go +select top 3 config from dbo.syscurconfigs order by 1 +go +select top 3 config from .dbo.syscurconfigs order by 1 +go +select top 3 config from ..dbo.syscurconfigs order by 1 +go +select top 3 config from master.dbo.syscurconfigs order by 1 +go +select top 3 config from .master.dbo.syscurconfigs order by 1 +go +select top 3 config from master.sys.syscurconfigs order by 1 +go +select top 3 config from .master.sys.syscurconfigs order by 1 +go +select top 3 config from master..syscurconfigs order by 1 +go +select top 3 config from .master..syscurconfigs order by 1 +go +select top 3 config from tempdb.dbo.syscurconfigs order by 1 +go +select top 3 config from .tempdb.dbo.syscurconfigs order by 1 +go +select top 3 config from tempdb.sys.syscurconfigs order by 1 +go +select top 3 config from .tempdb.sys.syscurconfigs order by 1 +go +select top 3 config from tempdb..syscurconfigs order by 1 +go +select top 3 config from .tempdb..syscurconfigs order by 1 +go +select top 3 config from myschematest_mydb.dbo.syscurconfigs order by 1 +go +select top 3 config from .myschematest_mydb.dbo.syscurconfigs order by 1 +go +select top 3 config from myschematest_mydb.sys.syscurconfigs order by 1 +go +select top 3 config from .myschematest_mydb.sys.syscurconfigs order by 1 +go +select top 3 config from myschematest_mydb..syscurconfigs order by 1 +go +select top 3 config from .myschematest_mydb..syscurconfigs order by 1 +go +select top 3 alias from syslanguages order by 1 +go +select top 3 alias from .syslanguages order by 1 +go +select top 3 alias from ..syslanguages order by 1 +go +select top 3 alias from ...syslanguages order by 1 +go +select top 3 alias from dbo.syslanguages order by 1 +go +select top 3 alias from .dbo.syslanguages order by 1 +go +select top 3 alias from ..dbo.syslanguages order by 1 +go +select top 3 alias from master.dbo.syslanguages order by 1 +go +select top 3 alias from .master.dbo.syslanguages order by 1 +go +select top 3 alias from master.sys.syslanguages order by 1 +go +select top 3 alias from .master.sys.syslanguages order by 1 +go +select top 3 alias from master..syslanguages order by 1 +go +select top 3 alias from .master..syslanguages order by 1 +go +select top 3 alias from tempdb.dbo.syslanguages order by 1 +go +select top 3 alias from .tempdb.dbo.syslanguages order by 1 +go +select top 3 alias from tempdb.sys.syslanguages order by 1 +go +select top 3 alias from .tempdb.sys.syslanguages order by 1 +go +select top 3 alias from tempdb..syslanguages order by 1 +go +select top 3 alias from .tempdb..syslanguages order by 1 +go +select top 3 alias from myschematest_mydb.dbo.syslanguages order by 1 +go +select top 3 alias from .myschematest_mydb.dbo.syslanguages order by 1 +go +select top 3 alias from myschematest_mydb.sys.syslanguages order by 1 +go +select top 3 alias from .myschematest_mydb.sys.syslanguages order by 1 +go +select top 3 alias from myschematest_mydb..syslanguages order by 1 +go +select top 3 alias from .myschematest_mydb..syslanguages order by 1 +go +select name from syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .syslogins where name like 'login_myschematest_%' order by 1 +go +select name from ..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from ...syslogins where name like 'login_myschematest_%' order by 1 +go +select name from dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from ..dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .master.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .master.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from master..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .master..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .tempdb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .tempdb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .tempdb..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .myschematest_mydb.dbo.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .myschematest_mydb.sys.syslogins where name like 'login_myschematest_%' order by 1 +go +select name from myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +select name from .myschematest_mydb..syslogins where name like 'login_myschematest_%' order by 1 +go +select 0 from sysprocesses where 0 = 1 order by 1 +go +select 0 from .sysprocesses where 0 = 1 order by 1 +go +select 0 from ..sysprocesses where 0 = 1 order by 1 +go +select 0 from ...sysprocesses where 0 = 1 order by 1 +go +select 0 from dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from ..dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from master.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .master.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from master.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from .master.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from master..sysprocesses where 0 = 1 order by 1 +go +select 0 from .master..sysprocesses where 0 = 1 order by 1 +go +select 0 from tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .tempdb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from .tempdb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from tempdb..sysprocesses where 0 = 1 order by 1 +go +select 0 from .tempdb..sysprocesses where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.dbo.sysprocesses where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.sys.sysprocesses where 0 = 1 order by 1 +go +select 0 from myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb..sysprocesses where 0 = 1 order by 1 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ...syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ..dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_name(id) from master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..syscolumns where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select 0 from sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .sysforeignkeys where 0 = 1 order by 1 +go +select 0 from ..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from ...sysforeignkeys where 0 = 1 order by 1 +go +select 0 from dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from ..dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .master.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from master.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .master.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from master..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .master..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .tempdb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .tempdb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from tempdb..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .tempdb..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.dbo.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb.sys.sysforeignkeys where 0 = 1 order by 1 +go +select 0 from myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +select 0 from .myschematest_mydb..sysforeignkeys where 0 = 1 order by 1 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ...sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from ..dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_name(id) from master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.dbo.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb.sys.sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_schema_name(id, db_id('myschematest_mydb')), object_name(id) from .myschematest_mydb..sysindexes where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from ..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from ...sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from ..dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select object_name(id) from master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .master..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select object_name(id) from .tempdb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1 +go +select schema_name(uid), object_name(id) from myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .myschematest_mydb.dbo.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .myschematest_mydb.sys.sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select schema_name(uid), object_name(id) from .myschematest_mydb..sysobjects where object_name(id) like 'tb_myschematest_%' order by 1,2 +go +select name from systypes where name like 'type_myschematest_%' order by 1 +go +select name from .systypes where name like 'type_myschematest_%' order by 1 +go +select name from ..systypes where name like 'type_myschematest_%' order by 1 +go +select name from ...systypes where name like 'type_myschematest_%' order by 1 +go +select name from dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from ..dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .master.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .master.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from master..systypes where name like 'type_myschematest_%' order by 1 +go +select name from .master..systypes where name like 'type_myschematest_%' order by 1 +go +select name from myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .myschematest_mydb.dbo.systypes where name like 'type_myschematest_%' order by 1 +go +select name from myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from .myschematest_mydb.sys.systypes where name like 'type_myschematest_%' order by 1 +go +select name from myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +select name from .myschematest_mydb..systypes where name like 'type_myschematest_%' order by 1 +go +select name from sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .sysusers where name like 'user_myschematest_%' order by 1 +go +select name from ..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from ...sysusers where name like 'user_myschematest_%' order by 1 +go +select name from dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from ..dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .master.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .master.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from master..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .master..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .myschematest_mydb.dbo.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .myschematest_mydb.sys.sysusers where name like 'user_myschematest_%' order by 1 +go +select name from myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +select name from .myschematest_mydb..sysusers where name like 'user_myschematest_%' order by 1 +go +exec p_myschematest +go +select name from vw_myschematest order by 1 +go + +-- non-catalog table +select * from master..tb_myschematest_master +go +select * from .master..tb_myschematest_master +go +go +select * from master.dbo.tb_myschematest_master +go +select * from .master.dbo.tb_myschematest_master +go + +select * from tempdb..tb_myschematest_tempdb +go +select * from .tempdb..tb_myschematest_tempdb +go +go +select * from tempdb.dbo.tb_myschematest_tempdb +go +select * from .tempdb.dbo.tb_myschematest_tempdb +go + +select * from myschematest_mydb..tb_myschematest_mydb +go +select * from .myschematest_mydb..tb_myschematest_mydb +go +go +select * from myschematest_mydb.dbo.tb_myschematest_mydb +go +select * from .myschematest_mydb.dbo.tb_myschematest_mydb +go + +-- negative tests +select count(*) from master.myschema.sysobjects +go +select count(*) from tempdb.myschema.sysobjects +go +select count(*) from myschematest_mydb.myschema.sysobjects +go + + +-- test for correct resolution of 'object' and '.object' notation in case of a non-dbo default schema +go +-- tsql user=login_myschematest_mydb password=12345678 +use myschematest_mydb +go +select db_name(), user_name(), suser_name() +go + +-- CORRECT: should resolve to dbo.tb_myschematest_mydb +select * from dbo.tb_myschematest_mydb +go + +-- CORRECT: should resolve to myschema.tb_myschematest_mydb +select * from tb_myschematest_mydb +go + +-- CORRECT: should resolve to myschema.tb_myschematest_mydb +select * from .tb_myschematest_mydb +go + +-- WRONG: should resolve to myschema.tb_myschematest_mydb but currently (incorrectly) resolves to dbo.tb_myschematest_mydb +-- this needs to be addressed in a different fix, for BABEL-5050 +select * from myschematest_mydb..tb_myschematest_mydb +go +select * from .myschematest_mydb..tb_myschematest_mydb +go \ No newline at end of file diff --git a/test/JDBC/input/charindex_and_replace_CIAI_collations.mix b/test/JDBC/input/charindex_and_replace_CIAI_collations.mix new file mode 100644 index 00000000000..43c01bd5259 --- /dev/null +++ b/test/JDBC/input/charindex_and_replace_CIAI_collations.mix @@ -0,0 +1,241 @@ +/* CHARINDEX WITH CI_AI COLLATIONS */ + +-- tsql +CREATE TABLE #BABEL_4850_TEMP(id NVARCHAR(100)) +GO +CREATE TABLE BABEL_4850_T(id NVARCHAR(100)) +GO + +INSERT INTO #BABEL_4850_TEMP VALUES ('AAAAAE'), ('AeAAAaE'), ('AeAAAaE'), ('AAAAAABBBBBBBEEEEEEAAAAA') +INSERT INTO BABEL_4850_T VALUES ('AAAAAE'), ('AeAAAaE'), ('AeAAAaE'), ('AAAAAABBBBBBBEEEEEEAAAAA') +GO + +/* CI_AS */ + +/* Cases where single character is equal to two characters */ +SELECT CHARINDEX('Æ','AAAAAE' COLLATE Latin1_General_CI_AI) +SELECT CHARINDEX('Æ','AeAAAaE' COLLATE Latin1_General_CI_AI, 2) +SELECT CHARINDEX('Æ','AeAAAaE' COLLATE Latin1_General_CI_AI, 1) +SELECT CHARINDEX('Æ', 'AAAAAABBBBBBBEEEEEEAAAAA' COLLATE Latin1_General_CI_AI); +SELECT CHARINDEX('ÆA','AeAEAAAAaE' COLLATE Latin1_General_CI_AI, 1) +GO + +SELECT CHARINDEX('Æ', id COLLATE Latin1_General_CI_AI) FROM #BABEL_4850_TEMP +GO +SELECT CHARINDEX('Æ', id COLLATE Latin1_General_CI_AI) FROM BABEL_4850_T +GO + +/* BASIC TEST CASES */ +/* These should find a result */ +SELECT CHARINDEX('cat', 'The cat is on the mat' COLLATE Latin1_General_CI_AI, 1); +SELECT CHARINDEX('cafe', 'The Café is cozy' COLLATE Latin1_General_CI_AI, 1); +/* These should not find a result */ +SELECT CHARINDEX('dog', 'The cat is on the mat' COLLATE Latin1_General_CI_AI, 1); +SELECT CHARINDEX('caé', 'The café is cozy' COLLATE Latin1_General_CI_AI, 1); +GO + +/* empty arguments */ +SELECT CHARINDEX('', 'The café is cozy' COLLATE Latin1_General_CI_AI, 1); +SELECT CHARINDEX('café', '' COLLATE Latin1_General_CI_AI, 1); +SELECT CHARINDEX('', '' COLLATE Latin1_General_CI_AI, 1) +GO + +/* case sensitivity */ +SELECT CHARINDEX('tHe Cať', 'Where is The càt ???' COLLATE Latin1_General_CI_AI); +SELECT CHARINDEX('caT', 'The Cat̤ is on the mat' COLLATE Latin1_General_CI_AI); +GO + +SELECT CHARINDEX('cat', 'The cat is on the mat cAť' COLLATE Latin1_General_CI_AI, 6) +SELECT CHARINDEX('cat', 'The cat is on the mat' COLLATE Latin1_General_CI_AI, 30) +GO + +/* REPLACE WITH CI_AI COLLATIONS */ + +/* BASIC TEST CASES */ +/* These should find a result */ +SELECT REPLACE('This café is cozy.', 'café', 'coffee' COLLATE Latin1_General_CI_AI) +SELECT REPLACE('The café is open for business.', 'café is', 'coffee shops are' COLLATE Latin1_General_CI_AI) +SELECT REPLACE('This café is cozy.', 'tea', 'coffee' COLLATE Latin1_General_CI_AI) +SELECT REPLACE('The café serves café au lait.', 'café', 'coffee' COLLATE Latin1_General_CI_AI) +GO + +SELECT REPLACE('café is cozy.', 'café', 'coffee' COLLATE Latin1_General_CI_AI) +SELECT REPLACE('The café is good.', 'is', 'was' COLLATE Latin1_General_CI_AI) +GO + +SELECT REPLACE(REPLACE('The café is open.', 'café', 'coffee' COLLATE Latin1_General_CI_AI), 'open', 'closed' COLLATE Latin1_General_CI_AI) +GO + +SELECT REPLACE('The café is great.', 'gřeat', N'>>>>>>' COLLATE Latin1_General_CI_AI) +SELECT REPLACE('This café is cozy.', 'café', N'cAfë' COLLATE Latin1_General_CI_AI) +GO + +SELECT REPLACE('This café is cozy.', '', 'coffee' COLLATE Latin1_General_CI_AI) +SELECT REPLACE('', '', 'coffee' COLLATE Latin1_General_CI_AI) +SELECT REPLACE('This café is cozy.', 'café', '' COLLATE Latin1_General_CI_AI) +GO + +SELECT REPLACE('This café is cozy.', 'CAFÉ', 'coffee' COLLATE Latin1_General_CI_AI) +GO + +SELECT REPLACE('This café is café.', 'café', 'coffee' COLLATE Latin1_General_CI_AI) +GO + +SELECT REPLACE('This café is !.', '!', 'coffee' COLLATE Latin1_General_CI_AI) +GO + +SELECT REPLACE('This café is cozy.', ' ', ' ' COLLATE Latin1_General_CI_AI) +SELECT REPLACE(N'The café is!.', '!', '@@' COLLATE Latin1_General_CI_AI) +GO + +/* overlapping case */ +SELECT REPLACE ('ABCABCABCABCABC','abcÀBć' collate Latin1_General_CI_AI, 'abcabc') +GO + +/* Cases where single character is equal to two characters */ +SELECT REPLACE ('aaaaaaÆaaaaaaÆaaaa','AE' collate Latin1_General_CI_AI, '!---!') +SELECT REPLACE ('ÆAEaaaaaaÆ','AE' collate Latin1_General_CI_AI, '!---!') +SELECT REPLACE ('eeeeeeeeeAAAAAA','AE' collate Latin1_General_CI_AI, '!---!') +GO + +SELECT REPLACE(id, 'Æ' COLLATE Latin1_General_CI_AI, '!---!') FROM #BABEL_4850_TEMP +GO +SELECT REPLACE(id, 'Æ' COLLATE Latin1_General_CI_AI, '!---!') FROM BABEL_4850_T +GO + + + + +/* CS_AS */ + +/* CHARINDEX WITH CS_AI COLLATIONS */ + +SELECT CHARINDEX('Æ', id COLLATE Latin1_General_CS_AI) FROM #BABEL_4850_TEMP +GO +SELECT CHARINDEX('Æ', id COLLATE Latin1_General_CS_AI) FROM BABEL_4850_T +GO + +/* Cases where single character is equal to two characters */ +SELECT CHARINDEX('Æ','AAAAAE' COLLATE Latin1_General_CS_AI) +SELECT CHARINDEX('Æ','AeAAAaE' COLLATE Latin1_General_CS_AI, 2) +SELECT CHARINDEX('Æ','AeAAAaE' COLLATE Latin1_General_CS_AI, 1) +SELECT CHARINDEX('Æ', 'AAAAAABBBBBBBEEEEEEAAAAA' COLLATE Latin1_General_CS_AI); +SELECT CHARINDEX('ÆA','AeAEAAAAaE' COLLATE Latin1_General_CS_AI, 1) +GO + +/* BASIC TEST CASES */ +/* These should find a result */ +SELECT CHARINDEX('cat', 'The cat is on the mat' COLLATE Latin1_General_CS_AI, 1); +SELECT CHARINDEX('cafe', 'The Café is cozy' COLLATE Latin1_General_CS_AI, 1); +/* These should not find a result */ +SELECT CHARINDEX('dog', 'The cat is on the mat' COLLATE Latin1_General_CS_AI, 1); +SELECT CHARINDEX('caé', 'The café is cozy' COLLATE Latin1_General_CS_AI, 1); +GO + +/* empty arguments */ +SELECT CHARINDEX('', 'The café is cozy' COLLATE Latin1_General_CS_AI, 1); +SELECT CHARINDEX('café', '' COLLATE Latin1_General_CS_AI, 1); +SELECT CHARINDEX('', '' COLLATE Latin1_General_CS_AI, 1) +GO + +/* case sensitivity */ +SELECT CHARINDEX('tHe Cať', 'Where is The càt ???' COLLATE Latin1_General_CS_AI); +SELECT CHARINDEX('caT', 'The Cat̤ is on the mat' COLLATE Latin1_General_CS_AI); +GO + +SELECT CHARINDEX('cat', 'The cat is on the mat cAť' COLLATE Latin1_General_CS_AI, 6) +SELECT CHARINDEX('cat', 'The cat is on the mat' COLLATE Latin1_General_CS_AI, 30) +GO + +/* REPLACE WITH CS_AI COLLATIONS */ + +/* BASIC TEST CASES */ +/* These should find a result */ +SELECT REPLACE('This café is cozy.', 'café', 'coffee' COLLATE Latin1_General_CS_AI) +SELECT REPLACE('The café is open for business.', 'café is', 'coffee shops are' COLLATE Latin1_General_CS_AI) +SELECT REPLACE('This café is cozy.', 'tea', 'coffee' COLLATE Latin1_General_CS_AI) +SELECT REPLACE('The café serves café au lait.', 'café', 'coffee' COLLATE Latin1_General_CS_AI) +GO + +SELECT REPLACE('café is cozy.', 'café', 'coffee' COLLATE Latin1_General_CS_AI) +SELECT REPLACE('The café is good.', 'is', 'was' COLLATE Latin1_General_CS_AI) +GO + +SELECT REPLACE(REPLACE('The café is open.', 'café', 'coffee' COLLATE Latin1_General_CS_AI), 'open', 'closed' COLLATE Latin1_General_CS_AI) +GO + +SELECT REPLACE('The café is great.', 'gřeat', N'>>>>>>' COLLATE Latin1_General_CS_AI) +SELECT REPLACE('This café is cozy.', 'café', N'cAfë' COLLATE Latin1_General_CS_AI) +GO + +SELECT REPLACE('This café is cozy.', '', 'coffee' COLLATE Latin1_General_CS_AI) +SELECT REPLACE('', '', 'coffee' COLLATE Latin1_General_CS_AI) +SELECT REPLACE('This café is cozy.', 'café', '' COLLATE Latin1_General_CS_AI) +GO + +SELECT REPLACE('This café is cozy.', 'CAFÉ', 'coffee' COLLATE Latin1_General_CS_AI) +GO + +SELECT REPLACE('This café is café.', 'café', 'coffee' COLLATE Latin1_General_CS_AI) +GO + +SELECT REPLACE('This café is !.', '!', 'coffee' COLLATE Latin1_General_CS_AI) +GO + +SELECT REPLACE('This café is cozy.', ' ', ' ' COLLATE Latin1_General_CS_AI) +SELECT REPLACE(N'The café is!.', '!', '@@' COLLATE Latin1_General_CS_AI) +GO + +/* overlapping case */ +SELECT REPLACE ('ABCABCABCABCABC','abcÀBć' collate Latin1_General_CS_AI, 'abcabc') +GO + +/* Cases where single character is equal to two characters */ +SELECT REPLACE ('aaaaaaÆaaaaaaÆaaaa','AE' collate Latin1_General_CS_AI, '!---!') +SELECT REPLACE ('ÆAEaaaaaaÆ','AE' collate Latin1_General_CS_AI, '!---!') +SELECT REPLACE ('eeeeeeeeeAAAAAA','AE' collate Latin1_General_CS_AI, '!---!') +GO + +SELECT REPLACE(id, 'Æ' COLLATE Latin1_General_CS_AI, '!---!') FROM #BABEL_4850_TEMP +GO +SELECT REPLACE(id, 'Æ' COLLATE Latin1_General_CS_AI, '!---!') FROM BABEL_4850_T +GO + +DROP TABLE BABEL_4850_T +GO + +/* Substring to find starts with surrogate pair BABEL-5169 */ +SELECT CHARINDEX(N'🙂dEf', N'abc🙂def🙂defgh🙂dEfi🙂🙂' COLLATE Latin1_General_CS_AI) +SELECT CHARINDEX(N'🙂D', N'abc🙂d🙂d🙂D' COLLATE Latin1_General_CS_AI) +SELECT CHARINDEX(N'🙂dEf', N'abc🙂defgh🙂dEfi🙂🙂' COLLATE Latin1_General_CI_AI) +SELECT CHARINDEX(N'🙂', N'abc🙂defgh🙂dEfi🙂🙂' COLLATE Latin1_General_CS_AI) +SELECT CHARINDEX(N'🙂', N'abc🙂defgh🙂dEfi🙂🙂' COLLATE Latin1_General_CI_AI) +GO + +/* Substring to find starts with surrogate pair BABEL-5169 */ +SELECT REPLACE(N'abc🙂defghi🙂🙂', N'🙂def', N'jhi🙂' COLLATE Latin1_General_CI_AI) +SELECT REPLACE(N'abc🙂🙂🙂🙂🙂defghi🙂🙂', N'🙂', N'<---->' COLLATE Latin1_General_CI_AI) +SELECT REPLACE(N'abc🙂🙂🙂🙂', N'🙂', N'<---->' COLLATE Latin1_General_CI_AI) +SELECT REPLACE(N'🙂abc🙂', N'🙂', N'<---->' COLLATE Latin1_General_CI_AI) +GO + +-- psql +CREATE COLLATION case_insensitive (provider = icu, locale = 'und-u-ks-level2', deterministic = false); +CREATE COLLATION ignore_accents (provider = icu, locale = 'nd-u-kc-true-ks-level1', deterministic = false); +GO + +CREATE TABLE mismatch_col (col1 text COLLATE case_insensitive, col2 text COLLATE ignore_accents, col3 text); +GO + +INSERT INTO mismatch_col VALUES ('abc', 'xyz', 'tde'); +GO + +SELECT REPLACE(col1, col2, col3) FROM mismatch_col +GO + +DROP TABLE mismatch_col +GO + +DROP COLLATION case_insensitive; +DROP COLLATION ignore_accents; +GO diff --git a/test/JDBC/input/collations/verify_mapping_for_remove_accents.mix b/test/JDBC/input/collations/verify_mapping_for_remove_accents.mix new file mode 100644 index 00000000000..4105b8db331 --- /dev/null +++ b/test/JDBC/input/collations/verify_mapping_for_remove_accents.mix @@ -0,0 +1,40 @@ +-- sla 100000 +-- Insert all possible UNICODE/UTF-8 valid characters +-- tsql +CREATE TABLE all_utf8_chars(col1 BYTEA, col2 TEXT) +GO + +-- psql +DO $$ +DECLARE + cnt INT:= 1; + var TEXT; +BEGIN + WHILE cnt <= 1114112 LOOP + BEGIN + var := chr(cnt); + IF var <> '\' THEN + INSERT INTO master_dbo.all_utf8_chars VALUES (cast(var as bytea), var); + ELSE + INSERT INTO master_dbo.all_utf8_chars VALUES (cast('\\' as bytea), '\'); + END IF; + EXCEPTION + WHEN program_limit_exceeded THEN + END; + cnt := cnt + 1; + END LOOP; +END; +$$; +GO + +-- tsql +-- Verify like with AI collations against all possible characters +-- except BBF_ESC_CHAR_REPLC and '[' which are special characters +SELECT COUNT(*)FROM all_utf8_chars + WHERE col1 != cast(chr(65535) as bytea) AND col2 != '[' AND + col2 NOT LIKE sys.remove_accents_internal(col2) COLLATE Latin1_General_CI_AI; +GO + +-- tsql +DROP TABLE all_utf8_chars +GO diff --git a/test/JDBC/input/datatypes/Test-spatial-functions-vu-cleanup.txt b/test/JDBC/input/datatypes/Test-spatial-functions-vu-cleanup.txt new file mode 100644 index 00000000000..458cca9199b --- /dev/null +++ b/test/JDBC/input/datatypes/Test-spatial-functions-vu-cleanup.txt @@ -0,0 +1,35 @@ +USE TestSpatialFunction_DB + +DROP TABLE IF EXISTS TestSpatialFunction_YourTable1Temp + +USE MASTER + +DROP TABLE IF EXISTS TestSpatialFunction_YourTableTemp2 + +DROP TABLE IF EXISTS TestSpatialFunction_TableATemp + +DROP TABLE IF EXISTS TestSpatialFunction_TableBTemp + +DROP VIEW IF EXISTS TestSpatialFunction_ValFromGeomTemp + +DROP VIEW IF EXISTS TestSpatialFunction_TextFromGeogTemp + +DROP VIEW IF EXISTS TestSpatialFunction_point_equality1Temp + +DROP VIEW IF EXISTS TestSpatialFunction_isInTemp + +DROP VIEW IF EXISTS TestSpatialFunction_point_EqualityTemp + +DROP VIEW IF EXISTS TestSpatialFunction_point_inTemp + +DROP VIEW IF EXISTS TestSpatialFunction_SRIDFromGeom + +DROP VIEW IF EXISTS TestSpatialFunction_SRIDFromGeog + +DROP TABLE IF EXISTS TestSpatialFunction_SPATIALPOINTGEOM_dttemp + +DROP TABLE IF EXISTS TestSpatialFunction_SPATIALPOINTGEOG_dttemp + +DROP TABLE IF EXISTS TestSpatialFunction_YourTableTemp + +DROP DATABASE TestSpatialFunction_DB diff --git a/test/JDBC/input/datatypes/Test-spatial-functions-vu-prepare.txt b/test/JDBC/input/datatypes/Test-spatial-functions-vu-prepare.txt new file mode 100644 index 00000000000..be5b0af6f5b --- /dev/null +++ b/test/JDBC/input/datatypes/Test-spatial-functions-vu-prepare.txt @@ -0,0 +1,64 @@ +CREATE DATABASE TestSpatialFunction_DB; + +USE TestSpatialFunction_DB; + +CREATE TABLE TestSpatialFunction_YourTable1Temp ( ID INT PRIMARY KEY, PointColumn geometry ); +INSERT INTO TestSpatialFunction_YourTable1Temp (ID, PointColumn) VALUES (1, geometry::Point(3.0, 4.0, 4326)), (2, geometry::Point(5.0, 6.0, 4326)), (3, geometry::Point(3.0, 4.0, 0)); + +USE MASTER + +CREATE TABLE TestSpatialFunction_YourTableTemp ( ID INT PRIMARY KEY, PointColumn geometry ); + +INSERT INTO TestSpatialFunction_YourTableTemp (ID, PointColumn) VALUES (1, geometry::Point(3.0, 4.0, 4326)), (2, geometry::Point(5.0, 6.0, 4326)), (3, geometry::Point(3.0, 4.0, 0)); + +CREATE TABLE TestSpatialFunction_YourTableTemp2 ( ID INT PRIMARY KEY, PointColumn1 geometry, PointColumn2 geometry ); +INSERT INTO TestSpatialFunction_YourTableTemp2 (ID, PointColumn1, PointColumn2) VALUES (1, geometry::Point(3.0, 4.0, 4326), geometry::Point(3.0, 4.0, 4326)); + +CREATE TABLE TestSpatialFunction_TableATemp (ID INT PRIMARY KEY, PointA geometry); +CREATE TABLE TestSpatialFunction_TableBTemp (ID INT PRIMARY KEY, PointB geometry); +INSERT INTO TestSpatialFunction_TableATemp (ID, PointA) VALUES (1, geometry::Point(1.0, 2.0, 4326)); +INSERT INTO TestSpatialFunction_TableBTemp (ID, PointB) VALUES (1, geometry::Point(3.0, 4.0, 4326)); + +CREATE TABLE TestSpatialFunction_SPATIALPOINTGEOG_dttemp (location geography); +INSERT INTO TestSpatialFunction_SPATIALPOINTGEOG_dttemp (location) VALUES ( geography::STGeomFromText('Point(47.65100 -22.34900)', 4326) ); +INSERT INTO TestSpatialFunction_SPATIALPOINTGEOG_dttemp (location) VALUES ( geography::STGeomFromText('Point(1.0 2.0)', 4326) ); +INSERT INTO TestSpatialFunction_SPATIALPOINTGEOG_dttemp (location) VALUES ( geography::STGeomFromText('Point(1.0 2.0)', 4326) ); +INSERT INTO TestSpatialFunction_SPATIALPOINTGEOG_dttemp (location) VALUES ( geography::STPointFromText('Point(1.0 2.0)', 4326) ); + +#Tests for Geography type Prepared Statements +prepst#!#INSERT INTO TestSpatialFunction_SPATIALPOINTGEOG_dttemp(location) values(@location) #!#GEOGRAPHY|-|location|-|Point(47.65100 -22.34900):4326 +prepst#!#exec#!#GEOGRAPHY|-|location|-|Point(1.0 2.0):4326 +prepst#!#exec#!#GEOGRAPHY|-|location|-|Point(-91.0 -35.0):4326 +prepst#!#exec#!#GEOGRAPHY|-|location|-|Point(290.345 45.1234):4326 +prepst#!#exec#!#GEOGRAPHY|-|location|-|Point(-120.345 45.1234):4326 +prepst#!#exec#!#GEOGRAPHY|-|location|-|Point(-720.345 45.1234):4326 + +CREATE TABLE TestSpatialFunction_SPATIALPOINTGEOM_dttemp (location geometry); +INSERT INTO TestSpatialFunction_SPATIALPOINTGEOM_dttemp (location) VALUES ( geometry::STGeomFromText('Point(47.65100 -22.34900)', 4326) ); +INSERT INTO TestSpatialFunction_SPATIALPOINTGEOM_dttemp (location) VALUES ( geometry::STGeomFromText('Point(1.0 2.0)', 4326) ); +INSERT INTO TestSpatialFunction_SPATIALPOINTGEOM_dttemp (location) VALUES ( geometry::STGeomFromText('Point(47.65100 -22.34900)', 0) ); +INSERT INTO TestSpatialFunction_SPATIALPOINTGEOM_dttemp (location) VALUES ( geometry::STPointFromText('Point(1.0 2.0)', 4326) ); +INSERT INTO TestSpatialFunction_SPATIALPOINTGEOM_dttemp (location) VALUES ( geometry::Point(47.65100, -22.34900, 4326) ); + +#Tests for Geometry type Prepared Statements +prepst#!#INSERT INTO TestSpatialFunction_SPATIALPOINTGEOM_dttemp(location) values(@location) #!#GEOMETRY|-|location|-|Point(47.65100 -22.34900):4326 +prepst#!#exec#!#GEOMETRY|-|location|-|Point(1.0 2.0):4326 +prepst#!#exec#!#GEOMETRY|-|location|-|Point(47.65100 -22.34900):0 +prepst#!#exec#!#GEOMETRY|-|location|-|Point(-91.0 -35.0):4326 +prepst#!#exec#!#GEOMETRY|-|location|-|Point(290.345 45.1234):4326 + +CREATE VIEW TestSpatialFunction_point_equality1Temp AS SELECT p1.location.STEquals(p2.location) AS equality FROM TestSpatialFunction_SPATIALPOINTGEOM_dttemp p1 CROSS JOIN TestSpatialFunction_SPATIALPOINTGEOM_dttemp p2; + +CREATE VIEW TestSpatialFunction_isInTemp AS SELECT p1.location.STContains(p2.location) AS isIN FROM TestSpatialFunction_SPATIALPOINTGEOM_dttemp p1 CROSS JOIN TestSpatialFunction_SPATIALPOINTGEOM_dttemp p2 ORDER BY p1.location.STX; + +CREATE VIEW TestSpatialFunction_ValFromGeomTemp AS SELECT location.STArea() FROM TestSpatialFunction_SPATIALPOINTGEOM_dttemp ORDER BY location.STX; + +CREATE VIEW TestSpatialFunction_TextFromGeogTemp AS SELECT location.STArea() AS Area FROM TestSpatialFunction_SPATIALPOINTGEOG_dttemp ORDER BY location.Lat; + +CREATE VIEW TestSpatialFunction_point_EqualityTemp AS SELECT p1.location.STEquals(p2.location) AS Equality FROM TestSpatialFunction_SPATIALPOINTGEOG_dttemp p1 CROSS JOIN TestSpatialFunction_SPATIALPOINTGEOG_dttemp p2 ORDER BY p1.location.Lat; + +CREATE VIEW TestSpatialFunction_point_inTemp AS SELECT p1.location.STContains(p2.location) AS isIn FROM TestSpatialFunction_SPATIALPOINTGEOG_dttemp p1 CROSS JOIN TestSpatialFunction_SPATIALPOINTGEOG_dttemp p2; + +CREATE VIEW TestSpatialFunction_SRIDFromGeom AS SELECT PointColumn.STSrid AS SRID FROM TestSpatialFunction_YourTableTemp; + +CREATE VIEW TestSpatialFunction_SRIDFromGeog AS SELECT location.STSrid AS Area FROM TestSpatialFunction_SPATIALPOINTGEOG_dttemp ORDER BY location.Lat; diff --git a/test/JDBC/input/datatypes/Test-spatial-functions-vu-verify.sql b/test/JDBC/input/datatypes/Test-spatial-functions-vu-verify.sql new file mode 100644 index 00000000000..82c9159b5a0 --- /dev/null +++ b/test/JDBC/input/datatypes/Test-spatial-functions-vu-verify.sql @@ -0,0 +1,663 @@ +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SELECT @point1.STEquals(@point2) AS Equal; +go + +DECLARE @point1 geography, @point2 geography; +SET @point1 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SET @point2 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point1.STEquals(@point2) AS Equal; +go + +DECLARE @point1 geography, @point2 geography; +SET @point1 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SET @point2 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point1.STContains(@point2) AS isIN; +go + +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 0); +SELECT @point1.STEquals(@point2) AS Equal; +go + +DECLARE @point1 geography, @point2 geography; +SET @point1 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SET @point2 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point1 . STEquals(@point2) AS Equal; +go + +DECLARE @point1 geography, @point2 geography; +SET @point1 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SET @point2 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point1 . STContains(@point2) AS isIN; +go + +DECLARE @point1 geography; +SET @point1 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point1.STSrid; +Go + +-- Verifying with precision +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SELECT STEquals(@point1, @point2); +go + +DECLARE @point1 geography, @point2 geography; +SET @point1 = geography::STGeomFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geography::STGeomFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SELECT @point1.STEquals(@point2) AS Equal; +go + +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geometry::STPointFromText('POINT(-122.354657658684000 47.658678768678100)', 4326); +SELECT STEquals(@point1, @point2); +go + +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SELECT @point1 . STEquals ( @point2 ); +go + +SELECT PointColumn1.STEquals(PointColumn2) AS Equals FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +go + +DECLARE @point1 geometry = geometry::Point(1.0, 2.0, 4326); +SELECT PointColumn1.STEquals(@point1) AS Equals FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +go + +DECLARE @point1 geometry = geometry::Point(1.0, 2.0, 4326); +SELECT @point1.STEquals(PointColumn2) AS Equals FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +DECLARE @isEqual BIT = 0; +SELECT PointColumn.STSrid FROM TestSpatialFunction_YourTableTemp WHERE PointColumn.STEquals(@referencePoint) = @isEqual ORDER BY PointColumn.STSrid; +go + +SELECT ID, PointColumn1.STEquals(PointColumn2) AS Equal_points FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +go + +SELECT PointA.STAsText(),PointB.STAsText() FROM TestSpatialFunction_TableATemp JOIN TestSpatialFunction_TableBTemp ON PointA.STEquals(TestSpatialFunction_TableBTemp.PointB) != 1 ORDER BY PointA.STX; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointA.STAsText(),PointB.STAsText() FROM TestSpatialFunction_TableATemp JOIN TestSpatialFunction_TableBTemp ON @referencePoint.STEquals(TestSpatialFunction_TableBTemp.PointB) = 1 ORDER BY PointA.STX; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointA.STAsText(),PointB.STAsText() FROM TestSpatialFunction_TableATemp JOIN TestSpatialFunction_TableBTemp ON PointA.STEquals(@referencePoint) != 1 ORDER BY PointA.STX; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointColumn.STSrid FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STSrid; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointColumn.STSrid FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STSrid; +go + +SELECT PointColumn1.STAsText() FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +go + +DECLARE @isEqual BIT = 1; +SELECT ID, PointColumn1.STEquals(PointColumn2) AS isEqual, +CASE WHEN PointColumn1.STEquals(PointColumn2) = @isEqual THEN 'yes' ELSE 'no' +END AS isEqual +FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +WITH EqualCTE AS ( SELECT ID, PointColumn.STEquals(@referencePoint) AS Equality FROM TestSpatialFunction_YourTableTemp) +SELECT * FROM EqualCTE WHERE Equality = 1 ORDER BY Equality; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +WITH EqualCTE AS ( SELECT ID, PointColumn.STEquals(@referencePoint) AS Equal FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX) +SELECT * FROM EqualCTE WHERE Equal = 1.0 ORDER BY Equal; +GO + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +WITH EqualCTE AS ( SELECT ID, @referencePoint.STEquals(PointColumn) AS Equal FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX) +SELECT * FROM EqualCTE WHERE Equal != 1.0 ORDER BY Equal; +GO + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +DECLARE @isEqual BIT = 1; +SELECT ID, PointColumn.STEquals(@referencePoint) AS EqualityReferencePoint, +CASE WHEN PointColumn.STEquals(@referencePoint) = @isEqual THEN 'Close' +ELSE 'Far' +END AS Proximity +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, @referencePoint.STEquals(PointColumn) AS EqualityReferencePoint, +CASE WHEN @referencePoint.STEquals(PointColumn) = @referencePoint.STY THEN 'Close' +ELSE 'Far' +END AS Proximity +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +go + +DECLARE @Ranges TABLE (MinDistance float, MaxDistance float); +INSERT INTO @Ranges VALUES (0, 5), (5, 10), (10, 15); +SELECT * FROM ( SELECT ID, +CASE WHEN PointColumn1.STEquals(PointColumn2) BETWEEN 0 AND 1 THEN 'yes' +ELSE 'no' +END AS Range +FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX +) AS Source +PIVOT ( COUNT(ID) FOR Range IN ([0-5], [5.1-10], [10.1-15], [15.1+])) AS PivotTable; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, PointColumn.STEquals(@referencePoint) AS Equality FROM TestSpatialFunction_DB.dbo.TestSpatialFunction_YourTable1Temp ORDER BY PointColumn.STX; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, PointColumn.STEquals(@referencePoint) AS Equal, +JSON_QUERY('{"Equal":' + CAST(PointColumn.STEquals(@referencePoint) AS NVARCHAR(MAX)) + '}') AS Json +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, @referencePoint.STEquals(PointColumn) AS Equal, +JSON_QUERY('{"Equal":' + CAST(@referencePoint.STEquals(PointColumn) AS NVARCHAR(MAX)) + '}') Json +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +go + +SELECT [PointColumn1].STEquals([PointColumn2]) AS Equality FROM [TestSpatialFunction_YourTableTemp2] ORDER BY PointColumn1.STX; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +DECLARE @isEqual BIT = 1; +DECLARE @sql NVARCHAR(MAX); +DECLARE @params NVARCHAR(MAX); +SET @sql = N' +SELECT ID, PointColumn.STEquals(@referencePoint) AS EqualityReferencePoint, +CASE WHEN PointColumn.STEquals(@referencePoint) = @isEqual THEN ''Close'' +ELSE ''Far'' +END AS Proximity +FROM TestSpatialFunction_YourTableTemp +WHERE PointColumn.STEquals(@referencePoint) = @isEqual;'; +SET @params = N'@referencePoint geometry, @isEqual float'; +EXEC sp_executesql @sql, @params, @referencePoint, @isEqual; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointColumn.STEquals(@referencePoint) AS Equality FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +SELECT TestSpatialFunction_YourTableTemp.PointColumn.STEquals(@referencePoint) AS Equality FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +SELECT dbo.TestSpatialFunction_YourTableTemp.PointColumn.STEquals(@referencePoint) AS Equality FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +go + +DECLARE @pnt geometry; +SET @pnt = geometry::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +select geometry::Point(@pnt.STY, @pnt.STX, 4326).STEquals(@pnt) +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +DECLARE @equal BIT = 1; +SELECT ROUND(PointColumn.STEquals(@referencePoint) / @equal, 0) * @equal AS Equalitygroup, +COUNT(*) AS PointCount +FROM TestSpatialFunction_YourTableTemp +GROUP BY ROUND(PointColumn.STEquals(@referencePoint) / @equal, 0) * @equal +ORDER BY Equalitygroup; +GO + +DECLARE @referencePoint geometry = geometry::Point(1.0, 0.0, 4326); +SELECT ROUND(PointColumn.STEquals(@referencePoint) / @referencePoint.STX, 0) * @referencePoint.STX AS Equalitygroup, +COUNT(*) AS PointCount +FROM TestSpatialFunction_YourTableTemp +GROUP BY ROUND(PointColumn.STEquals(@referencePoint) / @referencePoint.STX, 0) * @referencePoint.STX +ORDER BY Equalitygroup; +GO + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, PointColumn1.STEquals(PointColumn2) AS equal, +cast(PointColumn1.STEquals(@referencePoint) as int) - LAG(PointColumn1.STEquals(PointColumn2)) OVER (ORDER BY ID) AS Equalitygroup +FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +GO + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, PointColumn.STEquals(@referencePoint) AS equal, +cast(@referencePoint.STContains(PointColumn) as int) - LAG(@referencePoint.STX) OVER (ORDER BY ID) AS Equalitygroup +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +GO + +-- Verifying with precision +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SELECT STContains(@point1, @point2); +go + +DECLARE @point1 geography, @point2 geography; +SET @point1 = geography::STGeomFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geography::STGeomFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SELECT @point1.STContains(@point2) AS isIN; +go + +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geometry::STPointFromText('POINT(-122.354657658684000 47.658678768678100)', 4326); +SELECT STContains(@point1, @point2); +go + +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SELECT @point1.STContains(@point2); +go + +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SELECT @point1 . STContains ( @point2 ); +Go + +SELECT ID, PointColumn1.STContains(PointColumn2) AS contain FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +GO + +DECLARE @point1 geometry = geometry::Point(1.0, 2.0, 4326); +SELECT ID, PointColumn1.STContains(@point1) AS contain FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +GO + +DECLARE @point1 geometry = geometry::Point(1.0, 2.0, 4326); +SELECT ID, @point1.STContains(PointColumn2) AS contain FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +GO + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +DECLARE @contain BIT = 1; +SELECT PointColumn.STAsText() FROM TestSpatialFunction_YourTableTemp WHERE PointColumn.STContains(@referencePoint) = @contain ORDER BY PointColumn.STX; +GO + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointColumn.STAsText() FROM TestSpatialFunction_YourTableTemp WHERE @referencePoint.STContains(PointColumn) = @referencePoint.STX ORDER BY PointColumn.STX; +GO + +SELECT ID, PointColumn1.STContains(PointColumn2) AS contain FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointColumn.STAsText() FROM TestSpatialFunction_YourTableTemp WHERE PointColumn.STContains(@referencePoint) != @referencePoint.STX ORDER BY PointColumn.STX; +GO + +SELECT PointA.STAsText(),PointB.STAsText() FROM TestSpatialFunction_TableATemp JOIN TestSpatialFunction_TableBTemp ON PointA.STContains(TestSpatialFunction_TableBTemp.PointB) = 1 ORDER BY TestSpatialFunction_TableBTemp.PointB.STX; +GO + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointA.STAsText(),PointB.STAsText() FROM TestSpatialFunction_TableATemp JOIN TestSpatialFunction_TableBTemp ON @referencePoint.STContains(TestSpatialFunction_TableBTemp.PointB) = 1 ORDER BY TestSpatialFunction_TableBTemp.PointB.STX; +GO + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointA.STAsText(),PointB.STAsText() FROM TestSpatialFunction_TableATemp JOIN TestSpatialFunction_TableBTemp ON PointA.STContains(@referencePoint) = 1 ORDER BY TestSpatialFunction_TableBTemp.PointB.STX; +GO + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointA.STAsText(),PointB.STAsText() FROM TestSpatialFunction_TableATemp JOIN TestSpatialFunction_TableBTemp ON TestSpatialFunction_TableBTemp.PointB.STContains(@referencePoint) = 0 ORDER BY TestSpatialFunction_TableBTemp.PointB.STX; +GO + +SELECT PointColumn1.STAsText() FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +GO + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointColumn.STAsText() FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +GO + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointColumn.STAsText() FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +GO + +DECLARE @contains BIT = 1 ; +SELECT ID, PointColumn1.STContains(PointColumn2) AS doContain, +CASE WHEN PointColumn1.STContains(PointColumn2) = @contains THEN 'Contains' ELSE 'Do_not_contain' +END AS Proximity +FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +GO + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, PointColumn1.STContains(@referencePoint) AS contain, +CASE WHEN @referencePoint.STContains(PointColumn2) = @referencePoint.STX THEN 'Contains' ELSE 'Do_not_contain' +END AS Proximity +FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +GO + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +WITH CTE AS ( SELECT ID, PointColumn.STContains(@referencePoint) AS contain FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX) +SELECT * FROM CTE WHERE contain = 1 ORDER BY contain; +GO + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +WITH CTE AS ( SELECT ID, @referencePoint.STContains(PointColumn) AS contain FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX) +SELECT * FROM CTE WHERE contain = 1 ORDER BY contain; +GO + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +DECLARE @contains BIT = 1; +SELECT ID, PointColumn.STContains(@referencePoint) AS ReferencePoint, +CASE WHEN PointColumn.STContains(@referencePoint) = @contains THEN 'contain' +ELSE 'do_not_contain' +END AS Proximity +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, @referencePoint.STContains(PointColumn) AS ReferencePoint, +CASE WHEN @referencePoint.STContains(PointColumn) = @referencePoint.STY THEN 'contain' +ELSE 'do_not_contain' +END AS Proximity +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +go + +DECLARE @Ranges TABLE (MinDistance float, MaxDistance float); +INSERT INTO @Ranges VALUES (0, 5), (5, 10), (10, 15); +SELECT * FROM ( SELECT ID, +CASE WHEN PointColumn1.STContains(PointColumn2) BETWEEN 0 AND 1 THEN 'contain' +ELSE 'do_not_contain' +END AS Range +FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX +) AS Source +PIVOT ( COUNT(ID) FOR Range IN ([0-5], [5.1-10], [10.1-15], [15.1+])) AS PivotTable; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, PointColumn.STContains(@referencePoint) AS contain FROM TestSpatialFunction_DB.dbo.TestSpatialFunction_YourTable1Temp ORDER BY PointColumn.STX; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, PointColumn.STContains(@referencePoint) AS contain, +JSON_QUERY('{"Contain":' + CAST(PointColumn.STContains(@referencePoint) AS NVARCHAR(MAX)) + '}') AS Json +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, @referencePoint.STContains(PointColumn) AS contain, +JSON_QUERY('{"Contain":' + CAST(@referencePoint.STContains(PointColumn) AS NVARCHAR(MAX)) + '}') Json +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +go + +SELECT [PointColumn1].STContains([PointColumn2]) AS contain FROM [TestSpatialFunction_YourTableTemp2] ORDER BY PointColumn1.STX; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +DECLARE @contains BIT = 1; +DECLARE @sql NVARCHAR(MAX); +DECLARE @params NVARCHAR(MAX); +SET @sql = N' +SELECT ID, PointColumn.STContains(@referencePoint) AS EqualityReferencePoint, +CASE WHEN PointColumn.STContains(@referencePoint) = @contains THEN ''contains'' +ELSE ''do_not_contain'' +END AS Proximity +FROM TestSpatialFunction_YourTableTemp +WHERE PointColumn.STContains(@referencePoint) = @contains;'; +SET @params = N'@referencePoint geometry, @contains float'; +EXEC sp_executesql @sql, @params, @referencePoint, @contains; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT PointColumn.STContains(@referencePoint) AS contain FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +SELECT TestSpatialFunction_YourTableTemp.PointColumn.STContains(@referencePoint) AS contain FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +SELECT dbo.TestSpatialFunction_YourTableTemp.PointColumn.STContains(@referencePoint) AS contain FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +go + +DECLARE @pnt geometry; +SET @pnt = geometry::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +select geometry::Point(@pnt.STY, @pnt.STX, 4326).STContains(@pnt) + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +DECLARE @contains BIT = 1; +SELECT ROUND(PointColumn.STContains(@referencePoint) / @contains, 0) * @contains AS Grp, +COUNT(*) AS PointCount +FROM TestSpatialFunction_YourTableTemp +GROUP BY ROUND(PointColumn.STContains(@referencePoint) / @contains, 0) * @contains +ORDER BY Grp; +GO + +DECLARE @referencePoint geometry = geometry::Point(1.0, 0.0, 4326); +SELECT ROUND(PointColumn.STContains(@referencePoint) / @referencePoint.STX, 0) * @referencePoint.STX AS GRP, +COUNT(*) AS PointCount +FROM TestSpatialFunction_YourTableTemp +GROUP BY ROUND(PointColumn.STContains(@referencePoint) / @referencePoint.STX, 0) * @referencePoint.STX +ORDER BY Grp; +GO + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, PointColumn1.STContains(PointColumn2) AS contain, +cast(PointColumn1.STContains(@referencePoint) as int) - LAG(PointColumn1.STContains(PointColumn2)) OVER (ORDER BY ID) AS Difference +FROM TestSpatialFunction_YourTableTemp2 ORDER BY PointColumn1.STX; +GO + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +SELECT ID, PointColumn.STContains(@referencePoint) AS contain, +cast(@referencePoint.STContains(PointColumn) as int) - LAG(@referencePoint.STX) OVER (ORDER BY ID) AS Difference +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +GO + +DECLARE @point geometry; +SET @point = geometry::STPointFromText('POINT(-122.34900 47.65100)', 4326); +SELECT STArea(@point); +go + +DECLARE @point geography; +SET @point = geography::STPointFromText('POINT(-122.34900 47.65100)', 4326); +SELECT STArea(@point); +go + +DECLARE @point geometry; +SET @point = geometry::STPointFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point.STArea(); +Go + +DECLARE @point geography; +SET @point = geography::STPointFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point.STArea(); +Go + +DECLARE @point geometry; +SET @point = geometry::POINT(22.34900, -47.65100, 4326); +SELECT @point . STArea ( ); +Go + +DECLARE @point geography; +SET @point = geography::POINT(22.34900, -47.65100, 4326); +SELECT @point . STArea ( ); +Go + +SELECT location.STArea() from TestSpatialFunction_SPATIALPOINTGEOM_dttemp ORDER BY location.STX; +GO + +SELECT location.STArea() from TestSpatialFunction_SPATIALPOINTGEOG_dttemp ORDER BY location.Lat; +GO + +DECLARE @point geography; +SET @point = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT STArea(@point); +SELECT @point.STArea(); +Go + +DECLARE @point geography; +SET @point = geography::Point(22.34900, -47.65100, 4326); +SELECT STArea(@point); +SELECT @point.STArea(); +Go + +DECLARE @point1 geometry, @point2 geometry, @point3 geometry; +SET @point1 = geometry::STPointFromText(null, 4326); +SET @point2 = geometry::STGeomFromText(null, 4326); +SET @point3 = geometry::Point(22.34900, -47.65100, 4326); +SELECT @point1.STEquals(@point2); +SELECT @point3.STEquals(@point2); +SELECT @point1.STEquals(@point3); +SELECT @point1.STContains(@point2); +SELECT @point3.STContains(@point2); +SELECT @point1.STContains(@point3); +go + +-- Negative test for Geospatial functions +DECLARE @point1 geometry, @point2 varchar(50), @point3 int; +SET @point1 = geometry::Point(22.34900, -47.65100, 4326); +SET @point2 = 'Test_String'; +SELECT @point1.STEquals(@point2); +SELECT @point1.STContains(@point2); +go + +DECLARE @point1 geography, @point2 varchar(50), @point3 int; +SET @point1 = geography::Point(22.34900, -47.65100, 4326); +SET @point2 = 'Test_String'; +SELECT @point1.STEquals(@point2); +SELECT @point1.STContains(@point2); +go + +-- Null test for Geospatial functions +DECLARE @point1 geography, @point2 geography, @point3 geography; +SET @point1 = geography::STPointFromText(null, 4326); +SET @point2 = geography::STGeomFromText(null, 4326); +SET @point3 = geography::Point(22.34900, -47.65100, 4326); +SELECT @point1.STEquals(@point2); +SELECT @point3.STEquals(@point2); +SELECT @point1.STEquals(@point3); +SELECT @point1.STContains(@point2); +SELECT @point3.STContains(@point2); +SELECT @point1.STContains(@point3); +go + +DECLARE @g geometry; +SELECT @g.STArea(); +go + +SELECT location.STArea() from TestSpatialFunction_SPATIALPOINTGEOG_dttemp ORDER BY location.Lat; +GO + +-- Combining geometry and geography in a single query +DECLARE @point1 geometry, @point2 geography; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point1.STContains(@point2); +go + +DECLARE @point1 geometry, @point2 geography; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point2.STContains(@point1); +go + +DECLARE @point1 geometry, @point2 geography; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point1.STEquals(@point2); +go + +DECLARE @point1 geometry, @point2 geography; +SET @point1 = geometry::STPointFromText('POINT(-122.354657658684900 47.658678768678100)', 4326); +SET @point2 = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT @point2.STEquals(@point1); +go + +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::Point(22.34900, -47.65100, 4326); +SET @point2 = geometry::STGeomFromText('POINT(1 1)', 0); +SELECT @point1.STEquals(@point2); +go + +DECLARE @point1 geometry, @point2 geometry; +SET @point1 = geometry::Point(22.34900, -47.65100, 4326); +SET @point2 = geometry::STGeomFromText('POINT(1 1)', 0); +SELECT @point1.STContains(@point2); +go + +DECLARE @point1 geometry; +SET @point1 = geometry::Point(3.0, 4.0, 4326); +SELECT PointColumn.STAsText() from TestSpatialFunction_YourTableTemp where PointColumn <> @point1; +GO + +DECLARE @point1 geometry; +SET @point1 = geometry::Point(3.0, 4.0, 4326); +SELECT PointColumn.STAsText() from TestSpatialFunction_YourTableTemp where PointColumn = @point1; +GO + +SELECT PointColumn.STSrid from TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STSrid; +GO + +SELECT [PointColumn].[STSrid] from TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STX; +GO + +SELECT location.STSrid from TestSpatialFunction_SPATIALPOINTGEOG_dttemp ORDER BY location.STSrid; +GO + +SELECT [location].[STSrid] from TestSpatialFunction_SPATIALPOINTGEOG_dttemp ORDER BY location.Lat; +GO + +DECLARE @point geometry; +SET @point = geometry::Point(1.0, 2.0, 4326); +SELECT @point.STSrid AS Srid; +GO + +DECLARE @point geometry = geometry::Point(1.0, 2.0, 4326); +SELECT PointColumn.STSrid FROM TestSpatialFunction_YourTableTemp WHERE PointColumn.STSrid = @point.STSrid ORDER BY PointColumn.STSrid; +GO + +DECLARE @point geography = geography::Point(1.0, 2.0, 4326); +SELECT location.STSrid FROM TestSpatialFunction_SPATIALPOINTGEOG_dttemp WHERE location.STSrid = @point.STSrid ORDER BY location.STSrid; +GO + +SELECT * FROM TestSpatialFunction_TableATemp JOIN TestSpatialFunction_TableBTemp ON TestSpatialFunction_TableATemp.PointA.STSrid = TestSpatialFunction_TableBTemp.PointB.STSrid ORDER BY TestSpatialFunction_TableBTemp.PointB.STSrid; +GO + +DECLARE @point geometry = geometry::Point(1.0, 2.0, 4326); +SELECT * FROM TestSpatialFunction_TableATemp JOIN TestSpatialFunction_TableBTemp ON TestSpatialFunction_TableATemp.PointA.STSrid = @point.STSrid ORDER BY TestSpatialFunction_TableBTemp.PointB.STSrid; +GO + +SELECT PointColumn.STSrid FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STSrid; +GO + +DECLARE @point geometry = geometry::Point(1.0, 2.0, 4326); +SELECT PointColumn.STSrid FROM TestSpatialFunction_YourTableTemp ORDER BY @point.STSrid; +GO + +SELECT PointColumn.STSrid AS SRID FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STSrid; +GO + +SELECT TestSpatialFunction_YourTableTemp.PointColumn.STSrid AS SRID FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STSrid; +GO + +SELECT dbo.YourTable.PointColumn.STSrid AS SRID FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STSrid; +GO + +SELECT ID, PointColumn.STSrid AS SRID, +JSON_QUERY('{"SRID":' + CAST(PointColumn.STSrid AS NVARCHAR(MAX)) + '}') AS SRIDJson +FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STSrid; +GO + +SELECT TestSpatialFunction_YourTable1Temp.ID, TestSpatialFunction_YourTable1Temp.PointColumn.STSrid AS SRID +FROM TestSpatialFunction_DB.dbo.TestSpatialFunction_YourTable1Temp; +GO + +DECLARE @point geometry = geometry::Point(1.0, 2.0, 4326); +SELECT PointColumn.STSrid AS SRID, COUNT(*) AS PointCount +FROM TestSpatialFunction_YourTableTemp GROUP BY PointColumn.STSrid ORDER BY PointCount; +GO + +SELECT ID, PointColumn.STSrid AS XCoordinate, +CASE WHEN PointColumn.STSrid = 0 THEN 'Zero SRID' +ELSE 'Positive SRID' END AS SRID FROM TestSpatialFunction_YourTableTemp ORDER BY PointColumn.STSrid; +GO + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +UPDATE TestSpatialFunction_YourTableTemp SET PointColumn = @referencePoint +WHERE PointColumn.STSrid = @referencePoint.STSrid; +GO + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +UPDATE TestSpatialFunction_YourTableTemp SET PointColumn = @referencePoint +WHERE PointColumn.STEquals(@referencePoint) != 1; +go + +DECLARE @referencePoint geometry = geometry::Point(0.0, 0.0, 4326); +UPDATE TestSpatialFunction_YourTableTemp SET PointColumn = @referencePoint +WHERE @referencePoint.STEquals(PointColumn) = 1; +go diff --git a/test/JDBC/input/datatypes/TestHalfvecDatatype.mix b/test/JDBC/input/datatypes/TestHalfvecDatatype.mix new file mode 100644 index 00000000000..938ecf58f0c --- /dev/null +++ b/test/JDBC/input/datatypes/TestHalfvecDatatype.mix @@ -0,0 +1,683 @@ +-- parallel_query_expected +-- tsql +-- should throw error since vector is only allowed in sys +exec sp_execute_postgresql 'create extension vector'; +go + +exec sp_execute_postgresql 'create extension vector with schema sys'; +go + +create login vector_login with password='12345678' +go + +Alter server role sysadmin add member vector_login +go + +create database vector_db; +go + +use vector_db +go + +-- tsql user=vector_login password=12345678 +use vector_db; +go + +select set_config('babelfishpg_tsql.explain_costs', 'off', false); +go +select set_config('babelfishpg_tsql.explain_timing', 'off', false); +go +select set_config('babelfishpg_tsql.explain_summary', 'off', false); +go + +SELECT CAST('[1,2,3]' as halfvec); +go + +SELECT CAST('[-1,-2,-3]' as halfvec); +go + +SELECT CAST('[1.,2.,3.]' as halfvec); +go + +SELECT CAST(' [ 1, 2 , 3 ] ' as halfvec); +go + +SELECT CAST('[1.23456]' as halfvec); +go + +SELECT CAST('[hello,1]' as halfvec); +go + +SELECT CAST('[NaN,1]' as halfvec); +go + +SELECT CAST('[Infinity,1]' as halfvec); +go + +SELECT CAST('[-Infinity,1]' as halfvec); +go + +SELECT CAST('[65519,-65519]' as halfvec); +go + +SELECT CAST('[65520,-65520]' as halfvec); +go + +SELECT CAST('[1e-8,-1e-8]' as halfvec); +go + +SELECT CAST('[4e38,1]' as halfvec); +go + +SELECT CAST('[1e-46,1]' as halfvec); +go + +SELECT CAST('[1,2,3' as halfvec); +go + +SELECT CAST('[1,2,3]9' as halfvec); +go + +SELECT CAST('1,2,3' as halfvec); +go + +SELECT CAST('' as halfvec); +go + +SELECT CAST('[' as halfvec); +go + +SELECT CAST('[ ' as halfvec); +go + +SELECT CAST('[,' as halfvec); +go + +SELECT CAST('[]' as halfvec); +go + +SELECT CAST('[ ]' as halfvec); +go + +SELECT CAST('[,]' as halfvec); +go + +SELECT CAST('[1,]' as halfvec); +go + +SELECT CAST('[1a]' as halfvec); +go + +SELECT CAST('[1,,3]' as halfvec); +go + +SELECT CAST('[1, ,3]' as halfvec); +go + +SELECT CAST('[1,2,3]' as halfvec(3)); +go + +SELECT CAST('[1,2,3]' as halfvec(2)); +go + +SELECT CAST('[1,2,3]' as halfvec(3, 2)); +go + +SELECT CAST('[1,2,3]' as halfvec('a')); +go + +SELECT CAST('[1,2,3]' as halfvec(0)); +go + +SELECT CAST('[1,2,3]' as halfvec(16001)); +go + +SELECT CAST('{"[1,2,3]"}' as halfvec(2)[]); +go + +SELECT CAST('[1,2,3]' as halfvec) + CAST('[4,5,6]' as halfvec); +go + +SELECT CAST('[65519]' as halfvec) + CAST('[65519]' as halfvec); +go + +SELECT CAST('[1,2]' as halfvec) + CAST('[3]' as halfvec); +go + +SELECT CAST('[1,2,3]' as halfvec) - CAST('[4,5,6]' as halfvec); +go + +SELECT CAST('[-65519]' as halfvec) - CAST('[65519]' as halfvec); +go + +SELECT CAST('[1,2]' as halfvec) - CAST('[3]' as halfvec); +go + +SELECT CAST('[1,2,3]' as halfvec) * CAST('[4,5,6]' as halfvec); +go + +SELECT CAST('[65519]' as halfvec) * CAST('[65519]' as halfvec); +go + +SELECT CAST('[1e-7]' as halfvec) * CAST('[1e-7]' as halfvec); +go + +SELECT CAST('[1,2]' as halfvec) * CAST('[3]' as halfvec); +go + +SELECT CAST('[1,2,3]' as halfvec) + CAST('[4,5]' as halfvec); +go + +SELECT CAST('[1,2,3]' as halfvec) < CAST('[1,2,3]' as halfvec); +go + +SELECT CAST('[1,2,3]' as halfvec) < CAST('[1,2]' as halfvec); +go + +SELECT CAST('[1,2,3]' as halfvec) <= CAST('[1,2,3]' as halfvec); +go + +SELECT CAST('[1,2,3]' as halfvec) <= CAST('[1,2]' as halfvec); +go + +SELECT CAST('[1,2,3]' as halfvec) = CAST('[1,2,3]' as halfvec); +go + +SELECT CAST('[1,2,3]' as halfvec) = CAST('[1,2]' as halfvec); +go + +SELECT CAST('[1,2,3]' as halfvec) != CAST('[1,2,3]' as halfvec); +go + +SELECT CAST('[1,2,3]' as halfvec) != CAST('[1,2]' as halfvec); +go + +SELECT CAST('[1,2,3]' as halfvec) >= CAST('[1,2,3]' as halfvec); +go + +SELECT CAST('[1,2,3]' as halfvec) >= CAST('[1,2]' as halfvec); +go + +SELECT CAST('[1,2,3]' as halfvec) > CAST('[1,2,3]' as halfvec); +go + +SELECT CAST('[1,2,3]' as halfvec) > CAST('[1,2]' as halfvec); +go + +SELECT halfvec_cmp(CAST('[1,2,3]' as halfvec), CAST('[1,2,3]' as halfvec)); +go + +SELECT halfvec_cmp(CAST('[1,2,3]' as halfvec), CAST('[0,0,0]' as halfvec)); +go + +SELECT halfvec_cmp(CAST('[0,0,0]' as halfvec), CAST('[1,2,3]' as halfvec)); +go + +SELECT halfvec_cmp(CAST('[1,2]' as halfvec), CAST('[1,2,3]' as halfvec)); +go + +SELECT halfvec_cmp(CAST('[1,2,3]' as halfvec), CAST('[1,2]' as halfvec)); +go + +SELECT halfvec_cmp(CAST('[1,2]' as halfvec), CAST('[2,3,4]' as halfvec)); +go + +SELECT halfvec_cmp(CAST('[2,3]' as halfvec), CAST('[1,2,3]' as halfvec)); +go + +SELECT vector_dims(CAST('[1,2,3]' as halfvec)); +go + +SELECT ROUND(CAST(l2_norm(CAST('[1,1]' as halfvec)) as numeric), 5); +go + +SELECT l2_norm(CAST('[3,4]' as halfvec)); +go + +SELECT l2_norm(CAST('[0,1]' as halfvec)); +go + +SELECT l2_norm(CAST('[0,0]' as halfvec)); +go + +SELECT l2_norm(CAST('[2]' as halfvec)); +go + +SELECT l2_distance(CAST('[0,0]' as halfvec), CAST('[3,4]' as halfvec)); +go + +SELECT l2_distance(CAST('[0,0]' as halfvec), CAST('[0,1]' as halfvec)); +go + +SELECT l2_distance(CAST('[1,2]' as halfvec), CAST('[3]' as halfvec)); +go + +SELECT l2_distance(CAST('[1,1,1,1,1,1,1,1,1]' as halfvec), CAST('[1,1,1,1,1,1,1,4,5]' as halfvec)); +go + +SELECT CAST('[0,0]' as halfvec) <-> CAST('[3,4]' as halfvec); +go + +SELECT inner_product(CAST('[1,2]' as halfvec), CAST('[3,4]' as halfvec)); +go + +SELECT inner_product(CAST('[1,2]' as halfvec), CAST('[3]' as halfvec)); +go + +SELECT inner_product(CAST('[65504]' as halfvec), CAST('[65504]' as halfvec)); +go + +SELECT inner_product(CAST('[1,1,1,1,1,1,1,1,1]' as halfvec), CAST('[1,2,3,4,5,6,7,8,9]' as halfvec)); +go + +SELECT CAST('[1,2]' as halfvec) <#> CAST('[3,4]' as halfvec); +go + +SELECT cosine_distance(CAST('[1,2]' as halfvec), CAST('[2,4]' as halfvec)); +go + +SELECT cosine_distance(CAST('[1,2]' as halfvec), CAST('[0,0]' as halfvec)); +go + +SELECT cosine_distance(CAST('[1,1]' as halfvec), CAST('[1,1]' as halfvec)); +go + +SELECT cosine_distance(CAST('[1,0]' as halfvec), CAST('[0,2]' as halfvec)); +go + +SELECT cosine_distance(CAST('[1,1]' as halfvec), CAST('[-1,-1]' as halfvec)); +go + +SELECT cosine_distance(CAST('[1,2]' as halfvec), CAST('[3]' as halfvec)); +go + +SELECT cosine_distance(CAST('[1,1]' as halfvec), CAST('[1.1,1.1]' as halfvec)); +go + +SELECT cosine_distance(CAST('[1,1]' as halfvec), CAST('[-1.1,-1.1]' as halfvec)); +go + +SELECT cosine_distance(CAST('[1,2,3,4,5,6,7,8,9]' as halfvec), CAST('[1,2,3,4,5,6,7,8,9]' as halfvec)); +go + +SELECT cosine_distance(CAST('[1,2,3,4,5,6,7,8,9]' as halfvec), CAST('[-1,-2,-3,-4,-5,-6,-7,-8,-9]' as halfvec)); +go + +SELECT CAST('[1,2]' as halfvec) <=> CAST('[2,4]' as halfvec); +go + +SELECT l1_distance(CAST('[0,0]' as halfvec), CAST('[3,4]' as halfvec)); +go + +SELECT l1_distance(CAST('[0,0]' as halfvec), CAST('[0,1]' as halfvec)); +go + +SELECT l1_distance(CAST('[1,2]' as halfvec), CAST('[3]' as halfvec)); +go + +SELECT l1_distance(CAST('[1,2,3,4,5,6,7,8,9]' as halfvec), CAST('[1,2,3,4,5,6,7,8,9]' as halfvec)); +go + +SELECT l1_distance(CAST('[1,2,3,4,5,6,7,8,9]' as halfvec), CAST('[0,3,2,5,4,7,6,9,8]' as halfvec)); +go + +SELECT CAST('[0,0]' as halfvec) <+> CAST('[3,4]' as halfvec); +go + +SELECT l2_normalize(CAST('[3,4]' as halfvec)); +go + +SELECT l2_normalize(CAST('[3,0]' as halfvec)); +go + +SELECT l2_normalize(CAST('[0,0.1]' as halfvec)); +go + +SELECT l2_normalize(CAST('[0,0]' as halfvec)); +go + +SELECT l2_normalize(CAST('[65504]' as halfvec)); +go + +SELECT binary_quantize(CAST('[1,0,-1]' as halfvec)); +go + +SELECT binary_quantize(CAST('[0,0.1,-0.2,-0.3,0.4,0.5,0.6,-0.7,0.8,-0.9,1]' as halfvec)); +go + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 1, 3); +go + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 3, 2); +go + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), -1, 3); +go + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 3, 9); +go + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 1, 0); +go + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 3, -1); +go + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), -1, 2); +go + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 2147483647, 10); +go + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), 3, 2147483647); +go + +SELECT subvector(CAST('[1,2,3,4,5]' as halfvec), -2147483644, 2147483647); +go + +SELECT halfvec_avg(array_agg(CAST(n as halfvec))) FROM generate_series(1, 16002) n; +go + +-- hnsw_halfvec +-- l2 +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go + +CREATE INDEX idx ON halfvec_table USING hnsw (val halfvec_l2_ops); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec); +go + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <-> (SELECT CAST(NULL as halfvec))) t2; +go + +SELECT COUNT(*) FROM halfvec_table; +go + +TRUNCATE TABLE halfvec_table; +go + +SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec); +go + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go + +-- inner product + +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go + +CREATE INDEX idx ON halfvec_table USING hnsw (val halfvec_ip_ops); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +SELECT * FROM halfvec_table ORDER BY val <#> CAST('[3,3,3]' AS halfvec); +go + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <#> (SELECT CAST(NULL as halfvec))) t2; +go + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go + +-- cosine + +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go + +CREATE INDEX idx ON halfvec_table USING hnsw (val halfvec_cosine_ops); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +SELECT * FROM halfvec_table ORDER BY val <=> CAST('[3,3,3]' AS halfvec); +go + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> CAST('[0,0,0]' AS halfvec)) t2; +go + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> (SELECT CAST(NULL as halfvec))) t2; +go + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go + +-- L1 + +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go + +CREATE INDEX idx ON halfvec_table USING hnsw (val halfvec_l1_ops); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +SELECT * FROM halfvec_table ORDER BY val <+> CAST('[3,3,3]' AS halfvec); +go + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <+> (SELECT CAST(NULL as halfvec))) t2; +go + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go + +-- ivfflat +-- l2 +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go + +CREATE INDEX idx ON halfvec_table USING ivfflat (val halfvec_l2_ops) WITH (lists = 1); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec); +go + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <-> (SELECT CAST(NULL as halfvec))) t2; +go + +SELECT COUNT(*) FROM halfvec_table; +go + +TRUNCATE TABLE halfvec_table; +go + +SELECT * FROM halfvec_table ORDER BY val <-> CAST('[3,3,3]' AS halfvec); +go + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go + +-- inner product + +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go + +CREATE INDEX idx ON halfvec_table USING ivfflat (val halfvec_ip_ops) WITH (lists = 1) WITH (lists = 1); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +SELECT * FROM halfvec_table ORDER BY val <#> CAST('[3,3,3]' AS halfvec); +go + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <#> (SELECT CAST(NULL as halfvec))) t2; +go + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go + +-- cosine + +CREATE TABLE halfvec_table (val halfvec(3)); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[0,0,0]' AS halfvec)), (CAST('[1,2,3]' AS halfvec)), (CAST('[1,1,1]' AS halfvec)), (NULL); +go + +CREATE INDEX idx ON halfvec_table USING ivfflat (val halfvec_cosine_ops) WITH (lists = 1); +go + +INSERT INTO halfvec_table (val) VALUES (CAST('[1,2,4]' AS halfvec)); +go + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +SELECT * FROM halfvec_table ORDER BY val <=> CAST('[3,3,3]' AS halfvec); +go + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> CAST('[0,0,0]' AS halfvec)) t2; +go + +SELECT COUNT(*) FROM (SELECT * FROM halfvec_table ORDER BY val <=> (SELECT CAST(NULL as halfvec))) t2; +go + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE halfvec_table; +go + +select set_config('babelfishpg_tsql.explain_costs', 'on', false); +go +select set_config('babelfishpg_tsql.explain_timing', 'on', false); +go +select set_config('babelfishpg_tsql.explain_summary', 'on', false); +go + +-- system metadata, all objects get their datatype info from one of: +-- typecodes or datatype_info data we have created. Testing sys.types for typecodes +-- and sp_sproc_columns_100 for datatype_info is enough +select count(*) from sys.types where name = 'halfvec'; +go + +create procedure halfvec_proc_1 @a halfvec, @b varchar(max) as select @a as a, @b as b; +go + +exec sp_sproc_columns_100 @procedure_name= 'halfvec_proc_1' +go + +drop procedure halfvec_proc_1; +go + +create table t(a halfvec(3), b varchar(max)) +go +select * from information_schema.columns where table_name = 't' +go +select count(*) from sys.columns where object_id = sys.object_id('t') +go +drop table t; +go + +-- Testing with different typmod +CREATE TABLE document_embeddings ( + id int PRIMARY KEY, + embedding halfvec(4) NOT NULL +); +go +CREATE INDEX document_embeddings_embedding_idx ON document_embeddings USING hnsw (embedding vector_l2_ops); +go +INSERT INTO document_embeddings(id, embedding) VALUES(1, CAST('[21,-2,0,2.5]' as halfvec)); +INSERT INTO document_embeddings(id, embedding) VALUES(2, CAST('[5, 10000, -9.75, 8]' as halfvec)); +INSERT INTO document_embeddings(id, embedding) VALUES(3, CAST('[-0.02,23,3.14,00]' as halfvec)); +WITH cte AS ( + SELECT CAST(2e2 AS real) a, 80 b, CAST('-65519' AS real) c, -1 d +) +INSERT INTO document_embeddings(id, embedding) SELECT 4, CAST(CONCAT('[',a, ',', b, ',', c, ',', d, ']') as halfvec) FROM cte; +go +SELECT * FROM document_embeddings; +go +SELECT TOP 5 * FROM document_embeddings ORDER BY embedding <=> '[3,1,2,4]'; +go +-- extending PG syntax to have generic vector expression support +SELECT count(embedding <-> '[3,1,2,0]') FROM document_embeddings; +SELECT count(embedding <=> '[3,1,2,0]') FROM document_embeddings; +SELECT count(embedding <#> '[3,1,2,0]') FROM document_embeddings; +go + +-- WHERE clause expressions +SELECT * FROM document_embeddings WHERE embedding <-> '[3,20, 1,-2.5]' < 5; +SELECT * FROM document_embeddings WHERE embedding <=> '[3,20, 1,-2.5]' < 5; +SELECT * FROM document_embeddings WHERE embedding <#> '[3,20, 1,-2.5]' < 5; +go + +SELECT AVG(embedding) FROM document_embeddings; +go + +SELECT id, AVG(embedding) FROM document_embeddings GROUP BY id; +go + +Drop table document_embeddings +go + +-- psql +-- Need to terminate active session before cleaning up the login +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'vector_login' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +GO + +-- tsql +use master +go + +exec sp_execute_postgresql 'drop extension vector'; +go + +drop login vector_login +go + +drop database vector_db; +go \ No newline at end of file diff --git a/test/JDBC/input/datatypes/TestSparsevecDatatype.mix b/test/JDBC/input/datatypes/TestSparsevecDatatype.mix new file mode 100644 index 00000000000..af1238e9df0 --- /dev/null +++ b/test/JDBC/input/datatypes/TestSparsevecDatatype.mix @@ -0,0 +1,634 @@ +-- parallel_query_expected +-- tsql +-- should throw error since vector is only allowed in sys +exec sp_execute_postgresql 'create extension vector'; +go + +exec sp_execute_postgresql 'create extension vector with schema sys'; +go + +create login vector_login with password='12345678' +go + +Alter server role sysadmin add member vector_login +go + +create database vector_db; +go + +use vector_db +go + +-- tsql user=vector_login password=12345678 +use vector_db; +go + +select set_config('babelfishpg_tsql.explain_costs', 'off', false); +go +select set_config('babelfishpg_tsql.explain_timing', 'off', false); +go +select set_config('babelfishpg_tsql.explain_summary', 'off', false); +go + +SELECT CAST('{1:1.5,3:3.5}/5' as sparsevec); +go + +SELECT CAST('{1:-2,3:-4}/5' as sparsevec); +go + +SELECT CAST('{1:2.,3:4.}/5' as sparsevec); +go + +SELECT CAST(' { 1 : 1.5 , 3 : 3.5 } / 5 ' as sparsevec); +go + +SELECT CAST('{1:1.23456}/1' as sparsevec); +go + +SELECT CAST('{1:hello,2:1}/2' as sparsevec); +go + +SELECT CAST('{1:NaN,2:1}/2' as sparsevec); +go + +SELECT CAST('{1:Infinity,2:1}/2' as sparsevec); +go + +SELECT CAST('{1:-Infinity,2:1}/2' as sparsevec); +go + +SELECT CAST('{1:1.5e38,2:-1.5e38}/2' as sparsevec); +go + +SELECT CAST('{1:1.5e+38,2:-1.5e+38}/2' as sparsevec); +go + +SELECT CAST('{1:1.5e-38,2:-1.5e-38}/2' as sparsevec); +go + +SELECT CAST('{1:4e38,2:1}/2' as sparsevec); +go + +SELECT CAST('{1:-4e38,2:1}/2' as sparsevec); +go + +SELECT CAST('{1:1e-46,2:1}/2' as sparsevec); +go + +SELECT CAST('{1:-1e-46,2:1}/2' as sparsevec); +go + +SELECT CAST('' as sparsevec); +go + +SELECT CAST('{' as sparsevec); +go + +SELECT CAST('{ ' as sparsevec); +go + +SELECT CAST('{:' as sparsevec); +go + +SELECT CAST('{,' as sparsevec); +go + +SELECT CAST('{}' as sparsevec); +go + +SELECT CAST('{}/'' as sparsevec); +go + +SELECT CAST('{}/1' as sparsevec); +go + +SELECT CAST('{}/1a' as sparsevec); +go + +SELECT CAST('{ }/1' as sparsevec); +go + +SELECT CAST('{:}/1' as sparsevec); +go + +SELECT CAST('{,}/1' as sparsevec); +go + +SELECT CAST('{1,}/1' as sparsevec); +go + +SELECT CAST('{:1}/1' as sparsevec); +go + +SELECT CAST('{1:}/1' as sparsevec); +go + +SELECT CAST('{1a:1}/1' as sparsevec); +go + +SELECT CAST('{1:1a}/1' as sparsevec); +go + +SELECT CAST('{1:1,}/1' as sparsevec); +go + +SELECT CAST('{1:0,2:1,3:0}/3' as sparsevec); +go + +SELECT CAST('{2:1,1:1}/2' as sparsevec); +go + +SELECT CAST('{1:1,1:1}/2' as sparsevec); +go + +SELECT CAST('{1:1,2:1,1:1}/2' as sparsevec); +go + +SELECT CAST('{}/5' as sparsevec); +go + +SELECT CAST('{}/-1' as sparsevec); +go + +SELECT CAST('{}/1000000001' as sparsevec); +go + +SELECT CAST('{}/2147483648' as sparsevec); +go + +SELECT CAST('{}/-2147483649' as sparsevec); +go + +SELECT CAST('{}/9223372036854775808' as sparsevec); +go + +SELECT CAST('{}/-9223372036854775809' as sparsevec); +go + +SELECT CAST('{2147483647:1}/1' as sparsevec); +go + +SELECT CAST('{2147483648:1}/1' as sparsevec); +go + +SELECT CAST('{-2147483648:1}/1' as sparsevec); +go + +SELECT CAST('{-2147483649:1}/1' as sparsevec); +go + +SELECT CAST('{0:1}/1' as sparsevec); +go + +SELECT CAST('{2:1}/1' as sparsevec); +go + +SELECT CAST('{}/3' as sparsevec(3)); +go + +SELECT CAST('{}/3' as sparsevec(2)); +go + +SELECT CAST('{}/3' as sparsevec(3, 2)); +go + +SELECT CAST('{}/3' as sparsevec('a')); +go + +SELECT CAST('{}/3' as sparsevec(0)); +go + +SELECT CAST('{}/3' as sparsevec(1000000001)); +go + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) < CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) < CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) <= CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) <= CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) = CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) = CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) != CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) != CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) >= CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) >= CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) > CAST('{1:1,2:2,3:3}/3' as sparsevec) THEN 1 ELSE 0 END; +go + +SELECT CASE WHEN CAST('{1:1,2:2,3:3}/3' as sparsevec) > CAST('{1:1,2:2}/2' as sparsevec) THEN 1 ELSE 0 END; +go + +SELECT sparsevec_cmp(CAST('{1:1,2:2,3:3}/3' as sparsevec), CAST('{1:1,2:2,3:3}/3' as sparsevec)); +go + +SELECT sparsevec_cmp(CAST('{1:1,2:2,3:3}/3' as sparsevec), CAST('{}/3' as sparsevec)); +go + +SELECT sparsevec_cmp(CAST('{}/3' as sparsevec), CAST('{1:1,2:2,3:3}/3' as sparsevec)); +go + +SELECT sparsevec_cmp(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:1,2:2,3:3}/3' as sparsevec)); +go + +SELECT sparsevec_cmp(CAST('{1:1,2:2,3:3}/3' as sparsevec), CAST('{1:1,2:2}/2' as sparsevec)); +go + +SELECT sparsevec_cmp(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:2,2:3,3:4}/3' as sparsevec)); +go + +SELECT sparsevec_cmp(CAST('{1:2,2:3}/2' as sparsevec), CAST('{1:1,2:2,3:3}/3' as sparsevec)); +go + +SELECT ROUND(l2_norm(CAST('{1:1,2:1}/2' as sparsevec)), 5); +go + +SELECT l2_norm(CAST('{1:3,2:4}/2' as sparsevec)); +go + +SELECT l2_norm(CAST('{2:1}/2' as sparsevec)); +go + +SELECT l2_norm(CAST('{1:3e37,2:4e37}/2' as sparsevec)); +go + +SELECT l2_norm(CAST('{}/2' as sparsevec)); +go + +SELECT l2_norm(CAST('{1:2}/1' as sparsevec)); +go + +SELECT l2_distance(CAST('{}/2' as sparsevec), CAST('{1:3,2:4}/2' as sparsevec)); +go + +SELECT l2_distance(CAST('{1:3}/2' as sparsevec), CAST('{2:4}/2' as sparsevec)); +go + +SELECT l2_distance(CAST('{2:4}/2' as sparsevec), CAST('{1:3}/2' as sparsevec)); +go + +SELECT l2_distance(CAST('{1:3,2:4}/2' as sparsevec), CAST('{}/2' as sparsevec)); +go + +SELECT l2_distance(CAST('{}/2' as sparsevec), CAST('{2:1}/2' as sparsevec)); +go + +SELECT CAST('{}/2' as sparsevec) <-> CAST('{1:3,2:4}/2' as sparsevec); +go + +SELECT inner_product(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:2,2:4}/2' as sparsevec)); +go + +SELECT inner_product(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:3}/1' as sparsevec)); +go + +SELECT inner_product(CAST('{1:1,3:3}/4' as sparsevec), CAST('{2:2,4:4}/4' as sparsevec)); +go + +SELECT inner_product(CAST('{2:2,4:4}/4' as sparsevec), CAST('{1:1,3:3}/4' as sparsevec)); +go + +SELECT inner_product(CAST('{1:1,3:3,5:5}/5' as sparsevec), CAST('{2:4,3:6,4:8}/5' as sparsevec)); +go + +SELECT inner_product(CAST('{1:1}/2' as sparsevec), CAST('{}/2' as sparsevec)); +go + +SELECT inner_product(CAST('{}/2' as sparsevec), CAST('{1:1}/2' as sparsevec)); +go + +SELECT inner_product(CAST('{1:3e38}/1' as sparsevec), CAST('{1:3e38}/1' as sparsevec)); +go + +SELECT inner_product(CAST('{1:1,3:3,5:5}/5' as sparsevec), CAST('{2:4,3:6,4:8}/5' as sparsevec)); +go + +SELECT CAST('{1:1,2:2}/2' as sparsevec) <#> CAST('{1:3,2:4}/2' as sparsevec); +go + +SELECT cosine_distance(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:2,2:4}/2' as sparsevec)); +go + +SELECT cosine_distance(CAST('{1:1,2:2}/2' as sparsevec), CAST('{}/2' as sparsevec)); +go + +SELECT cosine_distance(CAST('{1:1,2:1}/2' as sparsevec), CAST('{1:1,2:1}/2' as sparsevec)); +go + +SELECT cosine_distance(CAST('{1:1}/2' as sparsevec), CAST('{2:2}/2' as sparsevec)); +go + +SELECT cosine_distance(CAST('{1:1,2:1}/2' as sparsevec), CAST('{1:-1,2:-1}/2' as sparsevec)); +go + +SELECT cosine_distance(CAST('{1:2}/2' as sparsevec), CAST('{2:2}/2' as sparsevec)); +go + +SELECT cosine_distance(CAST('{2:2}/2' as sparsevec), CAST('{1:2}/2' as sparsevec)); +go + +SELECT cosine_distance(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:3}/1' as sparsevec)); +go + +SELECT cosine_distance(CAST('{1:1,2:1}/2' as sparsevec), CAST('{1:1.1,2:1.1}/2' as sparsevec)); +go + +SELECT cosine_distance(CAST('{1:1,2:1}/2' as sparsevec), CAST('{1:-1.1,2:-1.1}/2' as sparsevec)); +go + +SELECT cosine_distance(CAST('{1:3e38}/1' as sparsevec), CAST('{1:3e38}/1' as sparsevec)); +go + +SELECT cosine_distance(CAST('{}/1' as sparsevec), CAST('{}/1' as sparsevec)); +go + +SELECT CAST('{1:1,2:2}/2' as sparsevec) <=> CAST('{1:2,2:4}/2' as sparsevec); +go + +SELECT l1_distance(CAST('{}/2' as sparsevec), CAST('{1:3,2:4}/2' as sparsevec)); +go + +SELECT l1_distance(CAST('{}/2' as sparsevec), CAST('{2:1}/2' as sparsevec)); +go + +SELECT l1_distance(CAST('{1:1,2:2}/2' as sparsevec), CAST('{1:3}/1' as sparsevec)); +go + +SELECT l1_distance(CAST('{1:3e38}/1' as sparsevec), CAST('{1:-3e38}/1' as sparsevec)); +go + +SELECT l1_distance(CAST('{1:1,3:3,5:5,7:7}/8' as sparsevec), CAST('{2:2,4:4,6:6,8:8}/8' as sparsevec)); +go + +SELECT l1_distance(CAST('{1:1,3:3,5:5,7:7,9:9}/9' as sparsevec), CAST('{2:2,4:4,6:6,8:8}/9' as sparsevec)); +go + +SELECT CAST('{}/2' as sparsevec) <+> CAST('{1:3,2:4}/2' as sparsevec); +go + +SELECT l2_normalize(CAST('{1:3,2:4}/2' as sparsevec)); +go + +SELECT l2_normalize(CAST('{1:3}/2' as sparsevec)); +go + +SELECT l2_normalize(CAST('{2:0.1}/2' as sparsevec)); +go + +SELECT l2_normalize(CAST('{}/2' as sparsevec)); +go + +SELECT l2_normalize(CAST('{1:3e38}/1' as sparsevec)); +go + +SELECT l2_normalize(CAST('{1:3e38,2:1e-37}/2' as sparsevec)); +go + +SELECT l2_normalize(CAST('{2:3e37,4:3e-37,6:4e37,8:4e-37}/9' as sparsevec)); +go + +-- L2 + +CREATE TABLE sparsevec_table (val sparsevec(3)); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{}/3' AS sparsevec)), (CAST('{1:1,2:2,3:3}/3' AS sparsevec)), (CAST('{1:1,2:1,3:1}/3' AS sparsevec)), (NULL); +go + +CREATE INDEX idx ON sparsevec_table USING hnsw (val sparsevec_l2_ops); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{1:1,2:2,3:4}/3' AS sparsevec)); +go + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +SELECT * FROM sparsevec_table ORDER BY val <-> CAST('{1:3,2:3,3:3}/3' AS sparsevec); +go + +SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <-> (SELECT CAST(NULL as sparsevec))) t2; +go + +SELECT COUNT(*) FROM sparsevec_table; +go + +TRUNCATE TABLE sparsevec_table; +go + +SELECT * FROM sparsevec_table ORDER BY val <-> CAST('{1:3,2:3,3:3}/3' AS sparsevec); +go + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE sparsevec_table; +go + +-- inner product + +CREATE TABLE sparsevec_table (val sparsevec(3)); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{}/3' AS sparsevec)), (CAST('{1:1,2:2,3:3}/3' AS sparsevec)), (CAST('{1:1,2:1,3:1}/3' AS sparsevec)), (NULL); +go + +CREATE INDEX idx ON sparsevec_table USING hnsw (val sparsevec_ip_ops); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{1:1,2:2,3:4}/3' AS sparsevec)); +go + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +SELECT * FROM sparsevec_table ORDER BY val <#> CAST('{1:3,2:3,3:3}/3' AS sparsevec); +go + +SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <#> (SELECT CAST(NULL as sparsevec))) t2; +go + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE sparsevec_table; +go + +-- cosine + +CREATE TABLE sparsevec_table (val sparsevec(3)); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{}/3' AS sparsevec)), (CAST('{1:1,2:2,3:3}/3' AS sparsevec)), (CAST('{1:1,2:1,3:1}/3' AS sparsevec)), (NULL); +go + +CREATE INDEX idx ON sparsevec_table USING hnsw (val sparsevec_cosine_ops); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{1:1,2:2,3:4}/3' AS sparsevec)); +go + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +SELECT * FROM sparsevec_table ORDER BY val <=> CAST('{1:3,2:3,3:3}/3' AS sparsevec); +go + +SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <=> CAST('{}/3' AS sparsevec)) t2; +go + +SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <=> (SELECT CAST(NULL as sparsevec))) t2; +go + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE sparsevec_table; +go + +-- L1 + +CREATE TABLE sparsevec_table (val sparsevec(3)); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{}/3' AS sparsevec)), (CAST('{1:1,2:2,3:3}/3' AS sparsevec)), (CAST('{1:1,2:1,3:1}/3' AS sparsevec)), (NULL); +go + +CREATE INDEX idx ON sparsevec_table USING hnsw (val sparsevec_l1_ops); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST('{1:1,2:2,3:4}/3' AS sparsevec)); +go + +-- test explain output for index scan +SET BABELFISH_STATISTICS PROFILE ON; SELECT set_config('enable_seqscan', 'off', false); +go +SELECT * FROM sparsevec_table ORDER BY val <+> CAST('{1:3,2:3,3:3}/3' AS sparsevec); +go + +SELECT COUNT(*) FROM (SELECT * FROM sparsevec_table ORDER BY val <+> (SELECT CAST(NULL as sparsevec))) t2; +go + +SET BABELFISH_STATISTICS PROFILE OFF; SELECT set_config('enable_seqscan', 'on', false); +DROP TABLE sparsevec_table; +go + +-- non-zero elements + +CREATE TABLE sparsevec_table (val sparsevec(1001)); +go + +INSERT INTO sparsevec_table (val) VALUES (CAST(array_fill(1, ARRAY[1001]) AS sparsevec)); +go + +CREATE INDEX idx ON sparsevec_table USING hnsw (val sparsevec_l2_ops); +go + +TRUNCATE TABLE sparsevec_table; +go + +DROP TABLE sparsevec_table; +go + +select set_config('babelfishpg_tsql.explain_costs', 'on', false); +go +select set_config('babelfishpg_tsql.explain_timing', 'on', false); +go +select set_config('babelfishpg_tsql.explain_summary', 'on', false); +go + +-- system metadata, all objects get their datatype info from one of: +-- typecodes or datatype_info data we have created. Testing sys.types for typecodes +-- and sp_sproc_columns_100 for datatype_info is enough +select count(*) from sys.types where name = 'sparsevec'; +go + +create procedure sparsevec_proc_1 @a sparsevec, @b varchar(max) as select @a as a, @b as b; +go + +exec sp_sproc_columns_100 @procedure_name= 'sparsevec_proc_1' +go + +drop procedure sparsevec_proc_1; +go + +create table t(a sparsevec(3), b varchar(max)) +go +select * from information_schema.columns where table_name = 't' +go +select count(*) from sys.columns where object_id = sys.object_id('t') +go +drop table t; +go + +-- Testing with different typmod +CREATE TABLE document_embeddings ( + id int PRIMARY KEY, + embedding sparsevec(5) NOT NULL +); +go +CREATE INDEX document_embeddings_embedding_idx ON document_embeddings USING hnsw (embedding vector_l2_ops); +go +INSERT INTO document_embeddings(id, embedding) VALUES(1, CAST('{1:5,2:1}/5' as sparsevec)); +INSERT INTO document_embeddings(id, embedding) VALUES(2, CAST('{1:5, 2:10000, 3:-9.75, 4:8}/5' as sparsevec)); +INSERT INTO document_embeddings(id, embedding) VALUES(3, CAST('{1:-0.02,2:23,4:3.14,5:00}/5' as sparsevec)); +WITH cte AS ( + SELECT CAST(2e2 AS real) a, 80 b, CAST('-305' AS real) c, -1 d +) +INSERT INTO document_embeddings(id, embedding) SELECT 4, CAST(CONCAT('{1:',a, ',3:', b, ',4:', c, ',5:', d, '}/5') as sparsevec) FROM cte; +go +SELECT * FROM document_embeddings; +go +SELECT TOP 5 * FROM document_embeddings ORDER BY embedding <=> '{1:1,2:2,3:4}/5'; +go +-- extending PG syntax to have generic vector expression support +SELECT count(embedding <-> '{1:1,2:2,3:4}/5') FROM document_embeddings; +SELECT count(embedding <=> '{1:1,2:2,3:4}/5') FROM document_embeddings; +SELECT count(embedding <#> '{1:1,2:2,3:4}/5') FROM document_embeddings; +go + +-- WHERE clause expressions +SELECT * FROM document_embeddings WHERE embedding <-> '{1:1,2:2,4:4}/5' < 5; +SELECT * FROM document_embeddings WHERE embedding <=> '{1:1,2:2,4:4}/5' < 5; +SELECT * FROM document_embeddings WHERE embedding <#> '{1:1,2:2,4:4}/5' < 5; +go + +SELECT AVG(embedding) FROM document_embeddings; +go + +SELECT id, AVG(embedding) FROM document_embeddings GROUP BY id; +go + +Drop table document_embeddings +go + +-- psql +-- Need to terminate active session before cleaning up the login +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'vector_login' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +GO + +-- tsql +use master +go + +exec sp_execute_postgresql 'drop extension vector'; +go + +drop login vector_login +go + +drop database vector_db; +go \ No newline at end of file diff --git a/test/JDBC/input/datatypes/TestSpatialPoint-vu-verify.sql b/test/JDBC/input/datatypes/TestSpatialPoint-vu-verify.sql index 653a2d74347..00f0505c14f 100644 --- a/test/JDBC/input/datatypes/TestSpatialPoint-vu-verify.sql +++ b/test/JDBC/input/datatypes/TestSpatialPoint-vu-verify.sql @@ -30,7 +30,7 @@ SELECT @point.STY; Go DECLARE @point geometry; -SET @point = geometry::POINT(22.34900, -47.65100, 4326); +SET @point = geometry::Point(22.34900, -47.65100, 4326); SELECT STX(@point); SELECT STY(@point); SELECT @point.STX; @@ -65,7 +65,7 @@ go DECLARE @point1 geometry, @point2 geometry, @point3 geometry; SET @point1 = geometry::STPointFromText(null, 4326); SET @point2 = geometry::STGeomFromText(null, 4326); -SET @point3 = geometry::POINT(22.34900, -47.65100, 4326); +SET @point3 = geometry::Point(22.34900, -47.65100, 4326); SELECT @point1.STX; SELECT @point1.STY; SELECT @point1.STAsText(); @@ -77,7 +77,7 @@ Go -- Negative test for Geospatial functions DECLARE @point1 geometry, @point2 varchar(50), @point3 int; -SET @point1 = geometry::POINT(22.34900, -47.65100, 4326);; +SET @point1 = geometry::Point(22.34900, -47.65100, 4326);; SET @point2 = 'Test_String'; SELECT @point1.STDistance(@point2); Go @@ -669,7 +669,7 @@ SELECT @point.STAsText(); Go DECLARE @point geography; -SET @point = geography::POINT(22.34900, -47.65100, 4326); +SET @point = geography::Point(22.34900, -47.65100, 4326); SELECT STAsText(@point); SELECT @point.STAsText(); Go @@ -683,7 +683,7 @@ SELECT @point.Lat; Go DECLARE @point geography; -SET @point = geography::POINT(22.34900, -47.65100, 4326); +SET @point = geography::Point(22.34900, -47.65100, 4326); SELECT Long(@point); SELECT Lat(@point); SELECT @point.Long; @@ -759,7 +759,7 @@ go DECLARE @point1 geography, @point2 geography, @point3 geography; SET @point1 = geography::STPointFromText(null, 4326); SET @point2 = geography::STGeomFromText(null, 4326); -SET @point3 = geography::POINT(22.34900, -47.65100, 4326); +SET @point3 = geography::Point(22.34900, -47.65100, 4326); SELECT @point1.Long; SELECT @point1.Lat; SELECT @point1.STAsText(); @@ -771,7 +771,7 @@ Go -- Negative test for Geospatial functions DECLARE @point1 geography, @point2 varchar(50), @point3 int; -SET @point1 = geography::POINT(22.34900, -47.65100, 4326); +SET @point1 = geography::Point(22.34900, -47.65100, 4326); SET @point2 = 'Test_String'; SELECT @point2.STDistance(@point1); Go diff --git a/test/JDBC/input/datatypes/TestVectorDatatype.mix b/test/JDBC/input/datatypes/TestVectorDatatype.mix index da60cb1e24d..b79f2bce421 100644 --- a/test/JDBC/input/datatypes/TestVectorDatatype.mix +++ b/test/JDBC/input/datatypes/TestVectorDatatype.mix @@ -52,7 +52,7 @@ go SELECT CAST('[1e-37]' as vector) * '[1e-37]'; go -SELECT vector_dims('[1,2,3]'); +SELECT vector_dims(CAST('[1,2,3]' as vector)); go SELECT round(cast(vector_norm('[1,1]') as numeric), 5); @@ -67,64 +67,64 @@ go SELECT vector_norm(Cast('[3e37,4e37]') as real); go -SELECT l2_distance('[0,0]', '[3,4]'); +SELECT l2_distance(CAST('[0,0]' as vector), CAST('[3,4]' as vector)); go -SELECT l2_distance('[0,0]', '[0,1]'); +SELECT l2_distance(CAST('[0,0]' as vector), CAST('[0,1]' as vector)); go -SELECT l2_distance('[1,2]', '[3]'); +SELECT l2_distance(CAST('[1,2]' as vector), CAST('[3]' as vector)); go -SELECT l2_distance('[3e38]', '[-3e38]'); +SELECT l2_distance(CAST('[3e38]' as vector), CAST('[-3e38]' as vector)); go -SELECT inner_product('[1,2]', '[3,4]'); +SELECT inner_product(CAST('[1,2]' as vector), CAST('[3,4]' as vector)); go -SELECT inner_product('[1,2]', '[3]'); +SELECT inner_product(CAST('[1,2]' as vector), CAST('[3]' as vector)); go -SELECT inner_product('[3e38]', '[3e38]'); +SELECT inner_product(CAST('[3e38]' as vector), CAST('[3e38]' as vector)); go -SELECT cosine_distance('[1,2]', '[2,4]'); +SELECT cosine_distance(CAST('[1,2]' as vector), CAST('[2,4]' as vector)); go -SELECT cosine_distance('[1,2]', '[0,0]'); +SELECT cosine_distance(CAST('[1,2]' as vector), CAST('[0,0]' as vector)); go -SELECT cosine_distance('[1,1]', '[1,1]'); +SELECT cosine_distance(CAST('[1,1]' as vector), CAST('[1,1]' as vector)); go -SELECT cosine_distance('[1,0]', '[0,2]'); +SELECT cosine_distance(CAST('[1,0]' as vector), CAST('[0,2]' as vector)); go -SELECT cosine_distance('[1,1]', '[-1,-1]'); +SELECT cosine_distance(CAST('[1,1]' as vector), CAST('[-1,-1]' as vector)); go -SELECT cosine_distance('[1,2]', '[3]'); +SELECT cosine_distance(CAST('[1,2]' as vector), CAST('[3]' as vector)); go -SELECT cosine_distance('[1,1]', '[1.1,1.1]'); +SELECT cosine_distance(CAST('[1,1]' as vector), CAST('[1.1,1.1]' as vector)); go -SELECT cosine_distance('[1,1]', '[-1.1,-1.1]'); +SELECT cosine_distance(CAST('[1,1]' as vector), CAST('[-1.1,-1.1]' as vector)); go -SELECT cosine_distance('[3e38]', '[3e38]'); +SELECT cosine_distance(CAST('[3e38]' as vector), CAST('[3e38]' as vector)); go -SELECT l1_distance('[0,0]', '[3,4]'); +SELECT l1_distance(CAST('[0,0]' as vector), CAST('[3,4]' as vector)); go -SELECT l1_distance('[0,0]', '[0,1]'); +SELECT l1_distance(CAST('[0,0]' as vector), CAST('[0,1]' as vector)); go -SELECT l1_distance('[1,2]', '[3]'); +SELECT l1_distance(CAST('[1,2]' as vector), CAST('[3]' as vector)); go -SELECT l1_distance('[3e38]', '[-3e38]'); +SELECT l1_distance(CAST('[3e38]' as vector), CAST('[-3e38]' as vector)); go SELECT vector_avg(array_agg(n)) FROM generate_series(1, 16002) n; diff --git a/test/JDBC/input/datatypes/babel_726.sql b/test/JDBC/input/datatypes/babel_726.sql index 26c0e434710..bf404a82bee 100644 --- a/test/JDBC/input/datatypes/babel_726.sql +++ b/test/JDBC/input/datatypes/babel_726.sql @@ -290,6 +290,16 @@ go select coalesce(CAST('x'AS VARBINARY), CAST('x' AS NVARCHAR(4000)), 'x') go +-- check that duplicate view with varbinary cast does not cause crash (#2693) +create view babel_726_v1 as select cast('a' as varbinary) +go + +create view babel_726_v1 as select cast('a' as varbinary) +go + +drop view babel_726_v1 +go + drop table babel_726_t1 go diff --git a/test/JDBC/input/datatypes/binary-datatype-operators-vu-cleanup.sql b/test/JDBC/input/datatypes/binary-datatype-operators-vu-cleanup.sql new file mode 100644 index 00000000000..65b3ecd5afb --- /dev/null +++ b/test/JDBC/input/datatypes/binary-datatype-operators-vu-cleanup.sql @@ -0,0 +1,57 @@ +-- drop views +DROP VIEW binary_datatype_operators_less_than_view +GO + +DROP VIEW binary_datatype_operators_less_than_equal_view +GO + +DROP VIEW binary_datatype_operators_greater_than_view +GO + +DROP VIEW binary_datatype_operators_greater_than_equal_view +GO + +DROP VIEW binary_datatype_operators_equal_view +GO + +DROP VIEW binary_datatype_operators_not_equal_view +GO +-- drop procedure +DROP PROCEDURE binary_datatype_operators_less_than_proc +GO + +DROP PROCEDURE binary_datatype_operators_less_than_equal_proc +GO + +DROP PROCEDURE binary_datatype_operators_greater_than_proc +GO + +DROP PROCEDURE binary_datatype_operators_greater_than_equal_proc +GO + +DROP PROCEDURE binary_datatype_operators_equal_proc +GO + +DROP PROCEDURE binary_datatype_operators_not_equal_proc +GO +-- drop function +DROP FUNCTION binary_datatype_operators_less_than_func +GO + +DROP FUNCTION binary_datatype_operators_less_than_equal_func +GO + +DROP FUNCTION binary_datatype_operators_greater_than_func +GO + +DROP FUNCTION binary_datatype_operators_greater_than_equal_func +GO + +DROP FUNCTION binary_datatype_operators_equal_func +GO + +DROP FUNCTION binary_datatype_operators_not_equal_func +GO +-- drop table +DROP TABLE binary_datatype_operators_test_table +GO \ No newline at end of file diff --git a/test/JDBC/input/datatypes/binary-datatype-operators-vu-prepare.sql b/test/JDBC/input/datatypes/binary-datatype-operators-vu-prepare.sql new file mode 100644 index 00000000000..7bd504e84ed --- /dev/null +++ b/test/JDBC/input/datatypes/binary-datatype-operators-vu-prepare.sql @@ -0,0 +1,159 @@ +-- Create the table +CREATE TABLE binary_datatype_operators_test_table ( + col1 BINARY(3), + col2 BINARY(3) +); +GO + +-- Insert data for testing +INSERT INTO binary_datatype_operators_test_table (col1, col2) VALUES + (0x121212, 0x121212), -- col1 = col2 + (0x111111, 0x121212), -- col1 < col2 + (0x121212, 0x111111); -- col1 > col2 +GO + +-- Inside Views +CREATE VIEW binary_datatype_operators_less_than_view +AS + SELECT col1, col2, 'col1 < col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 < col2; +GO + +CREATE VIEW binary_datatype_operators_less_than_equal_view +AS + SELECT col1, col2, 'col1 <= col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 <= col2; +GO + + +CREATE VIEW binary_datatype_operators_greater_than_view +AS + SELECT col1, col2, 'col1 > col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 > col2; +GO + +CREATE VIEW binary_datatype_operators_greater_than_equal_view +AS + SELECT col1, col2, 'col1 >= col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 >= col2; +GO + +CREATE VIEW binary_datatype_operators_equal_view +AS + SELECT col1, col2, 'col1 = col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 = col2; +GO + +CREATE VIEW binary_datatype_operators_not_equal_view +AS + SELECT col1, col2, 'col1 <> col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 <> col2; +GO + +-- Inside Procedure +CREATE PROC binary_datatype_operators_less_than_proc +AS + SELECT col1, col2, 'col1 < col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 < col2; +GO + +CREATE PROC binary_datatype_operators_less_than_equal_proc +AS + SELECT col1, col2, 'col1 <= col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 <= col2; +GO + + +CREATE PROC binary_datatype_operators_greater_than_proc +AS + SELECT col1, col2, 'col1 > col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 > col2; +GO + +CREATE PROC binary_datatype_operators_greater_than_equal_proc +AS + SELECT col1, col2, 'col1 >= col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 >= col2; +GO + +CREATE PROC binary_datatype_operators_equal_proc +AS + SELECT col1, col2, 'col1 = col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 = col2; +GO + +CREATE PROC binary_datatype_operators_not_equal_proc +AS + SELECT col1, col2, 'col1 <> col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 <> col2; +GO + +-- Inside Function +CREATE FUNCTION binary_datatype_operators_less_than_func() +RETURNS TABLE AS +RETURN( + SELECT col1, col2, 'col1 < col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 < col2 +); +GO + +CREATE FUNCTION binary_datatype_operators_less_than_equal_func() +RETURNS TABLE AS +RETURN( + SELECT col1, col2, 'col1 <= col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 <= col2 +); +GO + + +CREATE FUNCTION binary_datatype_operators_greater_than_func() +RETURNS TABLE AS +RETURN( + SELECT col1, col2, 'col1 > col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 > col2 +); +GO + +CREATE FUNCTION binary_datatype_operators_greater_than_equal_func() +RETURNS TABLE AS +RETURN( + SELECT col1, col2, 'col1 >= col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 >= col2 +); +GO + +CREATE FUNCTION binary_datatype_operators_equal_func() +RETURNS TABLE AS +RETURN( + SELECT col1, col2, 'col1 = col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 = col2 +); +GO + +CREATE FUNCTION binary_datatype_operators_not_equal_func() +RETURNS TABLE AS +RETURN( + SELECT col1, col2, 'col1 <> col2 ' AS [Comparison] + FROM binary_datatype_operators_test_table + WHERE col1 <> col2 +); +GO + + diff --git a/test/JDBC/input/datatypes/binary-datatype-operators-vu-verify.sql b/test/JDBC/input/datatypes/binary-datatype-operators-vu-verify.sql new file mode 100644 index 00000000000..bf8d8846d56 --- /dev/null +++ b/test/JDBC/input/datatypes/binary-datatype-operators-vu-verify.sql @@ -0,0 +1,56 @@ +-- inside view +SELECT * FROM binary_datatype_operators_less_than_view +GO + +SELECT * FROM binary_datatype_operators_less_than_equal_view +GO + +SELECT * FROM binary_datatype_operators_greater_than_view +GO + +SELECT * FROM binary_datatype_operators_greater_than_equal_view +GO + +SELECT * FROM binary_datatype_operators_equal_view +GO + +SELECT * FROM binary_datatype_operators_not_equal_view +GO + +-- inside procedure +EXEC binary_datatype_operators_less_than_proc +GO + +EXEC binary_datatype_operators_less_than_equal_proc +GO + +EXEC binary_datatype_operators_greater_than_proc +GO + +EXEC binary_datatype_operators_greater_than_equal_proc +GO + +EXEC binary_datatype_operators_equal_proc +GO + +EXEC binary_datatype_operators_not_equal_proc +GO + +-- inside function +SELECT * FROM binary_datatype_operators_less_than_func() +GO + +SELECT * FROM binary_datatype_operators_less_than_equal_func() +GO + +SELECT * FROM binary_datatype_operators_greater_than_func() +GO + +SELECT * FROM binary_datatype_operators_greater_than_equal_func() +GO + +SELECT * FROM binary_datatype_operators_equal_func() +GO + +SELECT * FROM binary_datatype_operators_not_equal_func() +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_agg-vu-cleanup.sql b/test/JDBC/input/functions/string_agg-vu-cleanup.sql new file mode 100644 index 00000000000..ea5e706c59f --- /dev/null +++ b/test/JDBC/input/functions/string_agg-vu-cleanup.sql @@ -0,0 +1,44 @@ +DROP TRIGGER string_agg_tr_concat_student_names +GO + +DROP TABLE string_agg_school_details +GO + +DROP VIEW string_agg_dep_v3 +GO + +DROP PROCEDURE string_agg_dep_p3 +GO + +DROP FUNCTION string_agg_dep_f3 +GO + +DROP VIEW string_agg_dep_v2 +GO + +DROP PROCEDURE string_agg_dep_p2 +GO + +DROP FUNCTION string_agg_dep_f2 +GO + +DROP VIEW string_agg_dep_v1 +GO + +DROP PROCEDURE string_agg_dep_p1 +GO + +DROP FUNCTION string_agg_dep_f1 +GO + +DROP TABLE string_agg_multibyte_t +GO + +DROP TABLE string_agg_chinese_prc_ci_as +GO + +DROP TABLE string_agg_t2 +GO + +DROP TABLE string_agg_t +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_agg-vu-prepare.sql b/test/JDBC/input/functions/string_agg-vu-prepare.sql new file mode 100644 index 00000000000..6c498e9edb1 --- /dev/null +++ b/test/JDBC/input/functions/string_agg-vu-prepare.sql @@ -0,0 +1,123 @@ +CREATE TABLE string_agg_t (id int, a varchar(10), b varchar(10), g int, sbid int) +go + +INSERT INTO string_agg_t values +(3,'c','x',1,4), +(2,'b','y',2,6), +(2,'g','u',2,5), +(1,'a','z',1,7), +(5,'e','v',2,1), +(4,'d','w',1,3), +(4,'h','t',1,2), +(NULL,NULL,'s',2,NULL) +go + +CREATE TABLE string_agg_t2 (id int, a varchar(10), g1 int, g2 int) +go + +INSERT INTO string_agg_t2 values +(1,'b',2,1), +(2,'g',2,1), +(3,'e',2,1), +(1,'a',1,2), +(2,'c',1,2), +(3,'d',1,2), +(4,'h',1,2), +(1,'d',3,1), +(2,'h',3,1) +go + +CREATE TABLE string_agg_multibyte_t (id int, a nvarchar(10), g int, sbid int) +go +INSERT INTO string_agg_multibyte_t VALUES +(3,N'😎',1,4), +(2,N'莫',2,6), +(2,N'😇',2,5), +(1,N'尔',1,7), +(5,N'莫',2,1) +GO + +CREATE TABLE string_agg_chinese_prc_ci_as(id int, a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS, g int, sbid int) +GO +INSERT INTO string_agg_chinese_prc_ci_as VALUES +(1,N'莫',1,5), +(2,N'尔',2,4), +(2,N'拉',2,3), +(3,N'比',1,2), +(5,N'斯',2,1) +GO + +CREATE VIEW string_agg_dep_v1 AS + SELECT STRING_AGG (a, '-') as result FROM string_agg_t +GO + +CREATE PROCEDURE string_agg_dep_p1 AS + SELECT STRING_AGG (a, '-') FROM string_agg_t +GO + +CREATE FUNCTION string_agg_dep_f1() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT STRING_AGG (a, '-') FROM string_agg_t) +END +GO + +CREATE VIEW string_agg_dep_v2 AS + SELECT STRING_AGG (a, '-') as result FROM string_agg_t GROUP BY g +GO + +CREATE PROCEDURE string_agg_dep_p2 AS + SELECT STRING_AGG (a, '-') FROM string_agg_t GROUP BY g +GO + +CREATE FUNCTION string_agg_dep_f2() +RETURNS TABLE +AS +RETURN (SELECT STRING_AGG (a, '-') as result FROM string_agg_t GROUP BY g) +GO + +CREATE VIEW string_agg_dep_v3 AS + SELECT STRING_AGG (a, '-') WITHIN GROUP (ORDER BY sbid) as result FROM string_agg_t GROUP BY g +GO + +CREATE PROCEDURE string_agg_dep_p3 AS + SELECT STRING_AGG (a, '-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g +GO + +CREATE FUNCTION string_agg_dep_f3() +RETURNS TABLE +AS +RETURN (SELECT STRING_AGG (a, '-') WITHIN GROUP (ORDER BY sbid) as result FROM string_agg_t GROUP BY g) +GO + +-- Create a table to test the trigger +CREATE TABLE string_agg_school_details ( + classID INT, + rollID INT, + studentName VARCHAR(50) +); +GO + +INSERT INTO string_agg_school_details (classID, rollID, studentName) +VALUES + (1, 2, 'StudentB'), + (1, 1, 'StudentA'), + (1, 3, 'StudentC'), + (2, 2, 'StudentE'), + (2, 1, 'StudentD') +GO + +-- Create a trigger to display classID, list of student names seperated by ', ' +CREATE TRIGGER string_agg_tr_concat_student_names +ON string_agg_school_details +AFTER INSERT, UPDATE, DELETE +AS +BEGIN + SELECT classID, STRING_AGG(studentName, ', ') + WITHIN GROUP (ORDER BY rollID) + FROM string_agg_school_details + GROUP BY classID + ORDER BY classID; +END; +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_agg-vu-verify.sql b/test/JDBC/input/functions/string_agg-vu-verify.sql new file mode 100644 index 00000000000..43da3af3ef2 --- /dev/null +++ b/test/JDBC/input/functions/string_agg-vu-verify.sql @@ -0,0 +1,238 @@ +-- expression as column +SELECT STRING_AGG(a,'-') FROM string_agg_t +GO + +SELECT STRING_AGG(a,'-') FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +-- expression as expression of multiple columns +SELECT STRING_AGG(a+b,'-') FROM string_agg_t +GO + +SELECT STRING_AGG(a+b,'-') FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +-- expression as function +SELECT STRING_AGG(concat(a,b),'-') FROM string_agg_t +GO + +SELECT STRING_AGG(concat(a,b),'-') FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +-- Delimeter as a function +SELECT STRING_AGG(a, char(10)) FROM string_agg_t +GO + +SELECT STRING_AGG(a, char(10)) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +-- order by clause on string column +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY a ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY a DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY a+b ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a+b,'-') WITHIN GROUP (ORDER BY a+b DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY concat(a,b) ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(concat(a,b),'-') WITHIN GROUP (ORDER BY concat(a,b) DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY a ASC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY a DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +-- Batch statements +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid) FROM string_agg_t GROUP BY g ORDER BY g +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_t GROUP BY g ORDER BY g +SELECT STRING_AGG(a, char(10)) WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_t GROUP BY g ORDER BY g +GO + +-- expression as column with multibyte characters +SELECT STRING_AGG(a,'-') FROM string_agg_multibyte_t +GO + +SELECT STRING_AGG(a,'-') FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO + +-- casting result to NVARCHAR to verify the output +SELECT CAST(STRING_AGG(a,'-') AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t +GO + +SELECT CAST(STRING_AGG(a,'-') AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO + +SELECT CAST(STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid) AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO + +SELECT CAST(STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid ASC) AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO + +SELECT CAST(STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid DESC) AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO + +SELECT CAST(STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid ASC) AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO + +SELECT CAST(STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid DESC) AS sys.NVARCHAR(100)) FROM string_agg_multibyte_t GROUP BY g ORDER BY g +GO + +-- expression as column with chinese characters +SELECT STRING_AGG(a,'-') FROM string_agg_chinese_prc_ci_as +GO + +SELECT STRING_AGG(a,'-') FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid) FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid ASC) FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY sbid DESC) FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid ASC) FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO + +SELECT STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id, sbid DESC) FROM string_agg_chinese_prc_ci_as GROUP BY g ORDER BY g +GO + +-- expression from a column of a subquery +SELECT STRING_AGG(sbq.b,'-') WITHIN GROUP (ORDER BY g1) FROM (SELECT g1, g2, STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id) as 'b' FROM string_agg_t2 GROUP BY g1, g2) as sbq GROUP BY g2 ORDER BY g2 +GO + +SELECT STRING_AGG(sbq.b,'-') WITHIN GROUP (ORDER BY g1 ASC) FROM (SELECT g1, g2, STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id ASC) as 'b' FROM string_agg_t2 GROUP BY g1, g2) as sbq GROUP BY g2 ORDER BY g2 +GO + +SELECT STRING_AGG(sbq.b,'-') WITHIN GROUP (ORDER BY g1 DESC) FROM (SELECT g1, g2, STRING_AGG(a,'-') WITHIN GROUP (ORDER BY id DESC) as 'b' FROM string_agg_t2 GROUP BY g1, g2) as sbq GROUP BY g2 ORDER BY g2 +GO + +-- Dependent objects +SELECT * FROM string_agg_dep_v1 +GO + +EXEC string_agg_dep_p1 +GO + +SELECT dbo.string_agg_dep_f1() +GO + +SELECT * FROM string_agg_dep_v2 +GO + +EXEC string_agg_dep_p2 +GO + +SELECT * FROM dbo.string_agg_dep_f2() +GO + +SELECT * FROM string_agg_dep_v3 +GO + +EXEC string_agg_dep_p3 +GO + +SELECT * FROM dbo.string_agg_dep_f3() +GO + +-- dependent object trigger +INSERT INTO string_agg_school_details (classID, rollID, studentName) +VALUES (2, 3, 'StudentF'); +GO + +UPDATE string_agg_school_details +SET studentName = 'StudentG' +WHERE classID = 2 AND rollID = 3; +GO + +DELETE FROM string_agg_school_details +WHERE classID = 1 AND rollID = 2; +GO diff --git a/test/JDBC/input/functions/string_functions/left-before-15_8-or-16_4-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/left-before-15_8-or-16_4-vu-cleanup.sql new file mode 100644 index 00000000000..cabd616f301 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/left-before-15_8-or-16_4-vu-cleanup.sql @@ -0,0 +1,80 @@ +DROP FUNCTION babel_4489_left_itvf_func +GO + +DROP FUNCTION babel_4489_left_dep_func +GO + +DROP PROCEDURE babel_4489_left_dep_proc +GO + +DROP VIEW babel_4489_left_dep_view +GO + +DROP TABLE babel_4489_left_UDT +GO + +DROP VIEW babel_4489_left_dep_view_1 +GO + +DROP VIEW babel_4489_left_dep_view_2 +GO + +DROP VIEW babel_4489_left_dep_view_3 +GO + +DROP VIEW babel_4489_left_dep_view_4 +GO + +DROP VIEW babel_4489_left_dep_view_5 +GO + +DROP VIEW babel_4489_left_dep_view_6 +GO + +DROP VIEW babel_4489_left_dep_view_7 +GO + +DROP TYPE dbo.babel_4489_left_varUDT +GO + +DROP TYPE dbo.babel_4489_left_imageUDT +GO + +DROP TABLE babel_4489_left_text +GO + +DROP TABLE babel_4489_left_image +GO + +DROP TABLE babel_4489_left_arabic_ci_ai +GO + +DROP TABLE babel_4489_left_arabic_cs_as +GO + +DROP TABLE babel_4489_left_arabic_ci_as +GO + +DROP TABLE babel_4489_left_chinese_prc_ci_ai +GO + +DROP TABLE babel_4489_left_chinese_prc_cs_as +GO + +DROP TABLE babel_4489_left_chinese_prc_ci_as +GO + +DROP TABLE babel_4489_left_t5 +GO + +DROP TABLE babel_4489_left_t4 +GO + +DROP TABLE babel_4489_left_t3 +GO + +DROP TABLE babel_4489_left_t2 +GO + +DROP TABLE babel_4489_left_t1 +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/left-before-15_8-or-16_4-vu-prepare.sql b/test/JDBC/input/functions/string_functions/left-before-15_8-or-16_4-vu-prepare.sql new file mode 100644 index 00000000000..65ae5999db3 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/left-before-15_8-or-16_4-vu-prepare.sql @@ -0,0 +1,126 @@ +CREATE TABLE babel_4489_left_t1(a NCHAR(50)) +GO +INSERT INTO babel_4489_left_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_4489_left_t1 VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4489_left_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4489_left_t2 VALUES(N'abc🙂defghi🙂🙂') +GO + +CREATE TABLE babel_4489_left_t3(a CHAR(50)) +GO +INSERT INTO babel_4489_left_t3 VALUES(' abcdefghi ') +GO + +CREATE TABLE babel_4489_left_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4489_left_t4 VALUES(' abcdefghi ') +GO + +CREATE TABLE babel_4489_left_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4489_left_t5 VALUES(0x2020616263642020) +GO + +CREATE TABLE babel_4489_left_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4489_left_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4489_left_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4489_left_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4489_left_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4489_left_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4489_left_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4489_left_arabic_ci_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4489_left_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4489_left_arabic_cs_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4489_left_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4489_left_arabic_ci_ai VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4489_left_image(a IMAGE) +GO +INSERT INTO babel_4489_left_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_4489_left_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4489_left_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO + +CREATE TYPE dbo.babel_4489_left_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4489_left_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4489_left_UDT(a dbo.babel_4489_left_imageUDT, b dbo.babel_4489_left_varUDT) +GO +INSERT INTO babel_4489_left_UDT VALUES(CAST('abcdef' as dbo.babel_4489_left_imageUDT), CAST('abcdef' as dbo.babel_4489_left_varUDT)) +GO + +CREATE VIEW babel_4489_left_dep_view AS + SELECT LEFT(a, 5) as result from babel_4489_left_t2 +GO + +CREATE PROCEDURE babel_4489_left_dep_proc AS + SELECT LEFT(a, 5) as result from babel_4489_left_t2 +GO + +CREATE FUNCTION babel_4489_left_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 LEFT(a, 5) from babel_4489_left_t2) +END +GO + +CREATE VIEW babel_4489_left_dep_view_1 AS + SELECT LEFT(a, 5) as result FROM babel_4489_left_t1 +GO + +CREATE VIEW babel_4489_left_dep_view_2 AS + SELECT LEFT(a, 5) as result FROM babel_4489_left_t2 +GO + +CREATE VIEW babel_4489_left_dep_view_3 AS + SELECT LEFT(a, 5) as result FROM babel_4489_left_t3 +GO + +CREATE VIEW babel_4489_left_dep_view_4 AS + SELECT LEFT(a, 5) as result FROM babel_4489_left_t4 +GO + +CREATE VIEW babel_4489_left_dep_view_5 AS + SELECT LEFT(a, 5) as result FROM babel_4489_left_t5 +GO + +CREATE VIEW babel_4489_left_dep_view_6 AS + SELECT LEFT(a, 5) as result FROM babel_4489_left_text +GO + +CREATE VIEW babel_4489_left_dep_view_7 AS + SELECT LEFT(b, 5) as result FROM babel_4489_left_text +GO + +CREATE FUNCTION babel_4489_left_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT LEFT(a, 5) as result from babel_4489_left_t2) +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/left-before-15_8-or-16_4-vu-verify.sql b/test/JDBC/input/functions/string_functions/left-before-15_8-or-16_4-vu-verify.sql new file mode 100644 index 00000000000..79b7b7d32d2 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/left-before-15_8-or-16_4-vu-verify.sql @@ -0,0 +1,328 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(25) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO + +-- NULL +SELECT LEFT(NULL, -2) +GO + +SELECT LEFT(NULL, 0) +GO + +SELECT LEFT(NULL, 2) +GO + +SELECT LEFT('abc', NULL) +GO + +SELECT LEFT(NULL, NULL) +GO + +-- edge case values for second parameter +SELECT LEFT('AbdefGhi', -2) +GO + +SELECT '|' + LEFT('AbdefGhi', 0) + '|' +GO + +SELECT LEFT('AbdefGhi', 2) +GO + +SELECT LEFT('AbdefGhi', 2147483646) +GO + +SELECT LEFT('AbdefGhi', 2147483650) +GO + +-- misc tests +DECLARE @procedure_name NVARCHAR(134) = ';1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO + +DECLARE @procedure_name NVARCHAR(134) = 'procedureName;1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO + +-- procedure name with length equal to 134 +DECLARE @procedure_name NVARCHAR(134) = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 5) + '|' +GO + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) + '|' +GO + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 50) + '|' +GO + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 5) +GO + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT LEFT(@inputString, 4) +GO + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT LEFT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 50) +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_ci_as +GO + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_4489_left_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_cs_as +GO + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_4489_left_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_ci_ai +GO + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_4489_left_chinese_prc_ci_ai +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_ci_as +GO + +SELECT LEFT(a, 4) COLLATE ARABIC_CI_AS FROM babel_4489_left_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_cs_as +GO + +SELECT LEFT(a, 4) COLLATE ARABIC_CS_AS FROM babel_4489_left_arabic_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_ci_ai +GO + +SELECT LEFT(a, 4) COLLATE ARABIC_CI_AI FROM babel_4489_left_arabic_ci_ai +GO + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 5) + '|' +GO + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) + '|' +GO + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 50) + '|' +GO + +-- with table column of type nchar +SELECT '|' + LEFT(a, 5) + '|' FROM babel_4489_left_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 5) +GO + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT LEFT(@inputString, 4) +GO + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 50) +GO + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT LEFT(@inputString, 4) +GO + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT LEFT(@inputString, 4) +GO + +-- dependent objects +SELECT * FROM babel_4489_left_dep_view +GO + +EXEC babel_4489_left_dep_proc +GO + +SELECT * FROM babel_4489_left_dep_func() +GO + +SELECT * FROM babel_4489_left_itvf_func() +GO + +SELECT * FROM babel_4489_left_dep_view_1 +GO + +SELECT * FROM babel_4489_left_dep_view_2 +GO + +SELECT * FROM babel_4489_left_dep_view_3 +GO + +SELECT * FROM babel_4489_left_dep_view_4 +GO + +SELECT * FROM babel_4489_left_dep_view_5 +GO + +SELECT * FROM babel_4489_left_dep_view_6 +GO + +SELECT * FROM babel_4489_left_dep_view_7 +GO + +-- input type UDT +-- -- in table babel_4489_left_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT LEFT(a, 3) FROM babel_4489_left_UDT +GO + +SELECT LEFT(b, 3) FROM babel_4489_left_UDT +GO + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString decimal = 123456; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString numeric = 12345.12; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString float = 12345.1; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString real = 12345.1; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString bigint = 12345678; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString int = 12345678; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString smallint = 12356; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString tinyint = 235; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString money = 12356; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString smallmoney = 12356; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString bit = 1; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT LEFT(@inputString, 3) +GO + +SELECT LEFT(a, 5) from babel_4489_left_image; +GO + +-- input datatype text +SELECT LEFT(a, 5) FROM babel_4489_left_text +GO + +-- input datatype ntext +SELECT LEFT(b, 5) FROM babel_4489_left_text +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LEFT(CAST(@inputString AS VARCHAR(50)), 3) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LEFT(CAST(@inputString AS VARCHAR(50)), 3) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LEFT(CAST(@inputString AS VARCHAR(50)), 3) +GO diff --git a/test/JDBC/input/functions/string_functions/left-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/left-vu-cleanup.sql new file mode 100644 index 00000000000..cabd616f301 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/left-vu-cleanup.sql @@ -0,0 +1,80 @@ +DROP FUNCTION babel_4489_left_itvf_func +GO + +DROP FUNCTION babel_4489_left_dep_func +GO + +DROP PROCEDURE babel_4489_left_dep_proc +GO + +DROP VIEW babel_4489_left_dep_view +GO + +DROP TABLE babel_4489_left_UDT +GO + +DROP VIEW babel_4489_left_dep_view_1 +GO + +DROP VIEW babel_4489_left_dep_view_2 +GO + +DROP VIEW babel_4489_left_dep_view_3 +GO + +DROP VIEW babel_4489_left_dep_view_4 +GO + +DROP VIEW babel_4489_left_dep_view_5 +GO + +DROP VIEW babel_4489_left_dep_view_6 +GO + +DROP VIEW babel_4489_left_dep_view_7 +GO + +DROP TYPE dbo.babel_4489_left_varUDT +GO + +DROP TYPE dbo.babel_4489_left_imageUDT +GO + +DROP TABLE babel_4489_left_text +GO + +DROP TABLE babel_4489_left_image +GO + +DROP TABLE babel_4489_left_arabic_ci_ai +GO + +DROP TABLE babel_4489_left_arabic_cs_as +GO + +DROP TABLE babel_4489_left_arabic_ci_as +GO + +DROP TABLE babel_4489_left_chinese_prc_ci_ai +GO + +DROP TABLE babel_4489_left_chinese_prc_cs_as +GO + +DROP TABLE babel_4489_left_chinese_prc_ci_as +GO + +DROP TABLE babel_4489_left_t5 +GO + +DROP TABLE babel_4489_left_t4 +GO + +DROP TABLE babel_4489_left_t3 +GO + +DROP TABLE babel_4489_left_t2 +GO + +DROP TABLE babel_4489_left_t1 +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/left-vu-prepare.sql b/test/JDBC/input/functions/string_functions/left-vu-prepare.sql new file mode 100644 index 00000000000..65ae5999db3 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/left-vu-prepare.sql @@ -0,0 +1,126 @@ +CREATE TABLE babel_4489_left_t1(a NCHAR(50)) +GO +INSERT INTO babel_4489_left_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_4489_left_t1 VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4489_left_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4489_left_t2 VALUES(N'abc🙂defghi🙂🙂') +GO + +CREATE TABLE babel_4489_left_t3(a CHAR(50)) +GO +INSERT INTO babel_4489_left_t3 VALUES(' abcdefghi ') +GO + +CREATE TABLE babel_4489_left_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4489_left_t4 VALUES(' abcdefghi ') +GO + +CREATE TABLE babel_4489_left_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4489_left_t5 VALUES(0x2020616263642020) +GO + +CREATE TABLE babel_4489_left_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4489_left_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4489_left_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4489_left_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4489_left_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4489_left_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4489_left_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4489_left_arabic_ci_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4489_left_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4489_left_arabic_cs_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4489_left_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4489_left_arabic_ci_ai VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4489_left_image(a IMAGE) +GO +INSERT INTO babel_4489_left_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_4489_left_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4489_left_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO + +CREATE TYPE dbo.babel_4489_left_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4489_left_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4489_left_UDT(a dbo.babel_4489_left_imageUDT, b dbo.babel_4489_left_varUDT) +GO +INSERT INTO babel_4489_left_UDT VALUES(CAST('abcdef' as dbo.babel_4489_left_imageUDT), CAST('abcdef' as dbo.babel_4489_left_varUDT)) +GO + +CREATE VIEW babel_4489_left_dep_view AS + SELECT LEFT(a, 5) as result from babel_4489_left_t2 +GO + +CREATE PROCEDURE babel_4489_left_dep_proc AS + SELECT LEFT(a, 5) as result from babel_4489_left_t2 +GO + +CREATE FUNCTION babel_4489_left_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 LEFT(a, 5) from babel_4489_left_t2) +END +GO + +CREATE VIEW babel_4489_left_dep_view_1 AS + SELECT LEFT(a, 5) as result FROM babel_4489_left_t1 +GO + +CREATE VIEW babel_4489_left_dep_view_2 AS + SELECT LEFT(a, 5) as result FROM babel_4489_left_t2 +GO + +CREATE VIEW babel_4489_left_dep_view_3 AS + SELECT LEFT(a, 5) as result FROM babel_4489_left_t3 +GO + +CREATE VIEW babel_4489_left_dep_view_4 AS + SELECT LEFT(a, 5) as result FROM babel_4489_left_t4 +GO + +CREATE VIEW babel_4489_left_dep_view_5 AS + SELECT LEFT(a, 5) as result FROM babel_4489_left_t5 +GO + +CREATE VIEW babel_4489_left_dep_view_6 AS + SELECT LEFT(a, 5) as result FROM babel_4489_left_text +GO + +CREATE VIEW babel_4489_left_dep_view_7 AS + SELECT LEFT(b, 5) as result FROM babel_4489_left_text +GO + +CREATE FUNCTION babel_4489_left_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT LEFT(a, 5) as result from babel_4489_left_t2) +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/left-vu-verify.sql b/test/JDBC/input/functions/string_functions/left-vu-verify.sql new file mode 100644 index 00000000000..79b7b7d32d2 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/left-vu-verify.sql @@ -0,0 +1,328 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(25) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO + +-- NULL +SELECT LEFT(NULL, -2) +GO + +SELECT LEFT(NULL, 0) +GO + +SELECT LEFT(NULL, 2) +GO + +SELECT LEFT('abc', NULL) +GO + +SELECT LEFT(NULL, NULL) +GO + +-- edge case values for second parameter +SELECT LEFT('AbdefGhi', -2) +GO + +SELECT '|' + LEFT('AbdefGhi', 0) + '|' +GO + +SELECT LEFT('AbdefGhi', 2) +GO + +SELECT LEFT('AbdefGhi', 2147483646) +GO + +SELECT LEFT('AbdefGhi', 2147483650) +GO + +-- misc tests +DECLARE @procedure_name NVARCHAR(134) = ';1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO + +DECLARE @procedure_name NVARCHAR(134) = 'procedureName;1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO + +-- procedure name with length equal to 134 +DECLARE @procedure_name NVARCHAR(134) = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;1' +SELECT LEFT(@procedure_name, LEN(@procedure_name)-2) +GO + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 5) + '|' +GO + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) + '|' +GO + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 50) + '|' +GO + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 5) +GO + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT LEFT(@inputString, 4) +GO + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT LEFT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 50) +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_ci_as +GO + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_4489_left_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_cs_as +GO + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_4489_left_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT LEFT(a, 4) FROM babel_4489_left_chinese_prc_ci_ai +GO + +SELECT LEFT(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_4489_left_chinese_prc_ci_ai +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_ci_as +GO + +SELECT LEFT(a, 4) COLLATE ARABIC_CI_AS FROM babel_4489_left_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_cs_as +GO + +SELECT LEFT(a, 4) COLLATE ARABIC_CS_AS FROM babel_4489_left_arabic_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT LEFT(a, 4) FROM babel_4489_left_arabic_ci_ai +GO + +SELECT LEFT(a, 4) COLLATE ARABIC_CI_AI FROM babel_4489_left_arabic_ci_ai +GO + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 5) + '|' +GO + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT '|' + LEFT(@inputString, 4) + '|' +GO + +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT '|' + LEFT(@inputString, 50) + '|' +GO + +-- with table column of type nchar +SELECT '|' + LEFT(a, 5) + '|' FROM babel_4489_left_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 5) +GO + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT LEFT(@inputString, 4) +GO + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT LEFT(@inputString, 50) +GO + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT LEFT(@inputString, 4) +GO + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT LEFT(@inputString, 4) +GO + +-- dependent objects +SELECT * FROM babel_4489_left_dep_view +GO + +EXEC babel_4489_left_dep_proc +GO + +SELECT * FROM babel_4489_left_dep_func() +GO + +SELECT * FROM babel_4489_left_itvf_func() +GO + +SELECT * FROM babel_4489_left_dep_view_1 +GO + +SELECT * FROM babel_4489_left_dep_view_2 +GO + +SELECT * FROM babel_4489_left_dep_view_3 +GO + +SELECT * FROM babel_4489_left_dep_view_4 +GO + +SELECT * FROM babel_4489_left_dep_view_5 +GO + +SELECT * FROM babel_4489_left_dep_view_6 +GO + +SELECT * FROM babel_4489_left_dep_view_7 +GO + +-- input type UDT +-- -- in table babel_4489_left_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT LEFT(a, 3) FROM babel_4489_left_UDT +GO + +SELECT LEFT(b, 3) FROM babel_4489_left_UDT +GO + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString decimal = 123456; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString numeric = 12345.12; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString float = 12345.1; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString real = 12345.1; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString bigint = 12345678; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString int = 12345678; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString smallint = 12356; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString tinyint = 235; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString money = 12356; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString smallmoney = 12356; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString bit = 1; +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT LEFT(@inputString, 3) +GO + +SELECT LEFT(a, 5) from babel_4489_left_image; +GO + +-- input datatype text +SELECT LEFT(a, 5) FROM babel_4489_left_text +GO + +-- input datatype ntext +SELECT LEFT(b, 5) FROM babel_4489_left_text +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT LEFT(@inputString, 3) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LEFT(CAST(@inputString AS VARCHAR(50)), 3) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LEFT(CAST(@inputString AS VARCHAR(50)), 3) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LEFT(CAST(@inputString AS VARCHAR(50)), 3) +GO diff --git a/test/JDBC/input/functions/string_functions/ltrim-before-15_8-or-16_4-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/ltrim-before-15_8-or-16_4-vu-cleanup.sql new file mode 100644 index 00000000000..6b8328690ae --- /dev/null +++ b/test/JDBC/input/functions/string_functions/ltrim-before-15_8-or-16_4-vu-cleanup.sql @@ -0,0 +1,80 @@ +DROP FUNCTION babel_4489_ltrim_itvf_func +GO + +DROP FUNCTION babel_4489_ltrim_dep_func +GO + +DROP PROCEDURE babel_4489_ltrim_dep_proc +GO + +DROP VIEW babel_4489_ltrim_dep_view +GO + +DROP VIEW babel_4489_ltrim_dep_view_1 +GO + +DROP VIEW babel_4489_ltrim_dep_view_2 +GO + +DROP VIEW babel_4489_ltrim_dep_view_3 +GO + +DROP VIEW babel_4489_ltrim_dep_view_4 +GO + +DROP VIEW babel_4489_ltrim_dep_view_5 +GO + +DROP VIEW babel_4489_ltrim_dep_view_6 +GO + +DROP VIEW babel_4489_ltrim_dep_view_7 +GO + +DROP TABLE babel_4489_ltrim_UDT +GO + +DROP TYPE dbo.babel_4489_ltrim_varUDT +GO + +DROP TYPE dbo.babel_4489_ltrim_imageUDT +GO + +DROP TABLE babel_4489_ltrim_text +GO + +DROP TABLE babel_4489_ltrim_image +GO + +DROP TABLE babel_4489_ltrim_arabic_ci_ai +GO + +DROP TABLE babel_4489_ltrim_arabic_cs_as +GO + +DROP TABLE babel_4489_ltrim_arabic_ci_as +GO + +DROP TABLE babel_4489_ltrim_chinese_prc_ci_ai +GO + +DROP TABLE babel_4489_ltrim_chinese_prc_cs_as +GO + +DROP TABLE babel_4489_ltrim_chinese_prc_ci_as +GO + +DROP TABLE babel_4489_ltrim_t5 +GO + +DROP TABLE babel_4489_ltrim_t4 +GO + +DROP TABLE babel_4489_ltrim_t3 +GO + +DROP TABLE babel_4489_ltrim_t2 +GO + +DROP TABLE babel_4489_ltrim_t1 +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/ltrim-before-15_8-or-16_4-vu-prepare.sql b/test/JDBC/input/functions/string_functions/ltrim-before-15_8-or-16_4-vu-prepare.sql new file mode 100644 index 00000000000..55cec8a828b --- /dev/null +++ b/test/JDBC/input/functions/string_functions/ltrim-before-15_8-or-16_4-vu-prepare.sql @@ -0,0 +1,126 @@ +CREATE TABLE babel_4489_ltrim_t1(a NCHAR(50)) +GO +INSERT INTO babel_4489_ltrim_t1 VALUES(N' abc🙂defghi🙂🙂 ') +INSERT INTO babel_4489_ltrim_t1 VALUES(N' 比尔·拉莫斯 ') +GO + +CREATE TABLE babel_4489_ltrim_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4489_ltrim_t2 VALUES(N' abc🙂defghi🙂🙂 ') +GO + +CREATE TABLE babel_4489_ltrim_t3(a CHAR(50)) +GO +INSERT INTO babel_4489_ltrim_t3 VALUES(' abcdefghi ') +GO + +CREATE TABLE babel_4489_ltrim_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4489_ltrim_t4 VALUES(' abcdefghi ') +GO + +CREATE TABLE babel_4489_ltrim_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4489_ltrim_t5 VALUES(0x2020616263642020) +GO + +CREATE TABLE babel_4489_ltrim_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4489_ltrim_chinese_prc_ci_as VALUES(N' 比尔·拉莫斯 ') +GO + +CREATE TABLE babel_4489_ltrim_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4489_ltrim_chinese_prc_cs_as VALUES(N' 比尔·拉莫斯 ') +GO + +CREATE TABLE babel_4489_ltrim_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4489_ltrim_chinese_prc_ci_ai VALUES(N' 比尔·拉莫斯 ') +GO + +CREATE TABLE babel_4489_ltrim_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4489_ltrim_arabic_ci_as VALUES(N' الله مع المتقين ') +GO + +CREATE TABLE babel_4489_ltrim_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4489_ltrim_arabic_cs_as VALUES(N' الله مع المتقين ') +GO + +CREATE TABLE babel_4489_ltrim_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4489_ltrim_arabic_ci_ai VALUES(N' الله مع المتقين ') +GO + +CREATE TABLE babel_4489_ltrim_image(a IMAGE) +GO +INSERT INTO babel_4489_ltrim_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_4489_ltrim_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4489_ltrim_text VALUES (N' abc🙂defghi🙂🙂 ', N' abc🙂defghi🙂🙂 ') +GO + +CREATE TYPE dbo.babel_4489_ltrim_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4489_ltrim_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4489_ltrim_UDT(a dbo.babel_4489_ltrim_imageUDT, b dbo.babel_4489_ltrim_varUDT) +GO +INSERT INTO babel_4489_ltrim_UDT VALUES(CAST('abcdef' as dbo.babel_4489_ltrim_imageUDT), CAST('abcdef' as dbo.babel_4489_ltrim_varUDT)) +GO + +CREATE VIEW babel_4489_ltrim_dep_view AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t2 +GO + +CREATE PROCEDURE babel_4489_ltrim_dep_proc AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t2 +GO + +CREATE FUNCTION babel_4489_ltrim_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 ('|' + LTRIM(a) + '|') FROM babel_4489_ltrim_t2) +END +GO + +CREATE VIEW babel_4489_ltrim_dep_view_1 AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t1 +GO + +CREATE VIEW babel_4489_ltrim_dep_view_2 AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t2 +GO + +CREATE VIEW babel_4489_ltrim_dep_view_3 AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t3 +GO + +CREATE VIEW babel_4489_ltrim_dep_view_4 AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t4 +GO + +CREATE VIEW babel_4489_ltrim_dep_view_5 AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t5 +GO + +CREATE VIEW babel_4489_ltrim_dep_view_6 AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_text +GO + +CREATE VIEW babel_4489_ltrim_dep_view_7 AS + SELECT ('|' + LTRIM(b) + '|') as result FROM babel_4489_ltrim_text +GO + +CREATE FUNCTION babel_4489_ltrim_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t2) +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/ltrim-before-15_8-or-16_4-vu-verify.sql b/test/JDBC/input/functions/string_functions/ltrim-before-15_8-or-16_4-vu-verify.sql new file mode 100644 index 00000000000..0913db43758 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/ltrim-before-15_8-or-16_4-vu-verify.sql @@ -0,0 +1,270 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(50) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO + +-- NULL +SELECT LTRIM(NULL) +GO + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_ci_as +GO + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_ltrim_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_cs_as +GO + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_ltrim_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_ci_ai +GO + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_ltrim_chinese_prc_ci_ai +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_ci_as +GO + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_ltrim_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_cs_as +GO + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_ltrim_arabic_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_ci_ai +GO + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_ltrim_arabic_ci_ai +GO + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO + +-- with table column of type nchar +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO + +-- input type binary +DECLARE @inputString BINARY(10) = 0x202061626364656667682020 +SELECT '|' + LTRIM(@inputString) + '|' +GO + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x202061626364656667682020 +SELECT '|' + LTRIM(@inputString) + '|' +GO + +-- dependent objects +SELECT * FROM babel_4489_ltrim_dep_view +GO + +EXEC babel_4489_ltrim_dep_proc +GO + +SELECT * FROM babel_4489_ltrim_dep_func() +GO + +SELECT * FROM babel_4489_ltrim_itvf_func() +GO + +SELECT * FROM babel_4489_ltrim_dep_view_1 +GO + +SELECT * FROM babel_4489_ltrim_dep_view_2 +GO + +SELECT * FROM babel_4489_ltrim_dep_view_3 +GO + +SELECT * FROM babel_4489_ltrim_dep_view_4 +GO + +SELECT * FROM babel_4489_ltrim_dep_view_5 +GO + +SELECT * FROM babel_4489_ltrim_dep_view_6 +GO + +SELECT * FROM babel_4489_ltrim_dep_view_7 +GO + +-- input type UDT +-- -- in table babel_4489_ltrim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT LTRIM(a) FROM babel_4489_ltrim_UDT +GO + +SELECT LTRIM(b) FROM babel_4489_ltrim_UDT +GO + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT LTRIM(@inputString) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString decimal = 123456; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString numeric = 12345.12; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString float = 12345.1; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString real = 12345.1; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString bigint = 12345678; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString int = 12345678; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString smallint = 12356; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString tinyint = 235; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString money = 12356; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString smallmoney = 12356; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString bit = 1; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT LTRIM(@inputString) +GO + +SELECT LTRIM(a) from babel_4489_ltrim_image; +GO + +-- input datatype text +SELECT LTRIM(a) FROM babel_4489_ltrim_text +GO + +-- input datatype ntext +SELECT LTRIM(b) FROM babel_4489_ltrim_text +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO diff --git a/test/JDBC/input/functions/string_functions/ltrim-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/ltrim-vu-cleanup.sql new file mode 100644 index 00000000000..6b8328690ae --- /dev/null +++ b/test/JDBC/input/functions/string_functions/ltrim-vu-cleanup.sql @@ -0,0 +1,80 @@ +DROP FUNCTION babel_4489_ltrim_itvf_func +GO + +DROP FUNCTION babel_4489_ltrim_dep_func +GO + +DROP PROCEDURE babel_4489_ltrim_dep_proc +GO + +DROP VIEW babel_4489_ltrim_dep_view +GO + +DROP VIEW babel_4489_ltrim_dep_view_1 +GO + +DROP VIEW babel_4489_ltrim_dep_view_2 +GO + +DROP VIEW babel_4489_ltrim_dep_view_3 +GO + +DROP VIEW babel_4489_ltrim_dep_view_4 +GO + +DROP VIEW babel_4489_ltrim_dep_view_5 +GO + +DROP VIEW babel_4489_ltrim_dep_view_6 +GO + +DROP VIEW babel_4489_ltrim_dep_view_7 +GO + +DROP TABLE babel_4489_ltrim_UDT +GO + +DROP TYPE dbo.babel_4489_ltrim_varUDT +GO + +DROP TYPE dbo.babel_4489_ltrim_imageUDT +GO + +DROP TABLE babel_4489_ltrim_text +GO + +DROP TABLE babel_4489_ltrim_image +GO + +DROP TABLE babel_4489_ltrim_arabic_ci_ai +GO + +DROP TABLE babel_4489_ltrim_arabic_cs_as +GO + +DROP TABLE babel_4489_ltrim_arabic_ci_as +GO + +DROP TABLE babel_4489_ltrim_chinese_prc_ci_ai +GO + +DROP TABLE babel_4489_ltrim_chinese_prc_cs_as +GO + +DROP TABLE babel_4489_ltrim_chinese_prc_ci_as +GO + +DROP TABLE babel_4489_ltrim_t5 +GO + +DROP TABLE babel_4489_ltrim_t4 +GO + +DROP TABLE babel_4489_ltrim_t3 +GO + +DROP TABLE babel_4489_ltrim_t2 +GO + +DROP TABLE babel_4489_ltrim_t1 +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/ltrim-vu-prepare.sql b/test/JDBC/input/functions/string_functions/ltrim-vu-prepare.sql new file mode 100644 index 00000000000..55cec8a828b --- /dev/null +++ b/test/JDBC/input/functions/string_functions/ltrim-vu-prepare.sql @@ -0,0 +1,126 @@ +CREATE TABLE babel_4489_ltrim_t1(a NCHAR(50)) +GO +INSERT INTO babel_4489_ltrim_t1 VALUES(N' abc🙂defghi🙂🙂 ') +INSERT INTO babel_4489_ltrim_t1 VALUES(N' 比尔·拉莫斯 ') +GO + +CREATE TABLE babel_4489_ltrim_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4489_ltrim_t2 VALUES(N' abc🙂defghi🙂🙂 ') +GO + +CREATE TABLE babel_4489_ltrim_t3(a CHAR(50)) +GO +INSERT INTO babel_4489_ltrim_t3 VALUES(' abcdefghi ') +GO + +CREATE TABLE babel_4489_ltrim_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4489_ltrim_t4 VALUES(' abcdefghi ') +GO + +CREATE TABLE babel_4489_ltrim_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4489_ltrim_t5 VALUES(0x2020616263642020) +GO + +CREATE TABLE babel_4489_ltrim_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4489_ltrim_chinese_prc_ci_as VALUES(N' 比尔·拉莫斯 ') +GO + +CREATE TABLE babel_4489_ltrim_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4489_ltrim_chinese_prc_cs_as VALUES(N' 比尔·拉莫斯 ') +GO + +CREATE TABLE babel_4489_ltrim_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4489_ltrim_chinese_prc_ci_ai VALUES(N' 比尔·拉莫斯 ') +GO + +CREATE TABLE babel_4489_ltrim_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4489_ltrim_arabic_ci_as VALUES(N' الله مع المتقين ') +GO + +CREATE TABLE babel_4489_ltrim_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4489_ltrim_arabic_cs_as VALUES(N' الله مع المتقين ') +GO + +CREATE TABLE babel_4489_ltrim_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4489_ltrim_arabic_ci_ai VALUES(N' الله مع المتقين ') +GO + +CREATE TABLE babel_4489_ltrim_image(a IMAGE) +GO +INSERT INTO babel_4489_ltrim_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_4489_ltrim_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4489_ltrim_text VALUES (N' abc🙂defghi🙂🙂 ', N' abc🙂defghi🙂🙂 ') +GO + +CREATE TYPE dbo.babel_4489_ltrim_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4489_ltrim_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4489_ltrim_UDT(a dbo.babel_4489_ltrim_imageUDT, b dbo.babel_4489_ltrim_varUDT) +GO +INSERT INTO babel_4489_ltrim_UDT VALUES(CAST('abcdef' as dbo.babel_4489_ltrim_imageUDT), CAST('abcdef' as dbo.babel_4489_ltrim_varUDT)) +GO + +CREATE VIEW babel_4489_ltrim_dep_view AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t2 +GO + +CREATE PROCEDURE babel_4489_ltrim_dep_proc AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t2 +GO + +CREATE FUNCTION babel_4489_ltrim_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 ('|' + LTRIM(a) + '|') FROM babel_4489_ltrim_t2) +END +GO + +CREATE VIEW babel_4489_ltrim_dep_view_1 AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t1 +GO + +CREATE VIEW babel_4489_ltrim_dep_view_2 AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t2 +GO + +CREATE VIEW babel_4489_ltrim_dep_view_3 AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t3 +GO + +CREATE VIEW babel_4489_ltrim_dep_view_4 AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t4 +GO + +CREATE VIEW babel_4489_ltrim_dep_view_5 AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t5 +GO + +CREATE VIEW babel_4489_ltrim_dep_view_6 AS + SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_text +GO + +CREATE VIEW babel_4489_ltrim_dep_view_7 AS + SELECT ('|' + LTRIM(b) + '|') as result FROM babel_4489_ltrim_text +GO + +CREATE FUNCTION babel_4489_ltrim_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT ('|' + LTRIM(a) + '|') as result FROM babel_4489_ltrim_t2) +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/ltrim-vu-verify.sql b/test/JDBC/input/functions/string_functions/ltrim-vu-verify.sql new file mode 100644 index 00000000000..0913db43758 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/ltrim-vu-verify.sql @@ -0,0 +1,270 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(50) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO + +-- NULL +SELECT LTRIM(NULL) +GO + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_ci_as +GO + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_ltrim_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_cs_as +GO + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_ltrim_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_chinese_prc_ci_ai +GO + +SELECT '|' + LTRIM(a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_ltrim_chinese_prc_ci_ai +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_ci_as +GO + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_ltrim_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_cs_as +GO + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_ltrim_arabic_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_arabic_ci_ai +GO + +SELECT '|' + LTRIM(a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_ltrim_arabic_ci_ai +GO + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO + +-- with table column of type nchar +SELECT '|' + LTRIM(a) + '|' FROM babel_4489_ltrim_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + LTRIM(@inputString) + '|' +GO + +-- input type binary +DECLARE @inputString BINARY(10) = 0x202061626364656667682020 +SELECT '|' + LTRIM(@inputString) + '|' +GO + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x202061626364656667682020 +SELECT '|' + LTRIM(@inputString) + '|' +GO + +-- dependent objects +SELECT * FROM babel_4489_ltrim_dep_view +GO + +EXEC babel_4489_ltrim_dep_proc +GO + +SELECT * FROM babel_4489_ltrim_dep_func() +GO + +SELECT * FROM babel_4489_ltrim_itvf_func() +GO + +SELECT * FROM babel_4489_ltrim_dep_view_1 +GO + +SELECT * FROM babel_4489_ltrim_dep_view_2 +GO + +SELECT * FROM babel_4489_ltrim_dep_view_3 +GO + +SELECT * FROM babel_4489_ltrim_dep_view_4 +GO + +SELECT * FROM babel_4489_ltrim_dep_view_5 +GO + +SELECT * FROM babel_4489_ltrim_dep_view_6 +GO + +SELECT * FROM babel_4489_ltrim_dep_view_7 +GO + +-- input type UDT +-- -- in table babel_4489_ltrim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT LTRIM(a) FROM babel_4489_ltrim_UDT +GO + +SELECT LTRIM(b) FROM babel_4489_ltrim_UDT +GO + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT LTRIM(@inputString) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString decimal = 123456; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString numeric = 12345.12; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString float = 12345.1; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString real = 12345.1; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString bigint = 12345678; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString int = 12345678; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString smallint = 12356; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString tinyint = 235; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString money = 12356; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString smallmoney = 12356; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString bit = 1; +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT LTRIM(@inputString) +GO + +SELECT LTRIM(a) from babel_4489_ltrim_image; +GO + +-- input datatype text +SELECT LTRIM(a) FROM babel_4489_ltrim_text +GO + +-- input datatype ntext +SELECT LTRIM(b) FROM babel_4489_ltrim_text +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT LTRIM(@inputString) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT LTRIM(CAST(@inputString AS VARCHAR(50))) +GO diff --git a/test/JDBC/input/functions/string_functions/replace-before-14_3-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/replace-before-14_3-vu-cleanup.sql new file mode 100644 index 00000000000..bd19690561b --- /dev/null +++ b/test/JDBC/input/functions/string_functions/replace-before-14_3-vu-cleanup.sql @@ -0,0 +1,62 @@ +DROP FUNCTION babel_4836_replace_itvf_func +GO + +DROP FUNCTION babel_4836_replace_dep_func +GO + +DROP PROCEDURE babel_4836_replace_dep_proc +GO + +DROP VIEW babel_4836_replace_dep_view +GO + +DROP VIEW babel_4836_replace_dep_view1 +GO + +DROP TABLE babel_4836_replace_image_UDT_t +GO + +DROP TABLE babel_4836_replace_var_UDT_t +GO + +DROP TYPE dbo.babel_4836_replace_varUDT +GO + +DROP TYPE dbo.babel_4836_replace_imageUDT +GO + +DROP TABLE babel_4836_replace_text +GO + +DROP TABLE babel_4836_replace_ntext +GO + +DROP TABLE babel_4836_replace_image +GO + +DROP TABLE babel_4836_replace_arabic_cs_as +GO + +DROP TABLE babel_4836_replace_arabic_ci_as +GO + +DROP TABLE babel_4836_replace_chinese_prc_cs_as +GO + +DROP TABLE babel_4836_replace_chinese_prc_ci_as +GO + +DROP TABLE babel_4836_replace_t5 +GO + +DROP TABLE babel_4836_replace_t4 +GO + +DROP TABLE babel_4836_replace_t3 +GO + +DROP TABLE babel_4836_replace_t2 +GO + +DROP TABLE babel_4836_replace_t1 +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/replace-before-14_3-vu-prepare.sql b/test/JDBC/input/functions/string_functions/replace-before-14_3-vu-prepare.sql new file mode 100644 index 00000000000..16458212ba0 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/replace-before-14_3-vu-prepare.sql @@ -0,0 +1,102 @@ +CREATE TABLE babel_4836_replace_t1(a NCHAR(50), b NCHAR(20), c NCHAR(20)) +GO +INSERT INTO babel_4836_replace_t1 VALUES(N' abc🙂defghi🙂🙂 ', N'🙂de', N'x🙂y') +INSERT INTO babel_4836_replace_t1 VALUES(N' 比尔·拉莫斯 ', N'拉莫', N'尔·比') +GO + +CREATE TABLE babel_4836_replace_t2(a NVARCHAR(50), b NVARCHAR(20), c NVARCHAR(20)) +GO +INSERT INTO babel_4836_replace_t2 VALUES(N' abc🙂defghi🙂🙂 ', N'🙂de', N'x🙂y') +GO + +CREATE TABLE babel_4836_replace_t3(a VARCHAR(50), b VARCHAR(20), c VARCHAR(20)) +GO +INSERT INTO babel_4836_replace_t3 VALUES(' abc🙂defghi🙂🙂 ', '🙂de', 'x🙂y') +GO + +CREATE TABLE babel_4836_replace_t4(a BINARY(50), b BINARY(20), c BINARY(20)) +GO +INSERT INTO babel_4836_replace_t4 VALUES(0x6162636465, 0x6263, 0x747576) +GO + +CREATE TABLE babel_4836_replace_t5(a VARBINARY(50), b VARBINARY(20), c VARBINARY(20)) +GO +INSERT INTO babel_4836_replace_t5 VALUES(0x6162636465, 0x6263, 0x747576) +GO + +CREATE TABLE babel_4836_replace_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CI_AS, c VARCHAR(20) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4836_replace_chinese_prc_ci_as VALUES(N' 比尔·拉莫斯 ', N'拉莫', N'尔·比') +GO + +CREATE TABLE babel_4836_replace_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CS_AS, c VARCHAR(20) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4836_replace_chinese_prc_cs_as VALUES(N' 比尔·拉莫斯 ', N'拉莫', N'尔·比') +GO + +CREATE TABLE babel_4836_replace_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS, b VARCHAR(20) COLLATE ARABIC_CI_AS, c VARCHAR(20) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4836_replace_arabic_ci_as VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO + +CREATE TABLE babel_4836_replace_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS, b VARCHAR(20) COLLATE ARABIC_CS_AS, c VARCHAR(20) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4836_replace_arabic_cs_as VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO + +CREATE TABLE babel_4836_replace_image(a IMAGE) +GO +INSERT INTO babel_4836_replace_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_4836_replace_text(a TEXT, b TEXT, c TEXT) +GO +INSERT INTO babel_4836_replace_text VALUES (N' abc🙂defghi🙂🙂 ', N'🙂def', N'jhi🙂') +GO + +CREATE TABLE babel_4836_replace_ntext(a NTEXT, b NTEXT, c NTEXT) +GO +INSERT INTO babel_4836_replace_ntext VALUES (N' abc🙂defghi🙂🙂 ', N'🙂def', N'jhi🙂') +GO + +CREATE TYPE dbo.babel_4836_replace_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4836_replace_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4836_replace_image_UDT_t(a dbo.babel_4836_replace_imageUDT, b dbo.babel_4836_replace_imageUDT, c dbo.babel_4836_replace_imageUDT) +GO +INSERT INTO babel_4836_replace_image_UDT_t VALUES(CAST('abcdef' as dbo.babel_4836_replace_imageUDT), CAST('bc' as dbo.babel_4836_replace_imageUDT), CAST('gh' as dbo.babel_4836_replace_imageUDT)) +GO + +CREATE TABLE babel_4836_replace_var_UDT_t(a dbo.babel_4836_replace_imageUDT, b dbo.babel_4836_replace_varUDT, c dbo.babel_4836_replace_varUDT) +GO +INSERT INTO babel_4836_replace_var_UDT_t VALUES(CAST('abcdef' as dbo.babel_4836_replace_imageUDT), CAST('bc' as dbo.babel_4836_replace_varUDT), CAST('gh' as dbo.babel_4836_replace_varUDT)) +GO + +CREATE VIEW babel_4836_replace_dep_view AS + SELECT replace(a, b, c) as result FROM babel_4836_replace_t2 +GO + +CREATE VIEW babel_4836_replace_dep_view1 AS + SELECT replace(a, b, c) as result FROM babel_4836_replace_t3 +GO + +CREATE PROCEDURE babel_4836_replace_dep_proc AS + SELECT replace(a, b, c) as result FROM babel_4836_replace_t2 +GO + +CREATE FUNCTION babel_4836_replace_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 replace(a, b, c) FROM babel_4836_replace_t2) +END +GO + +CREATE FUNCTION babel_4836_replace_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT replace(a, b, c) as result FROM babel_4836_replace_t2) +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/replace-before-14_3-vu-verify.sql b/test/JDBC/input/functions/string_functions/replace-before-14_3-vu-verify.sql new file mode 100644 index 00000000000..890e6b6134f --- /dev/null +++ b/test/JDBC/input/functions/string_functions/replace-before-14_3-vu-verify.sql @@ -0,0 +1,1306 @@ +declare @string1 nvarchar(30) = N'比尔·拉',@string2 nvarchar(30) = N'斯', @pat nvarchar(10) = N'尔' +select REPLACE(@string1, @pat, @string2) +GO + +-- NULL +SELECT replace(NULL, 'acs', 'scd') +GO + +SELECT replace('scd', NULL, 'scd') +GO + +SELECT replace('scd', 'scd', NULL) +GO + +SELECT replace(NULL, NULL, NULL) +GO + +SELECT replace(NULL, 'aces', 'scdwe') +GO + +-- different no. of arguments +SELECT replace('aceds', 'aces', 'scdwe', 'acsdes') +GO + +SELECT replace('aces', 'scdwe') +GO + +-- input type char +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO + +-- input type varchar +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_ci_as +GO + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CI_AS FROM babel_4836_replace_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_cs_as +GO + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CS_AS FROM babel_4836_replace_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_ci_as +GO + +SELECT replace(a, b, c) COLLATE ARABIC_CI_AS FROM babel_4836_replace_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_cs_as +GO + +SELECT replace(a, b, c) COLLATE ARABIC_CS_AS FROM babel_4836_replace_arabic_cs_as +GO + +-- input type nchar +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO + +-- with table column of type nchar +SELECT replace(a, b, c) FROM babel_4836_replace_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO + +-- input type binary +DECLARE @inputString BINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO + +DECLARE @inputString BINARY(10) = 0x61626364656667, @pattern BINARY(10) = 0x6364, @replacement BINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO + +-- with table column of type binary +SELECT replace(a, b, c) FROM babel_4836_replace_t4 +GO + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO + +DECLARE @inputString VARBINARY(10) = 0x61626364656667, @pattern VARBINARY(10) = 0x6364, @replacement VARBINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO + +-- with table column of type varbinary +SELECT replace(a, b, c) FROM babel_4836_replace_t5 +GO + + +-- input type text +SELECT replace(a, b, c) FROM babel_4836_replace_text +GO + +DECLARE @pattern VARCHAR(20) = '?de', @replacement VARCHAR(10) = 'x?y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_text +GO + +-- input type ntext +SELECT replace(a, b, c) FROM babel_4836_replace_ntext +GO + +DECLARE @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(10) = N'x🙂y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_ntext +GO + +-- dependent objects +SELECT * FROM babel_4836_replace_dep_view +GO + +SELECT * FROM babel_4836_replace_dep_view1 +GO + +EXEC babel_4836_replace_dep_proc +GO + +SELECT * FROM babel_4836_replace_dep_func() +GO + +SELECT * FROM babel_4836_replace_itvf_func() +GO + +-- different datatypes of inputString and pattern/replacement +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement)+ '|' +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = N'ABCDEF', @pattern BINARY(4) = 0x414243, @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARBINARY(50) = 0x41424344, @pattern NCHAR(20) = N'尔·比', @replacement VARBINARY(2) = 0x4144 +SELECT replace(@inputString, @pattern, @replacement) +GO + +-- input type UDT +-- in table babel_4836_replace_image_UDT_t, col 'a', 'b' and 'c' has basetype image +SELECT replace(a, b, c) FROM babel_4836_replace_image_UDT_t +GO + +-- in table babel_4836_replace_var_UDT_t, col 'a', 'b' and 'c' has basetype varchar +SELECT replace(b, b, c) FROM babel_4836_replace_var_UDT_t +GO + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, '12', '06'); +GO + +DECLARE @inputString date = '2016-12-21', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern date = '2016-12-21', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @replacement date = '2016-12-21'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @date date = '2016-12-21', @replacement VARCHAR(10) = '06'; +DECLARE @pattern datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @date date = '2016-12-21'; +DECLARE @replacement datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern smalldatetime = '2016-12-21 12:43:10', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern VARCHAR(30) = '2016-12-21 12:43:10', @replacement smalldatetime = '2016-12-21 12:43:10'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString time(4) = '12:10:05.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern time(4) = '12:10:05.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern VARCHAR(30) = '12:10:05.1237', @replacement time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @replacement datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern datetime2(4) = '1968-10-23 12:45:37.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1237', @replacement datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString decimal = 123456, @pattern decimal = 12, @replacement decimal = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern decimal = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement decimal = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString numeric = 12345.12, @pattern numeric = 12, @replacement numeric = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern numeric = 12.12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement numeric = 12.12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString float = 12345.1, @pattern float = 12, @replacement float = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern float = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement float = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString real = 12345.1, @pattern real = 12, @replacement real = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern real = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement real = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString bigint = 12345678, @pattern bigint = 12, @replacement bigint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bigint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bigint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString int = 12345678, @pattern int = 12, @replacement int = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern int = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement int = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString smallint = 12356, @pattern smallint = 12, @replacement smallint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString tinyint = 235, @pattern tinyint = 12, @replacement tinyint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern tinyint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement tinyint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString money = 12356, @pattern money = 12, @replacement money = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern money = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement money = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString smallmoney = 12356, @pattern smallmoney = 12, @replacement smallmoney = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallmoney = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallmoney = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString bit = 1, @pattern bit = 1, @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bit = 1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER); +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +SELECT replace(@inputString, @inputString, @inputString) +GO + +SELECT replace(a, a, a) FROM babel_4836_replace_image; +GO + +SELECT replace('a', a, 'a') FROM babel_4836_replace_image; +GO + +SELECT replace('a', 'a', a) FROM babel_4836_replace_image; +GO + +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(a, @pattern, @replacement) from babel_4836_replace_image; +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant); +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern xml = CAST ('' AS xml), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geometry = geometry::STGeomFromText('POINT (1 2)', 0), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geography = geography::STGeomFromText('POINT (1 2)', 4326), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geography = geography::STGeomFromText('POINT (1 2)', 4326); +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(CAST (@inputString AS VARCHAR(50)), CAST (@pattern AS VARCHAR(50)), CAST (@replacement AS VARCHAR(50))) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/replace-before-15_8-or-16_4-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/replace-before-15_8-or-16_4-vu-cleanup.sql new file mode 100644 index 00000000000..bd19690561b --- /dev/null +++ b/test/JDBC/input/functions/string_functions/replace-before-15_8-or-16_4-vu-cleanup.sql @@ -0,0 +1,62 @@ +DROP FUNCTION babel_4836_replace_itvf_func +GO + +DROP FUNCTION babel_4836_replace_dep_func +GO + +DROP PROCEDURE babel_4836_replace_dep_proc +GO + +DROP VIEW babel_4836_replace_dep_view +GO + +DROP VIEW babel_4836_replace_dep_view1 +GO + +DROP TABLE babel_4836_replace_image_UDT_t +GO + +DROP TABLE babel_4836_replace_var_UDT_t +GO + +DROP TYPE dbo.babel_4836_replace_varUDT +GO + +DROP TYPE dbo.babel_4836_replace_imageUDT +GO + +DROP TABLE babel_4836_replace_text +GO + +DROP TABLE babel_4836_replace_ntext +GO + +DROP TABLE babel_4836_replace_image +GO + +DROP TABLE babel_4836_replace_arabic_cs_as +GO + +DROP TABLE babel_4836_replace_arabic_ci_as +GO + +DROP TABLE babel_4836_replace_chinese_prc_cs_as +GO + +DROP TABLE babel_4836_replace_chinese_prc_ci_as +GO + +DROP TABLE babel_4836_replace_t5 +GO + +DROP TABLE babel_4836_replace_t4 +GO + +DROP TABLE babel_4836_replace_t3 +GO + +DROP TABLE babel_4836_replace_t2 +GO + +DROP TABLE babel_4836_replace_t1 +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/replace-before-15_8-or-16_4-vu-prepare.sql b/test/JDBC/input/functions/string_functions/replace-before-15_8-or-16_4-vu-prepare.sql new file mode 100644 index 00000000000..16458212ba0 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/replace-before-15_8-or-16_4-vu-prepare.sql @@ -0,0 +1,102 @@ +CREATE TABLE babel_4836_replace_t1(a NCHAR(50), b NCHAR(20), c NCHAR(20)) +GO +INSERT INTO babel_4836_replace_t1 VALUES(N' abc🙂defghi🙂🙂 ', N'🙂de', N'x🙂y') +INSERT INTO babel_4836_replace_t1 VALUES(N' 比尔·拉莫斯 ', N'拉莫', N'尔·比') +GO + +CREATE TABLE babel_4836_replace_t2(a NVARCHAR(50), b NVARCHAR(20), c NVARCHAR(20)) +GO +INSERT INTO babel_4836_replace_t2 VALUES(N' abc🙂defghi🙂🙂 ', N'🙂de', N'x🙂y') +GO + +CREATE TABLE babel_4836_replace_t3(a VARCHAR(50), b VARCHAR(20), c VARCHAR(20)) +GO +INSERT INTO babel_4836_replace_t3 VALUES(' abc🙂defghi🙂🙂 ', '🙂de', 'x🙂y') +GO + +CREATE TABLE babel_4836_replace_t4(a BINARY(50), b BINARY(20), c BINARY(20)) +GO +INSERT INTO babel_4836_replace_t4 VALUES(0x6162636465, 0x6263, 0x747576) +GO + +CREATE TABLE babel_4836_replace_t5(a VARBINARY(50), b VARBINARY(20), c VARBINARY(20)) +GO +INSERT INTO babel_4836_replace_t5 VALUES(0x6162636465, 0x6263, 0x747576) +GO + +CREATE TABLE babel_4836_replace_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CI_AS, c VARCHAR(20) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4836_replace_chinese_prc_ci_as VALUES(N' 比尔·拉莫斯 ', N'拉莫', N'尔·比') +GO + +CREATE TABLE babel_4836_replace_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CS_AS, c VARCHAR(20) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4836_replace_chinese_prc_cs_as VALUES(N' 比尔·拉莫斯 ', N'拉莫', N'尔·比') +GO + +CREATE TABLE babel_4836_replace_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS, b VARCHAR(20) COLLATE ARABIC_CI_AS, c VARCHAR(20) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4836_replace_arabic_ci_as VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO + +CREATE TABLE babel_4836_replace_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS, b VARCHAR(20) COLLATE ARABIC_CS_AS, c VARCHAR(20) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4836_replace_arabic_cs_as VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO + +CREATE TABLE babel_4836_replace_image(a IMAGE) +GO +INSERT INTO babel_4836_replace_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_4836_replace_text(a TEXT, b TEXT, c TEXT) +GO +INSERT INTO babel_4836_replace_text VALUES (N' abc🙂defghi🙂🙂 ', N'🙂def', N'jhi🙂') +GO + +CREATE TABLE babel_4836_replace_ntext(a NTEXT, b NTEXT, c NTEXT) +GO +INSERT INTO babel_4836_replace_ntext VALUES (N' abc🙂defghi🙂🙂 ', N'🙂def', N'jhi🙂') +GO + +CREATE TYPE dbo.babel_4836_replace_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4836_replace_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4836_replace_image_UDT_t(a dbo.babel_4836_replace_imageUDT, b dbo.babel_4836_replace_imageUDT, c dbo.babel_4836_replace_imageUDT) +GO +INSERT INTO babel_4836_replace_image_UDT_t VALUES(CAST('abcdef' as dbo.babel_4836_replace_imageUDT), CAST('bc' as dbo.babel_4836_replace_imageUDT), CAST('gh' as dbo.babel_4836_replace_imageUDT)) +GO + +CREATE TABLE babel_4836_replace_var_UDT_t(a dbo.babel_4836_replace_imageUDT, b dbo.babel_4836_replace_varUDT, c dbo.babel_4836_replace_varUDT) +GO +INSERT INTO babel_4836_replace_var_UDT_t VALUES(CAST('abcdef' as dbo.babel_4836_replace_imageUDT), CAST('bc' as dbo.babel_4836_replace_varUDT), CAST('gh' as dbo.babel_4836_replace_varUDT)) +GO + +CREATE VIEW babel_4836_replace_dep_view AS + SELECT replace(a, b, c) as result FROM babel_4836_replace_t2 +GO + +CREATE VIEW babel_4836_replace_dep_view1 AS + SELECT replace(a, b, c) as result FROM babel_4836_replace_t3 +GO + +CREATE PROCEDURE babel_4836_replace_dep_proc AS + SELECT replace(a, b, c) as result FROM babel_4836_replace_t2 +GO + +CREATE FUNCTION babel_4836_replace_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 replace(a, b, c) FROM babel_4836_replace_t2) +END +GO + +CREATE FUNCTION babel_4836_replace_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT replace(a, b, c) as result FROM babel_4836_replace_t2) +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/replace-before-15_8-or-16_4-vu-verify.sql b/test/JDBC/input/functions/string_functions/replace-before-15_8-or-16_4-vu-verify.sql new file mode 100644 index 00000000000..890e6b6134f --- /dev/null +++ b/test/JDBC/input/functions/string_functions/replace-before-15_8-or-16_4-vu-verify.sql @@ -0,0 +1,1306 @@ +declare @string1 nvarchar(30) = N'比尔·拉',@string2 nvarchar(30) = N'斯', @pat nvarchar(10) = N'尔' +select REPLACE(@string1, @pat, @string2) +GO + +-- NULL +SELECT replace(NULL, 'acs', 'scd') +GO + +SELECT replace('scd', NULL, 'scd') +GO + +SELECT replace('scd', 'scd', NULL) +GO + +SELECT replace(NULL, NULL, NULL) +GO + +SELECT replace(NULL, 'aces', 'scdwe') +GO + +-- different no. of arguments +SELECT replace('aceds', 'aces', 'scdwe', 'acsdes') +GO + +SELECT replace('aces', 'scdwe') +GO + +-- input type char +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO + +-- input type varchar +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_ci_as +GO + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CI_AS FROM babel_4836_replace_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_cs_as +GO + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CS_AS FROM babel_4836_replace_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_ci_as +GO + +SELECT replace(a, b, c) COLLATE ARABIC_CI_AS FROM babel_4836_replace_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_cs_as +GO + +SELECT replace(a, b, c) COLLATE ARABIC_CS_AS FROM babel_4836_replace_arabic_cs_as +GO + +-- input type nchar +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO + +-- with table column of type nchar +SELECT replace(a, b, c) FROM babel_4836_replace_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO + +-- input type binary +DECLARE @inputString BINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO + +DECLARE @inputString BINARY(10) = 0x61626364656667, @pattern BINARY(10) = 0x6364, @replacement BINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO + +-- with table column of type binary +SELECT replace(a, b, c) FROM babel_4836_replace_t4 +GO + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO + +DECLARE @inputString VARBINARY(10) = 0x61626364656667, @pattern VARBINARY(10) = 0x6364, @replacement VARBINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO + +-- with table column of type varbinary +SELECT replace(a, b, c) FROM babel_4836_replace_t5 +GO + + +-- input type text +SELECT replace(a, b, c) FROM babel_4836_replace_text +GO + +DECLARE @pattern VARCHAR(20) = '?de', @replacement VARCHAR(10) = 'x?y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_text +GO + +-- input type ntext +SELECT replace(a, b, c) FROM babel_4836_replace_ntext +GO + +DECLARE @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(10) = N'x🙂y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_ntext +GO + +-- dependent objects +SELECT * FROM babel_4836_replace_dep_view +GO + +SELECT * FROM babel_4836_replace_dep_view1 +GO + +EXEC babel_4836_replace_dep_proc +GO + +SELECT * FROM babel_4836_replace_dep_func() +GO + +SELECT * FROM babel_4836_replace_itvf_func() +GO + +-- different datatypes of inputString and pattern/replacement +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement)+ '|' +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = N'ABCDEF', @pattern BINARY(4) = 0x414243, @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARBINARY(50) = 0x41424344, @pattern NCHAR(20) = N'尔·比', @replacement VARBINARY(2) = 0x4144 +SELECT replace(@inputString, @pattern, @replacement) +GO + +-- input type UDT +-- in table babel_4836_replace_image_UDT_t, col 'a', 'b' and 'c' has basetype image +SELECT replace(a, b, c) FROM babel_4836_replace_image_UDT_t +GO + +-- in table babel_4836_replace_var_UDT_t, col 'a', 'b' and 'c' has basetype varchar +SELECT replace(b, b, c) FROM babel_4836_replace_var_UDT_t +GO + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, '12', '06'); +GO + +DECLARE @inputString date = '2016-12-21', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern date = '2016-12-21', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @replacement date = '2016-12-21'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @date date = '2016-12-21', @replacement VARCHAR(10) = '06'; +DECLARE @pattern datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @date date = '2016-12-21'; +DECLARE @replacement datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern smalldatetime = '2016-12-21 12:43:10', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern VARCHAR(30) = '2016-12-21 12:43:10', @replacement smalldatetime = '2016-12-21 12:43:10'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString time(4) = '12:10:05.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern time(4) = '12:10:05.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern VARCHAR(30) = '12:10:05.1237', @replacement time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @replacement datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern datetime2(4) = '1968-10-23 12:45:37.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1237', @replacement datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString decimal = 123456, @pattern decimal = 12, @replacement decimal = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern decimal = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement decimal = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString numeric = 12345.12, @pattern numeric = 12, @replacement numeric = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern numeric = 12.12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement numeric = 12.12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString float = 12345.1, @pattern float = 12, @replacement float = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern float = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement float = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString real = 12345.1, @pattern real = 12, @replacement real = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern real = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement real = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString bigint = 12345678, @pattern bigint = 12, @replacement bigint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bigint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bigint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString int = 12345678, @pattern int = 12, @replacement int = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern int = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement int = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString smallint = 12356, @pattern smallint = 12, @replacement smallint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString tinyint = 235, @pattern tinyint = 12, @replacement tinyint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern tinyint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement tinyint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString money = 12356, @pattern money = 12, @replacement money = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern money = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement money = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString smallmoney = 12356, @pattern smallmoney = 12, @replacement smallmoney = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallmoney = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallmoney = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString bit = 1, @pattern bit = 1, @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bit = 1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER); +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +SELECT replace(@inputString, @inputString, @inputString) +GO + +SELECT replace(a, a, a) FROM babel_4836_replace_image; +GO + +SELECT replace('a', a, 'a') FROM babel_4836_replace_image; +GO + +SELECT replace('a', 'a', a) FROM babel_4836_replace_image; +GO + +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(a, @pattern, @replacement) from babel_4836_replace_image; +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant); +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern xml = CAST ('' AS xml), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geometry = geometry::STGeomFromText('POINT (1 2)', 0), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geography = geography::STGeomFromText('POINT (1 2)', 4326), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geography = geography::STGeomFromText('POINT (1 2)', 4326); +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(CAST (@inputString AS VARCHAR(50)), CAST (@pattern AS VARCHAR(50)), CAST (@replacement AS VARCHAR(50))) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/replace-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/replace-vu-cleanup.sql new file mode 100644 index 00000000000..bd19690561b --- /dev/null +++ b/test/JDBC/input/functions/string_functions/replace-vu-cleanup.sql @@ -0,0 +1,62 @@ +DROP FUNCTION babel_4836_replace_itvf_func +GO + +DROP FUNCTION babel_4836_replace_dep_func +GO + +DROP PROCEDURE babel_4836_replace_dep_proc +GO + +DROP VIEW babel_4836_replace_dep_view +GO + +DROP VIEW babel_4836_replace_dep_view1 +GO + +DROP TABLE babel_4836_replace_image_UDT_t +GO + +DROP TABLE babel_4836_replace_var_UDT_t +GO + +DROP TYPE dbo.babel_4836_replace_varUDT +GO + +DROP TYPE dbo.babel_4836_replace_imageUDT +GO + +DROP TABLE babel_4836_replace_text +GO + +DROP TABLE babel_4836_replace_ntext +GO + +DROP TABLE babel_4836_replace_image +GO + +DROP TABLE babel_4836_replace_arabic_cs_as +GO + +DROP TABLE babel_4836_replace_arabic_ci_as +GO + +DROP TABLE babel_4836_replace_chinese_prc_cs_as +GO + +DROP TABLE babel_4836_replace_chinese_prc_ci_as +GO + +DROP TABLE babel_4836_replace_t5 +GO + +DROP TABLE babel_4836_replace_t4 +GO + +DROP TABLE babel_4836_replace_t3 +GO + +DROP TABLE babel_4836_replace_t2 +GO + +DROP TABLE babel_4836_replace_t1 +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/replace-vu-prepare.sql b/test/JDBC/input/functions/string_functions/replace-vu-prepare.sql new file mode 100644 index 00000000000..16458212ba0 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/replace-vu-prepare.sql @@ -0,0 +1,102 @@ +CREATE TABLE babel_4836_replace_t1(a NCHAR(50), b NCHAR(20), c NCHAR(20)) +GO +INSERT INTO babel_4836_replace_t1 VALUES(N' abc🙂defghi🙂🙂 ', N'🙂de', N'x🙂y') +INSERT INTO babel_4836_replace_t1 VALUES(N' 比尔·拉莫斯 ', N'拉莫', N'尔·比') +GO + +CREATE TABLE babel_4836_replace_t2(a NVARCHAR(50), b NVARCHAR(20), c NVARCHAR(20)) +GO +INSERT INTO babel_4836_replace_t2 VALUES(N' abc🙂defghi🙂🙂 ', N'🙂de', N'x🙂y') +GO + +CREATE TABLE babel_4836_replace_t3(a VARCHAR(50), b VARCHAR(20), c VARCHAR(20)) +GO +INSERT INTO babel_4836_replace_t3 VALUES(' abc🙂defghi🙂🙂 ', '🙂de', 'x🙂y') +GO + +CREATE TABLE babel_4836_replace_t4(a BINARY(50), b BINARY(20), c BINARY(20)) +GO +INSERT INTO babel_4836_replace_t4 VALUES(0x6162636465, 0x6263, 0x747576) +GO + +CREATE TABLE babel_4836_replace_t5(a VARBINARY(50), b VARBINARY(20), c VARBINARY(20)) +GO +INSERT INTO babel_4836_replace_t5 VALUES(0x6162636465, 0x6263, 0x747576) +GO + +CREATE TABLE babel_4836_replace_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CI_AS, c VARCHAR(20) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4836_replace_chinese_prc_ci_as VALUES(N' 比尔·拉莫斯 ', N'拉莫', N'尔·比') +GO + +CREATE TABLE babel_4836_replace_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CS_AS, c VARCHAR(20) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4836_replace_chinese_prc_cs_as VALUES(N' 比尔·拉莫斯 ', N'拉莫', N'尔·比') +GO + +CREATE TABLE babel_4836_replace_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS, b VARCHAR(20) COLLATE ARABIC_CI_AS, c VARCHAR(20) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4836_replace_arabic_ci_as VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO + +CREATE TABLE babel_4836_replace_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS, b VARCHAR(20) COLLATE ARABIC_CS_AS, c VARCHAR(20) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4836_replace_arabic_cs_as VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO + +CREATE TABLE babel_4836_replace_image(a IMAGE) +GO +INSERT INTO babel_4836_replace_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_4836_replace_text(a TEXT, b TEXT, c TEXT) +GO +INSERT INTO babel_4836_replace_text VALUES (N' abc🙂defghi🙂🙂 ', N'🙂def', N'jhi🙂') +GO + +CREATE TABLE babel_4836_replace_ntext(a NTEXT, b NTEXT, c NTEXT) +GO +INSERT INTO babel_4836_replace_ntext VALUES (N' abc🙂defghi🙂🙂 ', N'🙂def', N'jhi🙂') +GO + +CREATE TYPE dbo.babel_4836_replace_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4836_replace_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4836_replace_image_UDT_t(a dbo.babel_4836_replace_imageUDT, b dbo.babel_4836_replace_imageUDT, c dbo.babel_4836_replace_imageUDT) +GO +INSERT INTO babel_4836_replace_image_UDT_t VALUES(CAST('abcdef' as dbo.babel_4836_replace_imageUDT), CAST('bc' as dbo.babel_4836_replace_imageUDT), CAST('gh' as dbo.babel_4836_replace_imageUDT)) +GO + +CREATE TABLE babel_4836_replace_var_UDT_t(a dbo.babel_4836_replace_imageUDT, b dbo.babel_4836_replace_varUDT, c dbo.babel_4836_replace_varUDT) +GO +INSERT INTO babel_4836_replace_var_UDT_t VALUES(CAST('abcdef' as dbo.babel_4836_replace_imageUDT), CAST('bc' as dbo.babel_4836_replace_varUDT), CAST('gh' as dbo.babel_4836_replace_varUDT)) +GO + +CREATE VIEW babel_4836_replace_dep_view AS + SELECT replace(a, b, c) as result FROM babel_4836_replace_t2 +GO + +CREATE VIEW babel_4836_replace_dep_view1 AS + SELECT replace(a, b, c) as result FROM babel_4836_replace_t3 +GO + +CREATE PROCEDURE babel_4836_replace_dep_proc AS + SELECT replace(a, b, c) as result FROM babel_4836_replace_t2 +GO + +CREATE FUNCTION babel_4836_replace_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 replace(a, b, c) FROM babel_4836_replace_t2) +END +GO + +CREATE FUNCTION babel_4836_replace_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT replace(a, b, c) as result FROM babel_4836_replace_t2) +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/replace-vu-verify.sql b/test/JDBC/input/functions/string_functions/replace-vu-verify.sql new file mode 100644 index 00000000000..890e6b6134f --- /dev/null +++ b/test/JDBC/input/functions/string_functions/replace-vu-verify.sql @@ -0,0 +1,1306 @@ +declare @string1 nvarchar(30) = N'比尔·拉',@string2 nvarchar(30) = N'斯', @pat nvarchar(10) = N'尔' +select REPLACE(@string1, @pat, @string2) +GO + +-- NULL +SELECT replace(NULL, 'acs', 'scd') +GO + +SELECT replace('scd', NULL, 'scd') +GO + +SELECT replace('scd', 'scd', NULL) +GO + +SELECT replace(NULL, NULL, NULL) +GO + +SELECT replace(NULL, 'aces', 'scdwe') +GO + +-- different no. of arguments +SELECT replace('aceds', 'aces', 'scdwe', 'acsdes') +GO + +SELECT replace('aces', 'scdwe') +GO + +-- input type char +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern CHAR(10) = '拉莫', @replacement CHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO + +-- input type varchar +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(10) = '拉莫', @replacement VARCHAR(10) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(MAX) = '拉莫', @replacement VARCHAR(MAX) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_ci_as +GO + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CI_AS FROM babel_4836_replace_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_chinese_prc_cs_as +GO + +SELECT replace(a, b, c) COLLATE CHINESE_PRC_CS_AS FROM babel_4836_replace_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_ci_as +GO + +SELECT replace(a, b, c) COLLATE ARABIC_CI_AS FROM babel_4836_replace_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT replace(a, b, c) FROM babel_4836_replace_arabic_cs_as +GO + +SELECT replace(a, b, c) COLLATE ARABIC_CS_AS FROM babel_4836_replace_arabic_cs_as +GO + +-- input type nchar +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(10) = N'拉莫', @replacement NCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO + +-- with table column of type nchar +SELECT replace(a, b, c) FROM babel_4836_replace_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '🙂de', 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '?de', 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂' +SELECT replace(@inputString, '😎de', 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯' +SELECT replace(@inputString, '拉莫', '尔·比') COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(10) = N'拉莫', @replacement NVARCHAR(10) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(MAX) = N'拉莫', @replacement NVARCHAR(MAX) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) COLLATE CHINESE_PRC_CI_AS +GO + +-- input type binary +DECLARE @inputString BINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO + +DECLARE @inputString BINARY(10) = 0x61626364656667, @pattern BINARY(10) = 0x6364, @replacement BINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO + +-- with table column of type binary +SELECT replace(a, b, c) FROM babel_4836_replace_t4 +GO + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x61626364656667 +SELECT replace(@inputString, 0x6364, 0x737475) +GO + +DECLARE @inputString VARBINARY(10) = 0x61626364656667, @pattern VARBINARY(10) = 0x6364, @replacement VARBINARY(10) = 0x737475 +SELECT replace(@inputString, @pattern, @replacement) +GO + +-- with table column of type varbinary +SELECT replace(a, b, c) FROM babel_4836_replace_t5 +GO + + +-- input type text +SELECT replace(a, b, c) FROM babel_4836_replace_text +GO + +DECLARE @pattern VARCHAR(20) = '?de', @replacement VARCHAR(10) = 'x?y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_text +GO + +-- input type ntext +SELECT replace(a, b, c) FROM babel_4836_replace_ntext +GO + +DECLARE @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(10) = N'x🙂y'; +SELECT replace(a, @pattern, @replacement) FROM babel_4836_replace_ntext +GO + +-- dependent objects +SELECT * FROM babel_4836_replace_dep_view +GO + +SELECT * FROM babel_4836_replace_dep_view1 +GO + +EXEC babel_4836_replace_dep_proc +GO + +SELECT * FROM babel_4836_replace_dep_func() +GO + +SELECT * FROM babel_4836_replace_itvf_func() +GO + +-- different datatypes of inputString and pattern/replacement +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString CHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement)+ '|' +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString VARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'🙂de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'😎de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = N'比尔·拉莫斯', @pattern NVARCHAR(20) = N'拉莫', @replacement NVARCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '🙂de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern CHAR(20) = '😎de', @replacement CHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern CHAR(20) = '拉莫', @replacement CHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '🙂de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = '😎de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern VARCHAR(20) = '拉莫', @replacement VARCHAR(20) = '尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'🙂de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'😎de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = N'比尔·拉莫斯', @pattern NCHAR(20) = N'拉莫', @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement NVARCHAR(20) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement CHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(20) = '?de', @replacement VARCHAR(40) = 'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement VARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(20) = N'?de', @replacement CHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement CHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(20) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂y' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement VARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(20) = N'?de', @replacement NVARCHAR(40) = N'x🙂yw' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement VARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NVARCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement CHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @replacement NCHAR(40) = 'x🙂y' +SELECT replace(@inputString, '?de', @replacement) +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern VARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NVARCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern CHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = 'abc🙂defghi🙂🙂', @pattern NCHAR(40) = '?de' +SELECT replace(@inputString, @pattern, 'x🙂y') +GO + +DECLARE @inputString NVARCHAR(50) = N'ABCDEF', @pattern BINARY(4) = 0x414243, @replacement NCHAR(20) = N'尔·比' +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARBINARY(50) = 0x41424344, @pattern NCHAR(20) = N'尔·比', @replacement VARBINARY(2) = 0x4144 +SELECT replace(@inputString, @pattern, @replacement) +GO + +-- input type UDT +-- in table babel_4836_replace_image_UDT_t, col 'a', 'b' and 'c' has basetype image +SELECT replace(a, b, c) FROM babel_4836_replace_image_UDT_t +GO + +-- in table babel_4836_replace_var_UDT_t, col 'a', 'b' and 'c' has basetype varchar +SELECT replace(b, b, c) FROM babel_4836_replace_var_UDT_t +GO + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, '12', '06'); +GO + +DECLARE @inputString date = '2016-12-21', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern date = '2016-12-21', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @replacement date = '2016-12-21'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString date = '2016-12-21' +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @date date = '2016-12-21', @replacement VARCHAR(10) = '06'; +DECLARE @pattern datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @pattern VARCHAR(20) = '2016-12-21', @date date = '2016-12-21'; +DECLARE @replacement datetime = @date; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern smalldatetime = '2016-12-21 12:43:10', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @pattern VARCHAR(30) = '2016-12-21 12:43:10', @replacement smalldatetime = '2016-12-21 12:43:10'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString time(4) = '12:10:05.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern time(4) = '12:10:05.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @pattern VARCHAR(30) = '12:10:05.1237', @replacement time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @replacement datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(10) = '12', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern datetime2(4) = '1968-10-23 12:45:37.1237', @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @pattern VARCHAR(50) = '1968-10-23 12:45:37.1237', @replacement datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString decimal = 123456, @pattern decimal = 12, @replacement decimal = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern decimal = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement decimal = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString numeric = 12345.12, @pattern numeric = 12, @replacement numeric = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern numeric = 12.12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement numeric = 12.12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString float = 12345.1, @pattern float = 12, @replacement float = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern float = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement float = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString real = 12345.1, @pattern real = 12, @replacement real = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern real = 12.1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement real = 12.1; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString bigint = 12345678, @pattern bigint = 12, @replacement bigint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bigint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bigint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString int = 12345678, @pattern int = 12, @replacement int = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern int = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement int = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString smallint = 12356, @pattern smallint = 12, @replacement smallint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString tinyint = 235, @pattern tinyint = 12, @replacement tinyint = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern tinyint = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement tinyint = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString money = 12356, @pattern money = 12, @replacement money = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern money = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement money = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString smallmoney = 12356, @pattern smallmoney = 12, @replacement smallmoney = 06; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern smallmoney = 12, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement smallmoney = 12; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString bit = 1, @pattern bit = 1, @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern bit = 1, @replacement VARCHAR(10) = '06'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '1234', @replacement bit = 0; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER); +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +SELECT replace(@inputString, @inputString, @inputString) +GO + +SELECT replace(a, a, a) FROM babel_4836_replace_image; +GO + +SELECT replace('a', a, 'a') FROM babel_4836_replace_image; +GO + +SELECT replace('a', 'a', a) FROM babel_4836_replace_image; +GO + +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(a, @pattern, @replacement) from babel_4836_replace_image; +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant); +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern xml = CAST ('' AS xml), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement xml = CAST ('' AS xml); +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geometry = geometry::STGeomFromText('POINT (1 2)', 0), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern geography = geography::STGeomFromText('POINT (1 2)', 4326), @replacement VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @pattern VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @replacement geography = geography::STGeomFromText('POINT (1 2)', 4326); +SELECT replace(@inputString, @pattern, @replacement) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT replace(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @pattern VARCHAR(10) = '6F', @replacement VARCHAR(10) = '5A'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @pattern xml = CAST ('' AS xml), @replacement xml = CAST ('' AS xml); +SELECT replace(CAST (@inputString AS VARCHAR(50)), CAST (@pattern AS VARCHAR(50)), CAST (@replacement AS VARCHAR(50))) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @pattern VARCHAR(10) = '(1 2)', @replacement VARCHAR(10) = '(4 5)'; +SELECT replace(CAST (@inputString AS VARCHAR(50)), @pattern, @replacement) +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/replicate-before-15_8-or-16_4-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/replicate-before-15_8-or-16_4-vu-cleanup.sql new file mode 100644 index 00000000000..69c46d41366 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/replicate-before-15_8-or-16_4-vu-cleanup.sql @@ -0,0 +1,80 @@ +DROP FUNCTION babel_862_replicate_itvf_func +GO + +DROP FUNCTION babel_862_replicate_dep_func +GO + +DROP PROCEDURE babel_862_replicate_dep_proc +GO + +DROP VIEW babel_862_replicate_dep_view +GO + +DROP TABLE babel_862_replicate_UDT +GO + +DROP VIEW babel_862_replicate_dep_view_1 +GO + +DROP VIEW babel_862_replicate_dep_view_2 +GO + +DROP VIEW babel_862_replicate_dep_view_3 +GO + +DROP VIEW babel_862_replicate_dep_view_4 +GO + +DROP VIEW babel_862_replicate_dep_view_5 +GO + +DROP VIEW babel_862_replicate_dep_view_6 +GO + +DROP VIEW babel_862_replicate_dep_view_7 +GO + +DROP TYPE dbo.babel_862_replicate_varUDT +GO + +DROP TYPE dbo.babel_862_replicate_imageUDT +GO + +DROP TABLE babel_862_replicate_text +GO + +DROP TABLE babel_862_replicate_image +GO + +DROP TABLE babel_862_replicate_arabic_ci_ai +GO + +DROP TABLE babel_862_replicate_arabic_cs_as +GO + +DROP TABLE babel_862_replicate_arabic_ci_as +GO + +DROP TABLE babel_862_replicate_chinese_prc_ci_ai +GO + +DROP TABLE babel_862_replicate_chinese_prc_cs_as +GO + +DROP TABLE babel_862_replicate_chinese_prc_ci_as +GO + +DROP TABLE babel_862_replicate_t5 +GO + +DROP TABLE babel_862_replicate_t4 +GO + +DROP TABLE babel_862_replicate_t3 +GO + +DROP TABLE babel_862_replicate_t2 +GO + +DROP TABLE babel_862_replicate_t1 +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/replicate-before-15_8-or-16_4-vu-prepare.sql b/test/JDBC/input/functions/string_functions/replicate-before-15_8-or-16_4-vu-prepare.sql new file mode 100644 index 00000000000..61b08045e69 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/replicate-before-15_8-or-16_4-vu-prepare.sql @@ -0,0 +1,126 @@ +CREATE TABLE babel_862_replicate_t1(a NCHAR(50)) +GO +INSERT INTO babel_862_replicate_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_862_replicate_t1 VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_862_replicate_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_862_replicate_t2 VALUES(N'abc🙂defghi🙂🙂') +GO + +CREATE TABLE babel_862_replicate_t3(a CHAR(50)) +GO +INSERT INTO babel_862_replicate_t3 VALUES('abcdefghi') +GO + +CREATE TABLE babel_862_replicate_t4(a VARCHAR(50)) +GO +INSERT INTO babel_862_replicate_t4 VALUES('abcdefghi') +GO + +CREATE TABLE babel_862_replicate_t5(a VARBINARY(50)) +GO +INSERT INTO babel_862_replicate_t5 VALUES(0x2020616263642020) +GO + +CREATE TABLE babel_862_replicate_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_862_replicate_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_862_replicate_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_862_replicate_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_862_replicate_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_862_replicate_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_862_replicate_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_862_replicate_arabic_ci_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_862_replicate_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_862_replicate_arabic_cs_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_862_replicate_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_862_replicate_arabic_ci_ai VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_862_replicate_image(a IMAGE) +GO +INSERT INTO babel_862_replicate_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_862_replicate_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_862_replicate_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO + +CREATE TYPE dbo.babel_862_replicate_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_862_replicate_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_862_replicate_UDT(a dbo.babel_862_replicate_imageUDT, b dbo.babel_862_replicate_varUDT) +GO +INSERT INTO babel_862_replicate_UDT VALUES(CAST('abcdef' as dbo.babel_862_replicate_imageUDT), CAST('abcdef' as dbo.babel_862_replicate_varUDT)) +GO + +CREATE VIEW babel_862_replicate_dep_view AS + SELECT replicate(a, 4) as result from babel_862_replicate_t2 +GO + +CREATE PROCEDURE babel_862_replicate_dep_proc AS + SELECT replicate(a, 4) as result from babel_862_replicate_t2 +GO + +CREATE FUNCTION babel_862_replicate_dep_func() +RETURNS NVARCHAR(200) +AS +BEGIN +RETURN (SELECT TOP 1 replicate(a, 4) from babel_862_replicate_t2) +END +GO + +CREATE VIEW babel_862_replicate_dep_view_1 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_t1 +GO + +CREATE VIEW babel_862_replicate_dep_view_2 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_t2 +GO + +CREATE VIEW babel_862_replicate_dep_view_3 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_t3 +GO + +CREATE VIEW babel_862_replicate_dep_view_4 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_t4 +GO + +CREATE VIEW babel_862_replicate_dep_view_5 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_t5 +GO + +CREATE VIEW babel_862_replicate_dep_view_6 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_text +GO + +CREATE VIEW babel_862_replicate_dep_view_7 AS + SELECT replicate(b, 4) as result FROM babel_862_replicate_text +GO + +CREATE FUNCTION babel_862_replicate_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT replicate(a, 4) as result from babel_862_replicate_t2) +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/replicate-before-15_8-or-16_4-vu-verify.sql b/test/JDBC/input/functions/string_functions/replicate-before-15_8-or-16_4-vu-verify.sql new file mode 100644 index 00000000000..fa099b56e23 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/replicate-before-15_8-or-16_4-vu-verify.sql @@ -0,0 +1,283 @@ +-- NULL +SELECT replicate(NULL, -2) +GO + +SELECT replicate(NULL, 0) +GO + +SELECT replicate(NULL, 2) +GO + +SELECT replicate('abc', NULL) +GO + +SELECT replicate(NULL, NULL) +GO + +-- edge case values for second parameter +SELECT replicate('AbdefGhi', -2) +GO + +SELECT '|' + replicate('AbdefGhi', 0) + '|' +GO + +SELECT replicate('AbdefGhi', 2) +GO + +SELECT replicate('AbdefGhi', 1001) +GO + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_ci_as +GO + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_862_replicate_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_cs_as +GO + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_862_replicate_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_ci_ai +GO + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_862_replicate_chinese_prc_ci_ai +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_ci_as +GO + +SELECT replicate(a, 4) COLLATE ARABIC_CI_AS FROM babel_862_replicate_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_cs_as +GO + +SELECT replicate(a, 4) COLLATE ARABIC_CS_AS FROM babel_862_replicate_arabic_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_ci_ai +GO + +SELECT replicate(a, 4) COLLATE ARABIC_CI_AI FROM babel_862_replicate_arabic_ci_ai +GO + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO + +-- with table column of type nchar +SELECT replicate(a, 4) FROM babel_862_replicate_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT replicate(@inputString, 4) +GO + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT replicate(@inputString, 4) +GO + +-- dependent objects +SELECT * FROM babel_862_replicate_dep_view +GO + +EXEC babel_862_replicate_dep_proc +GO + +SELECT * FROM babel_862_replicate_dep_func() +GO + +SELECT * FROM babel_862_replicate_itvf_func() +GO + +SELECT * FROM babel_862_replicate_dep_view_1 +GO + +SELECT * FROM babel_862_replicate_dep_view_2 +GO + +SELECT * FROM babel_862_replicate_dep_view_3 +GO + +SELECT * FROM babel_862_replicate_dep_view_4 +GO + +SELECT * FROM babel_862_replicate_dep_view_5 +GO + +SELECT * FROM babel_862_replicate_dep_view_6 +GO + +SELECT * FROM babel_862_replicate_dep_view_7 +GO + +-- input type UDT +-- -- in table babel_862_replicate_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT replicate(a, 4) FROM babel_862_replicate_UDT +GO + +SELECT replicate(b, 4) FROM babel_862_replicate_UDT +GO + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT replicate(@inputString, 4) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString decimal = 123456; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString numeric = 12345.12; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString float = 12345.1; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString real = 12345.1; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString bigint = 12345678; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString int = 12345678; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString smallint = 12356; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString tinyint = 235; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString money = 12356; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString smallmoney = 12356; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString bit = 1; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT replicate(@inputString, 4) +GO + +SELECT replicate(a, 4) from babel_862_replicate_image; +GO + +-- input datatype text +SELECT replicate(a, 4) FROM babel_862_replicate_text +GO + +-- input datatype ntext +SELECT replicate(b, 4) FROM babel_862_replicate_text +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO diff --git a/test/JDBC/input/functions/string_functions/replicate-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/replicate-vu-cleanup.sql new file mode 100644 index 00000000000..69c46d41366 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/replicate-vu-cleanup.sql @@ -0,0 +1,80 @@ +DROP FUNCTION babel_862_replicate_itvf_func +GO + +DROP FUNCTION babel_862_replicate_dep_func +GO + +DROP PROCEDURE babel_862_replicate_dep_proc +GO + +DROP VIEW babel_862_replicate_dep_view +GO + +DROP TABLE babel_862_replicate_UDT +GO + +DROP VIEW babel_862_replicate_dep_view_1 +GO + +DROP VIEW babel_862_replicate_dep_view_2 +GO + +DROP VIEW babel_862_replicate_dep_view_3 +GO + +DROP VIEW babel_862_replicate_dep_view_4 +GO + +DROP VIEW babel_862_replicate_dep_view_5 +GO + +DROP VIEW babel_862_replicate_dep_view_6 +GO + +DROP VIEW babel_862_replicate_dep_view_7 +GO + +DROP TYPE dbo.babel_862_replicate_varUDT +GO + +DROP TYPE dbo.babel_862_replicate_imageUDT +GO + +DROP TABLE babel_862_replicate_text +GO + +DROP TABLE babel_862_replicate_image +GO + +DROP TABLE babel_862_replicate_arabic_ci_ai +GO + +DROP TABLE babel_862_replicate_arabic_cs_as +GO + +DROP TABLE babel_862_replicate_arabic_ci_as +GO + +DROP TABLE babel_862_replicate_chinese_prc_ci_ai +GO + +DROP TABLE babel_862_replicate_chinese_prc_cs_as +GO + +DROP TABLE babel_862_replicate_chinese_prc_ci_as +GO + +DROP TABLE babel_862_replicate_t5 +GO + +DROP TABLE babel_862_replicate_t4 +GO + +DROP TABLE babel_862_replicate_t3 +GO + +DROP TABLE babel_862_replicate_t2 +GO + +DROP TABLE babel_862_replicate_t1 +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/replicate-vu-prepare.sql b/test/JDBC/input/functions/string_functions/replicate-vu-prepare.sql new file mode 100644 index 00000000000..61b08045e69 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/replicate-vu-prepare.sql @@ -0,0 +1,126 @@ +CREATE TABLE babel_862_replicate_t1(a NCHAR(50)) +GO +INSERT INTO babel_862_replicate_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_862_replicate_t1 VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_862_replicate_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_862_replicate_t2 VALUES(N'abc🙂defghi🙂🙂') +GO + +CREATE TABLE babel_862_replicate_t3(a CHAR(50)) +GO +INSERT INTO babel_862_replicate_t3 VALUES('abcdefghi') +GO + +CREATE TABLE babel_862_replicate_t4(a VARCHAR(50)) +GO +INSERT INTO babel_862_replicate_t4 VALUES('abcdefghi') +GO + +CREATE TABLE babel_862_replicate_t5(a VARBINARY(50)) +GO +INSERT INTO babel_862_replicate_t5 VALUES(0x2020616263642020) +GO + +CREATE TABLE babel_862_replicate_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_862_replicate_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_862_replicate_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_862_replicate_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_862_replicate_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_862_replicate_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_862_replicate_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_862_replicate_arabic_ci_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_862_replicate_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_862_replicate_arabic_cs_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_862_replicate_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_862_replicate_arabic_ci_ai VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_862_replicate_image(a IMAGE) +GO +INSERT INTO babel_862_replicate_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_862_replicate_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_862_replicate_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO + +CREATE TYPE dbo.babel_862_replicate_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_862_replicate_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_862_replicate_UDT(a dbo.babel_862_replicate_imageUDT, b dbo.babel_862_replicate_varUDT) +GO +INSERT INTO babel_862_replicate_UDT VALUES(CAST('abcdef' as dbo.babel_862_replicate_imageUDT), CAST('abcdef' as dbo.babel_862_replicate_varUDT)) +GO + +CREATE VIEW babel_862_replicate_dep_view AS + SELECT replicate(a, 4) as result from babel_862_replicate_t2 +GO + +CREATE PROCEDURE babel_862_replicate_dep_proc AS + SELECT replicate(a, 4) as result from babel_862_replicate_t2 +GO + +CREATE FUNCTION babel_862_replicate_dep_func() +RETURNS NVARCHAR(200) +AS +BEGIN +RETURN (SELECT TOP 1 replicate(a, 4) from babel_862_replicate_t2) +END +GO + +CREATE VIEW babel_862_replicate_dep_view_1 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_t1 +GO + +CREATE VIEW babel_862_replicate_dep_view_2 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_t2 +GO + +CREATE VIEW babel_862_replicate_dep_view_3 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_t3 +GO + +CREATE VIEW babel_862_replicate_dep_view_4 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_t4 +GO + +CREATE VIEW babel_862_replicate_dep_view_5 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_t5 +GO + +CREATE VIEW babel_862_replicate_dep_view_6 AS + SELECT replicate(a, 4) as result FROM babel_862_replicate_text +GO + +CREATE VIEW babel_862_replicate_dep_view_7 AS + SELECT replicate(b, 4) as result FROM babel_862_replicate_text +GO + +CREATE FUNCTION babel_862_replicate_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT replicate(a, 4) as result from babel_862_replicate_t2) +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/replicate-vu-verify.sql b/test/JDBC/input/functions/string_functions/replicate-vu-verify.sql new file mode 100644 index 00000000000..fa099b56e23 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/replicate-vu-verify.sql @@ -0,0 +1,283 @@ +-- NULL +SELECT replicate(NULL, -2) +GO + +SELECT replicate(NULL, 0) +GO + +SELECT replicate(NULL, 2) +GO + +SELECT replicate('abc', NULL) +GO + +SELECT replicate(NULL, NULL) +GO + +-- edge case values for second parameter +SELECT replicate('AbdefGhi', -2) +GO + +SELECT '|' + replicate('AbdefGhi', 0) + '|' +GO + +SELECT replicate('AbdefGhi', 2) +GO + +SELECT replicate('AbdefGhi', 1001) +GO + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT replicate(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_ci_as +GO + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_862_replicate_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_cs_as +GO + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_862_replicate_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT replicate(a, 4) FROM babel_862_replicate_chinese_prc_ci_ai +GO + +SELECT replicate(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_862_replicate_chinese_prc_ci_ai +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_ci_as +GO + +SELECT replicate(a, 4) COLLATE ARABIC_CI_AS FROM babel_862_replicate_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_cs_as +GO + +SELECT replicate(a, 4) COLLATE ARABIC_CS_AS FROM babel_862_replicate_arabic_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT replicate(a, 4) FROM babel_862_replicate_arabic_ci_ai +GO + +SELECT replicate(a, 4) COLLATE ARABIC_CI_AI FROM babel_862_replicate_arabic_ci_ai +GO + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO + +-- with table column of type nchar +SELECT replicate(a, 4) FROM babel_862_replicate_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT replicate(@inputString, 4) +GO + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT replicate(@inputString, 4) +GO + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT replicate(@inputString, 4) +GO + +-- dependent objects +SELECT * FROM babel_862_replicate_dep_view +GO + +EXEC babel_862_replicate_dep_proc +GO + +SELECT * FROM babel_862_replicate_dep_func() +GO + +SELECT * FROM babel_862_replicate_itvf_func() +GO + +SELECT * FROM babel_862_replicate_dep_view_1 +GO + +SELECT * FROM babel_862_replicate_dep_view_2 +GO + +SELECT * FROM babel_862_replicate_dep_view_3 +GO + +SELECT * FROM babel_862_replicate_dep_view_4 +GO + +SELECT * FROM babel_862_replicate_dep_view_5 +GO + +SELECT * FROM babel_862_replicate_dep_view_6 +GO + +SELECT * FROM babel_862_replicate_dep_view_7 +GO + +-- input type UDT +-- -- in table babel_862_replicate_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT replicate(a, 4) FROM babel_862_replicate_UDT +GO + +SELECT replicate(b, 4) FROM babel_862_replicate_UDT +GO + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT replicate(@inputString, 4) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString decimal = 123456; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString numeric = 12345.12; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString float = 12345.1; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString real = 12345.1; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString bigint = 12345678; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString int = 12345678; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString smallint = 12356; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString tinyint = 235; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString money = 12356; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString smallmoney = 12356; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString bit = 1; +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT replicate(@inputString, 4) +GO + +SELECT replicate(a, 4) from babel_862_replicate_image; +GO + +-- input datatype text +SELECT replicate(a, 4) FROM babel_862_replicate_text +GO + +-- input datatype ntext +SELECT replicate(b, 4) FROM babel_862_replicate_text +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT replicate(@inputString, 4) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT replicate(CAST(@inputString AS VARCHAR(50)), 4) +GO diff --git a/test/JDBC/input/functions/string_functions/reverse-before-15_8-or-16_4-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/reverse-before-15_8-or-16_4-vu-cleanup.sql new file mode 100644 index 00000000000..f285ad662a0 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/reverse-before-15_8-or-16_4-vu-cleanup.sql @@ -0,0 +1,80 @@ +DROP FUNCTION babel_4839_reverse_itvf_func +GO + +DROP FUNCTION babel_4839_reverse_dep_func +GO + +DROP PROCEDURE babel_4839_reverse_dep_proc +GO + +DROP VIEW babel_4839_reverse_dep_view +GO + +DROP TABLE babel_4839_reverse_UDT +GO + +DROP VIEW babel_4839_reverse_dep_view_1 +GO + +DROP VIEW babel_4839_reverse_dep_view_2 +GO + +DROP VIEW babel_4839_reverse_dep_view_3 +GO + +DROP VIEW babel_4839_reverse_dep_view_4 +GO + +DROP VIEW babel_4839_reverse_dep_view_5 +GO + +DROP VIEW babel_4839_reverse_dep_view_6 +GO + +DROP VIEW babel_4839_reverse_dep_view_7 +GO + +DROP TYPE dbo.babel_4839_reverse_varUDT +GO + +DROP TYPE dbo.babel_4839_reverse_imageUDT +GO + +DROP TABLE babel_4839_reverse_text +GO + +DROP TABLE babel_4839_reverse_image +GO + +DROP TABLE babel_4839_reverse_arabic_ci_ai +GO + +DROP TABLE babel_4839_reverse_arabic_cs_as +GO + +DROP TABLE babel_4839_reverse_arabic_ci_as +GO + +DROP TABLE babel_4839_reverse_chinese_prc_ci_ai +GO + +DROP TABLE babel_4839_reverse_chinese_prc_cs_as +GO + +DROP TABLE babel_4839_reverse_chinese_prc_ci_as +GO + +DROP TABLE babel_4839_reverse_t5 +GO + +DROP TABLE babel_4839_reverse_t4 +GO + +DROP TABLE babel_4839_reverse_t3 +GO + +DROP TABLE babel_4839_reverse_t2 +GO + +DROP TABLE babel_4839_reverse_t1 +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/reverse-before-15_8-or-16_4-vu-prepare.sql b/test/JDBC/input/functions/string_functions/reverse-before-15_8-or-16_4-vu-prepare.sql new file mode 100644 index 00000000000..b1cba9cffa9 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/reverse-before-15_8-or-16_4-vu-prepare.sql @@ -0,0 +1,126 @@ +CREATE TABLE babel_4839_reverse_t1(a NCHAR(50)) +GO +INSERT INTO babel_4839_reverse_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_4839_reverse_t1 VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4839_reverse_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4839_reverse_t2 VALUES(N'abc🙂defghi🙂🙂') +GO + +CREATE TABLE babel_4839_reverse_t3(a CHAR(50)) +GO +INSERT INTO babel_4839_reverse_t3 VALUES('abcdefghi') +GO + +CREATE TABLE babel_4839_reverse_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4839_reverse_t4 VALUES('abcdefghi') +GO + +CREATE TABLE babel_4839_reverse_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4839_reverse_t5 VALUES(0x2020616263642020) +GO + +CREATE TABLE babel_4839_reverse_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4839_reverse_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4839_reverse_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4839_reverse_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4839_reverse_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4839_reverse_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4839_reverse_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4839_reverse_arabic_ci_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4839_reverse_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4839_reverse_arabic_cs_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4839_reverse_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4839_reverse_arabic_ci_ai VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4839_reverse_image(a IMAGE) +GO +INSERT INTO babel_4839_reverse_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_4839_reverse_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4839_reverse_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO + +CREATE TYPE dbo.babel_4839_reverse_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4839_reverse_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4839_reverse_UDT(a dbo.babel_4839_reverse_imageUDT, b dbo.babel_4839_reverse_varUDT) +GO +INSERT INTO babel_4839_reverse_UDT VALUES(CAST('abcdef' as dbo.babel_4839_reverse_imageUDT), CAST('abcdef' as dbo.babel_4839_reverse_varUDT)) +GO + +CREATE VIEW babel_4839_reverse_dep_view AS + SELECT reverse(a) as result from babel_4839_reverse_t2 +GO + +CREATE PROCEDURE babel_4839_reverse_dep_proc AS + SELECT reverse(a) as result from babel_4839_reverse_t2 +GO + +CREATE FUNCTION babel_4839_reverse_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 reverse(a) from babel_4839_reverse_t2) +END +GO + +CREATE VIEW babel_4839_reverse_dep_view_1 AS + SELECT reverse(a) as result FROM babel_4839_reverse_t1 +GO + +CREATE VIEW babel_4839_reverse_dep_view_2 AS + SELECT reverse(a) as result FROM babel_4839_reverse_t2 +GO + +CREATE VIEW babel_4839_reverse_dep_view_3 AS + SELECT reverse(a) as result FROM babel_4839_reverse_t3 +GO + +CREATE VIEW babel_4839_reverse_dep_view_4 AS + SELECT reverse(a) as result FROM babel_4839_reverse_t4 +GO + +CREATE VIEW babel_4839_reverse_dep_view_5 AS + SELECT reverse(a) as result FROM babel_4839_reverse_t5 +GO + +CREATE VIEW babel_4839_reverse_dep_view_6 AS + SELECT reverse(a) as result FROM babel_4839_reverse_text +GO + +CREATE VIEW babel_4839_reverse_dep_view_7 AS + SELECT reverse(b) as result FROM babel_4839_reverse_text +GO + +CREATE FUNCTION babel_4839_reverse_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT reverse(a) as result from babel_4839_reverse_t2) +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/reverse-before-15_8-or-16_4-vu-verify.sql b/test/JDBC/input/functions/string_functions/reverse-before-15_8-or-16_4-vu-verify.sql new file mode 100644 index 00000000000..57acb62db07 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/reverse-before-15_8-or-16_4-vu-verify.sql @@ -0,0 +1,262 @@ +-- NULL +SELECT reverse(NULL) +GO + +-- empty string +SELECT reverse('') +GO + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) +GO + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) COLLATE CHINESE_PRC_CI_AS +GO + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) +GO + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) COLLATE CHINESE_PRC_CI_AS +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_ci_as +GO + +SELECT reverse(a) COLLATE CHINESE_PRC_CI_AS FROM babel_4839_reverse_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_cs_as +GO + +SELECT reverse(a) COLLATE CHINESE_PRC_CS_AS FROM babel_4839_reverse_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_ci_ai +GO + +SELECT reverse(a) COLLATE CHINESE_PRC_CI_AI FROM babel_4839_reverse_chinese_prc_ci_ai +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT reverse(a) FROM babel_4839_reverse_arabic_ci_as +GO + +SELECT reverse(a) COLLATE ARABIC_CI_AS FROM babel_4839_reverse_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT reverse(a) FROM babel_4839_reverse_arabic_cs_as +GO + +SELECT reverse(a) COLLATE ARABIC_CS_AS FROM babel_4839_reverse_arabic_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT reverse(a) FROM babel_4839_reverse_arabic_ci_ai +GO + +SELECT reverse(a) COLLATE ARABIC_CI_AI FROM babel_4839_reverse_arabic_ci_ai +GO + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT reverse(@inputString) +GO + +-- with table column of type nchar +SELECT reverse(a) FROM babel_4839_reverse_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT reverse(@inputString) +GO + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT reverse(@inputString) +GO + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT reverse(@inputString) +GO + +-- dependent objects +SELECT * FROM babel_4839_reverse_dep_view +GO + +EXEC babel_4839_reverse_dep_proc +GO + +SELECT * FROM babel_4839_reverse_dep_func() +GO + +SELECT * FROM babel_4839_reverse_itvf_func() +GO + +SELECT * FROM babel_4839_reverse_dep_view_1 +GO + +SELECT * FROM babel_4839_reverse_dep_view_2 +GO + +SELECT * FROM babel_4839_reverse_dep_view_3 +GO + +SELECT * FROM babel_4839_reverse_dep_view_4 +GO + +SELECT * FROM babel_4839_reverse_dep_view_5 +GO + +SELECT * FROM babel_4839_reverse_dep_view_6 +GO + +SELECT * FROM babel_4839_reverse_dep_view_7 +GO + +-- input type UDT +-- -- in table babel_4839_reverse_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT reverse(a) FROM babel_4839_reverse_UDT +GO + +SELECT reverse(b) FROM babel_4839_reverse_UDT +GO + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT reverse(@inputString) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT reverse(@inputString) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT reverse(@inputString) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT reverse(@inputString) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT reverse(@inputString) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT reverse(@inputString) +GO + +DECLARE @inputString decimal = 123456; +SELECT reverse(@inputString) +GO + +DECLARE @inputString numeric = 12345.12; +SELECT reverse(@inputString) +GO + +DECLARE @inputString float = 12345.1; +SELECT reverse(@inputString) +GO + +DECLARE @inputString real = 12345.1; +SELECT reverse(@inputString) +GO + +DECLARE @inputString bigint = 12345678; +SELECT reverse(@inputString) +GO + +DECLARE @inputString int = 12345678; +SELECT reverse(@inputString) +GO + +DECLARE @inputString smallint = 12356; +SELECT reverse(@inputString) +GO + +DECLARE @inputString tinyint = 235; +SELECT reverse(@inputString) +GO + +DECLARE @inputString money = 12356; +SELECT reverse(@inputString) +GO + +DECLARE @inputString smallmoney = 12356; +SELECT reverse(@inputString) +GO + +DECLARE @inputString bit = 1; +SELECT reverse(@inputString) +GO + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT reverse(@inputString) +GO + +SELECT reverse(a) from babel_4839_reverse_image; +GO + +-- input datatype text +SELECT reverse(a) FROM babel_4839_reverse_text +GO + +-- input datatype ntext +SELECT reverse(b) FROM babel_4839_reverse_text +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT reverse(@inputString) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT reverse(@inputString) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT reverse(@inputString) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT reverse(@inputString) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO diff --git a/test/JDBC/input/functions/string_functions/reverse-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/reverse-vu-cleanup.sql new file mode 100644 index 00000000000..f285ad662a0 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/reverse-vu-cleanup.sql @@ -0,0 +1,80 @@ +DROP FUNCTION babel_4839_reverse_itvf_func +GO + +DROP FUNCTION babel_4839_reverse_dep_func +GO + +DROP PROCEDURE babel_4839_reverse_dep_proc +GO + +DROP VIEW babel_4839_reverse_dep_view +GO + +DROP TABLE babel_4839_reverse_UDT +GO + +DROP VIEW babel_4839_reverse_dep_view_1 +GO + +DROP VIEW babel_4839_reverse_dep_view_2 +GO + +DROP VIEW babel_4839_reverse_dep_view_3 +GO + +DROP VIEW babel_4839_reverse_dep_view_4 +GO + +DROP VIEW babel_4839_reverse_dep_view_5 +GO + +DROP VIEW babel_4839_reverse_dep_view_6 +GO + +DROP VIEW babel_4839_reverse_dep_view_7 +GO + +DROP TYPE dbo.babel_4839_reverse_varUDT +GO + +DROP TYPE dbo.babel_4839_reverse_imageUDT +GO + +DROP TABLE babel_4839_reverse_text +GO + +DROP TABLE babel_4839_reverse_image +GO + +DROP TABLE babel_4839_reverse_arabic_ci_ai +GO + +DROP TABLE babel_4839_reverse_arabic_cs_as +GO + +DROP TABLE babel_4839_reverse_arabic_ci_as +GO + +DROP TABLE babel_4839_reverse_chinese_prc_ci_ai +GO + +DROP TABLE babel_4839_reverse_chinese_prc_cs_as +GO + +DROP TABLE babel_4839_reverse_chinese_prc_ci_as +GO + +DROP TABLE babel_4839_reverse_t5 +GO + +DROP TABLE babel_4839_reverse_t4 +GO + +DROP TABLE babel_4839_reverse_t3 +GO + +DROP TABLE babel_4839_reverse_t2 +GO + +DROP TABLE babel_4839_reverse_t1 +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/reverse-vu-prepare.sql b/test/JDBC/input/functions/string_functions/reverse-vu-prepare.sql new file mode 100644 index 00000000000..b1cba9cffa9 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/reverse-vu-prepare.sql @@ -0,0 +1,126 @@ +CREATE TABLE babel_4839_reverse_t1(a NCHAR(50)) +GO +INSERT INTO babel_4839_reverse_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_4839_reverse_t1 VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4839_reverse_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4839_reverse_t2 VALUES(N'abc🙂defghi🙂🙂') +GO + +CREATE TABLE babel_4839_reverse_t3(a CHAR(50)) +GO +INSERT INTO babel_4839_reverse_t3 VALUES('abcdefghi') +GO + +CREATE TABLE babel_4839_reverse_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4839_reverse_t4 VALUES('abcdefghi') +GO + +CREATE TABLE babel_4839_reverse_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4839_reverse_t5 VALUES(0x2020616263642020) +GO + +CREATE TABLE babel_4839_reverse_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4839_reverse_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4839_reverse_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4839_reverse_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4839_reverse_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4839_reverse_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4839_reverse_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4839_reverse_arabic_ci_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4839_reverse_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4839_reverse_arabic_cs_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4839_reverse_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4839_reverse_arabic_ci_ai VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4839_reverse_image(a IMAGE) +GO +INSERT INTO babel_4839_reverse_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_4839_reverse_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4839_reverse_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO + +CREATE TYPE dbo.babel_4839_reverse_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4839_reverse_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4839_reverse_UDT(a dbo.babel_4839_reverse_imageUDT, b dbo.babel_4839_reverse_varUDT) +GO +INSERT INTO babel_4839_reverse_UDT VALUES(CAST('abcdef' as dbo.babel_4839_reverse_imageUDT), CAST('abcdef' as dbo.babel_4839_reverse_varUDT)) +GO + +CREATE VIEW babel_4839_reverse_dep_view AS + SELECT reverse(a) as result from babel_4839_reverse_t2 +GO + +CREATE PROCEDURE babel_4839_reverse_dep_proc AS + SELECT reverse(a) as result from babel_4839_reverse_t2 +GO + +CREATE FUNCTION babel_4839_reverse_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 reverse(a) from babel_4839_reverse_t2) +END +GO + +CREATE VIEW babel_4839_reverse_dep_view_1 AS + SELECT reverse(a) as result FROM babel_4839_reverse_t1 +GO + +CREATE VIEW babel_4839_reverse_dep_view_2 AS + SELECT reverse(a) as result FROM babel_4839_reverse_t2 +GO + +CREATE VIEW babel_4839_reverse_dep_view_3 AS + SELECT reverse(a) as result FROM babel_4839_reverse_t3 +GO + +CREATE VIEW babel_4839_reverse_dep_view_4 AS + SELECT reverse(a) as result FROM babel_4839_reverse_t4 +GO + +CREATE VIEW babel_4839_reverse_dep_view_5 AS + SELECT reverse(a) as result FROM babel_4839_reverse_t5 +GO + +CREATE VIEW babel_4839_reverse_dep_view_6 AS + SELECT reverse(a) as result FROM babel_4839_reverse_text +GO + +CREATE VIEW babel_4839_reverse_dep_view_7 AS + SELECT reverse(b) as result FROM babel_4839_reverse_text +GO + +CREATE FUNCTION babel_4839_reverse_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT reverse(a) as result from babel_4839_reverse_t2) +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/reverse-vu-verify.sql b/test/JDBC/input/functions/string_functions/reverse-vu-verify.sql new file mode 100644 index 00000000000..57acb62db07 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/reverse-vu-verify.sql @@ -0,0 +1,262 @@ +-- NULL +SELECT reverse(NULL) +GO + +-- empty string +SELECT reverse('') +GO + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) +GO + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) COLLATE CHINESE_PRC_CI_AS +GO + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) +GO + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT reverse(@inputString) COLLATE CHINESE_PRC_CI_AS +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_ci_as +GO + +SELECT reverse(a) COLLATE CHINESE_PRC_CI_AS FROM babel_4839_reverse_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_cs_as +GO + +SELECT reverse(a) COLLATE CHINESE_PRC_CS_AS FROM babel_4839_reverse_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT reverse(a) FROM babel_4839_reverse_chinese_prc_ci_ai +GO + +SELECT reverse(a) COLLATE CHINESE_PRC_CI_AI FROM babel_4839_reverse_chinese_prc_ci_ai +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT reverse(a) FROM babel_4839_reverse_arabic_ci_as +GO + +SELECT reverse(a) COLLATE ARABIC_CI_AS FROM babel_4839_reverse_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT reverse(a) FROM babel_4839_reverse_arabic_cs_as +GO + +SELECT reverse(a) COLLATE ARABIC_CS_AS FROM babel_4839_reverse_arabic_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT reverse(a) FROM babel_4839_reverse_arabic_ci_ai +GO + +SELECT reverse(a) COLLATE ARABIC_CI_AI FROM babel_4839_reverse_arabic_ci_ai +GO + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT reverse(@inputString) +GO + +-- with table column of type nchar +SELECT reverse(a) FROM babel_4839_reverse_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT reverse(@inputString) +GO + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT reverse(@inputString) +GO + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT reverse(@inputString) +GO + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT reverse(@inputString) +GO + +-- dependent objects +SELECT * FROM babel_4839_reverse_dep_view +GO + +EXEC babel_4839_reverse_dep_proc +GO + +SELECT * FROM babel_4839_reverse_dep_func() +GO + +SELECT * FROM babel_4839_reverse_itvf_func() +GO + +SELECT * FROM babel_4839_reverse_dep_view_1 +GO + +SELECT * FROM babel_4839_reverse_dep_view_2 +GO + +SELECT * FROM babel_4839_reverse_dep_view_3 +GO + +SELECT * FROM babel_4839_reverse_dep_view_4 +GO + +SELECT * FROM babel_4839_reverse_dep_view_5 +GO + +SELECT * FROM babel_4839_reverse_dep_view_6 +GO + +SELECT * FROM babel_4839_reverse_dep_view_7 +GO + +-- input type UDT +-- -- in table babel_4839_reverse_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT reverse(a) FROM babel_4839_reverse_UDT +GO + +SELECT reverse(b) FROM babel_4839_reverse_UDT +GO + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT reverse(@inputString) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT reverse(@inputString) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT reverse(@inputString) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT reverse(@inputString) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT reverse(@inputString) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT reverse(@inputString) +GO + +DECLARE @inputString decimal = 123456; +SELECT reverse(@inputString) +GO + +DECLARE @inputString numeric = 12345.12; +SELECT reverse(@inputString) +GO + +DECLARE @inputString float = 12345.1; +SELECT reverse(@inputString) +GO + +DECLARE @inputString real = 12345.1; +SELECT reverse(@inputString) +GO + +DECLARE @inputString bigint = 12345678; +SELECT reverse(@inputString) +GO + +DECLARE @inputString int = 12345678; +SELECT reverse(@inputString) +GO + +DECLARE @inputString smallint = 12356; +SELECT reverse(@inputString) +GO + +DECLARE @inputString tinyint = 235; +SELECT reverse(@inputString) +GO + +DECLARE @inputString money = 12356; +SELECT reverse(@inputString) +GO + +DECLARE @inputString smallmoney = 12356; +SELECT reverse(@inputString) +GO + +DECLARE @inputString bit = 1; +SELECT reverse(@inputString) +GO + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT reverse(@inputString) +GO + +SELECT reverse(a) from babel_4839_reverse_image; +GO + +-- input datatype text +SELECT reverse(a) FROM babel_4839_reverse_text +GO + +-- input datatype ntext +SELECT reverse(b) FROM babel_4839_reverse_text +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT reverse(@inputString) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT reverse(@inputString) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT reverse(@inputString) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT reverse(@inputString) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT reverse(CAST(@inputString AS VARCHAR(50))) +GO diff --git a/test/JDBC/input/functions/string_functions/right-before-15_8-or-16_4-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/right-before-15_8-or-16_4-vu-cleanup.sql new file mode 100644 index 00000000000..5b804d8f235 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/right-before-15_8-or-16_4-vu-cleanup.sql @@ -0,0 +1,80 @@ +DROP FUNCTION babel_4489_right_itvf_func +GO + +DROP FUNCTION babel_4489_right_dep_func +GO + +DROP PROCEDURE babel_4489_right_dep_proc +GO + +DROP VIEW babel_4489_right_dep_view +GO + +DROP TABLE babel_4489_right_UDT +GO + +DROP VIEW babel_4489_right_dep_view_1 +GO + +DROP VIEW babel_4489_right_dep_view_2 +GO + +DROP VIEW babel_4489_right_dep_view_3 +GO + +DROP VIEW babel_4489_right_dep_view_4 +GO + +DROP VIEW babel_4489_right_dep_view_5 +GO + +DROP VIEW babel_4489_right_dep_view_6 +GO + +DROP VIEW babel_4489_right_dep_view_7 +GO + +DROP TYPE dbo.babel_4489_right_varUDT +GO + +DROP TYPE dbo.babel_4489_right_imageUDT +GO + +DROP TABLE babel_4489_right_text +GO + +DROP TABLE babel_4489_right_image +GO + +DROP TABLE babel_4489_right_arabic_ci_ai +GO + +DROP TABLE babel_4489_right_arabic_cs_as +GO + +DROP TABLE babel_4489_right_arabic_ci_as +GO + +DROP TABLE babel_4489_right_chinese_prc_ci_ai +GO + +DROP TABLE babel_4489_right_chinese_prc_cs_as +GO + +DROP TABLE babel_4489_right_chinese_prc_ci_as +GO + +DROP TABLE babel_4489_right_t5 +GO + +DROP TABLE babel_4489_right_t4 +GO + +DROP TABLE babel_4489_right_t3 +GO + +DROP TABLE babel_4489_right_t2 +GO + +DROP TABLE babel_4489_right_t1 +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/right-before-15_8-or-16_4-vu-prepare.sql b/test/JDBC/input/functions/string_functions/right-before-15_8-or-16_4-vu-prepare.sql new file mode 100644 index 00000000000..a7637d2356e --- /dev/null +++ b/test/JDBC/input/functions/string_functions/right-before-15_8-or-16_4-vu-prepare.sql @@ -0,0 +1,126 @@ +CREATE TABLE babel_4489_right_t1(a NCHAR(15)) +GO +INSERT INTO babel_4489_right_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_4489_right_t1 VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4489_right_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4489_right_t2 VALUES(N'abc🙂defghi🙂🙂') +GO + +CREATE TABLE babel_4489_right_t3(a CHAR(50)) +GO +INSERT INTO babel_4489_right_t3 VALUES(' abcdefghi ') +GO + +CREATE TABLE babel_4489_right_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4489_right_t4 VALUES(' abcdefghi ') +GO + +CREATE TABLE babel_4489_right_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4489_right_t5 VALUES(0x2020616263642020) +GO + +CREATE TABLE babel_4489_right_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4489_right_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4489_right_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4489_right_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4489_right_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4489_right_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4489_right_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4489_right_arabic_ci_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4489_right_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4489_right_arabic_cs_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4489_right_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4489_right_arabic_ci_ai VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4489_right_image(a IMAGE) +GO +INSERT INTO babel_4489_right_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_4489_right_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4489_right_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO + +CREATE TYPE dbo.babel_4489_right_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4489_right_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4489_right_UDT(a dbo.babel_4489_right_imageUDT, b dbo.babel_4489_right_varUDT) +GO +INSERT INTO babel_4489_right_UDT VALUES(CAST('abcdef' as dbo.babel_4489_right_imageUDT), CAST('abcdef' as dbo.babel_4489_right_varUDT)) +GO + +CREATE VIEW babel_4489_right_dep_view AS + SELECT RIGHT(a, 5) as result from babel_4489_right_t2 +GO + +CREATE PROCEDURE babel_4489_right_dep_proc AS + SELECT RIGHT(a, 5) as result from babel_4489_right_t2 +GO + +CREATE FUNCTION babel_4489_right_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 RIGHT(a, 5) from babel_4489_right_t2) +END +GO + +CREATE VIEW babel_4489_right_dep_view_1 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_t1 +GO + +CREATE VIEW babel_4489_right_dep_view_2 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_t2 +GO + +CREATE VIEW babel_4489_right_dep_view_3 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_t3 +GO + +CREATE VIEW babel_4489_right_dep_view_4 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_t4 +GO + +CREATE VIEW babel_4489_right_dep_view_5 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_t5 +GO + +CREATE VIEW babel_4489_right_dep_view_6 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_text +GO + +CREATE VIEW babel_4489_right_dep_view_7 AS + SELECT RIGHT(b, 5) as result FROM babel_4489_right_text +GO + +CREATE FUNCTION babel_4489_right_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT RIGHT(a, 5) as result from babel_4489_right_t2) +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/right-before-15_8-or-16_4-vu-verify.sql b/test/JDBC/input/functions/string_functions/right-before-15_8-or-16_4-vu-verify.sql new file mode 100644 index 00000000000..ae50e1acba0 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/right-before-15_8-or-16_4-vu-verify.sql @@ -0,0 +1,314 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(25) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO + +-- NULL +SELECT RIGHT(NULL, -2) +GO + +SELECT RIGHT(NULL, 0) +GO + +SELECT RIGHT(NULL, 2) +GO + +SELECT RIGHT('abc', NULL) +GO + +SELECT RIGHT(NULL, NULL) +GO + +-- edge case values for second parameter +SELECT RIGHT('AbdefGhi', -2) +GO + +SELECT '|' + RIGHT('AbdefGhi', 0) + '|' +GO + +SELECT RIGHT('AbdefGhi', 2) +GO + +SELECT RIGHT('AbdefGhi', 2147483646) +GO + +SELECT RIGHT('AbdefGhi', 2147483650) +GO + +-- input type char +DECLARE @inputString CHAR(15) = 'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 8) + '|' +GO + +DECLARE @inputString CHAR(15) = '比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) + '|' +GO + +DECLARE @inputString CHAR(15) = '比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString CHAR(15) = 'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 50) + '|' +GO + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 5) +GO + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) +GO + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 50) +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_ci_as +GO + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_4489_right_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_cs_as +GO + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_4489_right_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_ci_ai +GO + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_4489_right_chinese_prc_ci_ai +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_ci_as +GO + +SELECT RIGHT(a, 4) COLLATE ARABIC_CI_AS FROM babel_4489_right_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_cs_as +GO + +SELECT RIGHT(a, 4) COLLATE ARABIC_CS_AS FROM babel_4489_right_arabic_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_ci_ai +GO + +SELECT RIGHT(a, 4) COLLATE ARABIC_CI_AI FROM babel_4489_right_arabic_ci_ai +GO + +-- input type nchar +DECLARE @inputString NCHAR(15) = N'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 8) + '|' +GO + +DECLARE @inputString NCHAR(15) = N'比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) + '|' +GO + +DECLARE @inputString NCHAR(15) = N'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 50) + '|' +GO + +-- with table column of type nchar +SELECT '|' + RIGHT(a, 13) + '|' FROM babel_4489_right_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 5) +GO + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) +GO + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 50) +GO + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT RIGHT(@inputString, 4) +GO + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT RIGHT(@inputString, 4) +GO + +-- dependent objects +SELECT * FROM babel_4489_right_dep_view +GO + +EXEC babel_4489_right_dep_proc +GO + +SELECT * FROM babel_4489_right_dep_func() +GO + +SELECT * FROM babel_4489_right_itvf_func() +GO + +SELECT * FROM babel_4489_right_dep_view_1 +GO + +SELECT * FROM babel_4489_right_dep_view_2 +GO + +SELECT * FROM babel_4489_right_dep_view_3 +GO + +SELECT * FROM babel_4489_right_dep_view_4 +GO + +SELECT * FROM babel_4489_right_dep_view_5 +GO + +SELECT * FROM babel_4489_right_dep_view_6 +GO + +SELECT * FROM babel_4489_right_dep_view_7 +GO + +-- input type UDT +-- -- in table babel_4489_right_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT RIGHT(a, 3) FROM babel_4489_right_UDT +GO + +SELECT RIGHT(b, 3) FROM babel_4489_right_UDT +GO + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString decimal = 123456; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString numeric = 12345.12; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString float = 12345.1; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString real = 12345.1; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString bigint = 12345678; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString int = 12345678; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString smallint = 12356; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString tinyint = 235; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString money = 12356; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString smallmoney = 12356; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString bit = 1; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT RIGHT(@inputString, 3) +GO + +SELECT RIGHT(a, 5) from babel_4489_right_image; +GO + +-- input datatype text +SELECT RIGHT(a, 5) FROM babel_4489_right_text +GO + +-- input datatype ntext +SELECT RIGHT(b, 5) FROM babel_4489_right_text +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO diff --git a/test/JDBC/input/functions/string_functions/right-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/right-vu-cleanup.sql new file mode 100644 index 00000000000..5b804d8f235 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/right-vu-cleanup.sql @@ -0,0 +1,80 @@ +DROP FUNCTION babel_4489_right_itvf_func +GO + +DROP FUNCTION babel_4489_right_dep_func +GO + +DROP PROCEDURE babel_4489_right_dep_proc +GO + +DROP VIEW babel_4489_right_dep_view +GO + +DROP TABLE babel_4489_right_UDT +GO + +DROP VIEW babel_4489_right_dep_view_1 +GO + +DROP VIEW babel_4489_right_dep_view_2 +GO + +DROP VIEW babel_4489_right_dep_view_3 +GO + +DROP VIEW babel_4489_right_dep_view_4 +GO + +DROP VIEW babel_4489_right_dep_view_5 +GO + +DROP VIEW babel_4489_right_dep_view_6 +GO + +DROP VIEW babel_4489_right_dep_view_7 +GO + +DROP TYPE dbo.babel_4489_right_varUDT +GO + +DROP TYPE dbo.babel_4489_right_imageUDT +GO + +DROP TABLE babel_4489_right_text +GO + +DROP TABLE babel_4489_right_image +GO + +DROP TABLE babel_4489_right_arabic_ci_ai +GO + +DROP TABLE babel_4489_right_arabic_cs_as +GO + +DROP TABLE babel_4489_right_arabic_ci_as +GO + +DROP TABLE babel_4489_right_chinese_prc_ci_ai +GO + +DROP TABLE babel_4489_right_chinese_prc_cs_as +GO + +DROP TABLE babel_4489_right_chinese_prc_ci_as +GO + +DROP TABLE babel_4489_right_t5 +GO + +DROP TABLE babel_4489_right_t4 +GO + +DROP TABLE babel_4489_right_t3 +GO + +DROP TABLE babel_4489_right_t2 +GO + +DROP TABLE babel_4489_right_t1 +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/right-vu-prepare.sql b/test/JDBC/input/functions/string_functions/right-vu-prepare.sql new file mode 100644 index 00000000000..a7637d2356e --- /dev/null +++ b/test/JDBC/input/functions/string_functions/right-vu-prepare.sql @@ -0,0 +1,126 @@ +CREATE TABLE babel_4489_right_t1(a NCHAR(15)) +GO +INSERT INTO babel_4489_right_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_4489_right_t1 VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4489_right_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4489_right_t2 VALUES(N'abc🙂defghi🙂🙂') +GO + +CREATE TABLE babel_4489_right_t3(a CHAR(50)) +GO +INSERT INTO babel_4489_right_t3 VALUES(' abcdefghi ') +GO + +CREATE TABLE babel_4489_right_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4489_right_t4 VALUES(' abcdefghi ') +GO + +CREATE TABLE babel_4489_right_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4489_right_t5 VALUES(0x2020616263642020) +GO + +CREATE TABLE babel_4489_right_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4489_right_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4489_right_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4489_right_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4489_right_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4489_right_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4489_right_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4489_right_arabic_ci_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4489_right_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4489_right_arabic_cs_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4489_right_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4489_right_arabic_ci_ai VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4489_right_image(a IMAGE) +GO +INSERT INTO babel_4489_right_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_4489_right_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4489_right_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO + +CREATE TYPE dbo.babel_4489_right_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4489_right_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4489_right_UDT(a dbo.babel_4489_right_imageUDT, b dbo.babel_4489_right_varUDT) +GO +INSERT INTO babel_4489_right_UDT VALUES(CAST('abcdef' as dbo.babel_4489_right_imageUDT), CAST('abcdef' as dbo.babel_4489_right_varUDT)) +GO + +CREATE VIEW babel_4489_right_dep_view AS + SELECT RIGHT(a, 5) as result from babel_4489_right_t2 +GO + +CREATE PROCEDURE babel_4489_right_dep_proc AS + SELECT RIGHT(a, 5) as result from babel_4489_right_t2 +GO + +CREATE FUNCTION babel_4489_right_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 RIGHT(a, 5) from babel_4489_right_t2) +END +GO + +CREATE VIEW babel_4489_right_dep_view_1 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_t1 +GO + +CREATE VIEW babel_4489_right_dep_view_2 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_t2 +GO + +CREATE VIEW babel_4489_right_dep_view_3 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_t3 +GO + +CREATE VIEW babel_4489_right_dep_view_4 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_t4 +GO + +CREATE VIEW babel_4489_right_dep_view_5 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_t5 +GO + +CREATE VIEW babel_4489_right_dep_view_6 AS + SELECT RIGHT(a, 5) as result FROM babel_4489_right_text +GO + +CREATE VIEW babel_4489_right_dep_view_7 AS + SELECT RIGHT(b, 5) as result FROM babel_4489_right_text +GO + +CREATE FUNCTION babel_4489_right_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT RIGHT(a, 5) as result from babel_4489_right_t2) +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/right-vu-verify.sql b/test/JDBC/input/functions/string_functions/right-vu-verify.sql new file mode 100644 index 00000000000..ae50e1acba0 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/right-vu-verify.sql @@ -0,0 +1,314 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(25) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO + +-- NULL +SELECT RIGHT(NULL, -2) +GO + +SELECT RIGHT(NULL, 0) +GO + +SELECT RIGHT(NULL, 2) +GO + +SELECT RIGHT('abc', NULL) +GO + +SELECT RIGHT(NULL, NULL) +GO + +-- edge case values for second parameter +SELECT RIGHT('AbdefGhi', -2) +GO + +SELECT '|' + RIGHT('AbdefGhi', 0) + '|' +GO + +SELECT RIGHT('AbdefGhi', 2) +GO + +SELECT RIGHT('AbdefGhi', 2147483646) +GO + +SELECT RIGHT('AbdefGhi', 2147483650) +GO + +-- input type char +DECLARE @inputString CHAR(15) = 'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 8) + '|' +GO + +DECLARE @inputString CHAR(15) = '比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) + '|' +GO + +DECLARE @inputString CHAR(15) = '比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString CHAR(15) = 'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 50) + '|' +GO + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 5) +GO + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) +GO + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) COLLATE CHINESE_PRC_CI_AS +GO + +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 50) +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_ci_as +GO + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CI_AS FROM babel_4489_right_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_cs_as +GO + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CS_AS FROM babel_4489_right_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT RIGHT(a, 4) FROM babel_4489_right_chinese_prc_ci_ai +GO + +SELECT RIGHT(a, 4) COLLATE CHINESE_PRC_CI_AI FROM babel_4489_right_chinese_prc_ci_ai +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_ci_as +GO + +SELECT RIGHT(a, 4) COLLATE ARABIC_CI_AS FROM babel_4489_right_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_cs_as +GO + +SELECT RIGHT(a, 4) COLLATE ARABIC_CS_AS FROM babel_4489_right_arabic_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT RIGHT(a, 4) FROM babel_4489_right_arabic_ci_ai +GO + +SELECT RIGHT(a, 4) COLLATE ARABIC_CI_AI FROM babel_4489_right_arabic_ci_ai +GO + +-- input type nchar +DECLARE @inputString NCHAR(15) = N'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 8) + '|' +GO + +DECLARE @inputString NCHAR(15) = N'比尔·拉莫斯' +SELECT '|' + RIGHT(@inputString, 13) + '|' +GO + +DECLARE @inputString NCHAR(15) = N'abc🙂defghi🙂🙂' +SELECT '|' + RIGHT(@inputString, 50) + '|' +GO + +-- with table column of type nchar +SELECT '|' + RIGHT(a, 13) + '|' FROM babel_4489_right_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 5) +GO + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT RIGHT(@inputString, 4) +GO + +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT RIGHT(@inputString, 50) +GO + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT RIGHT(@inputString, 4) +GO + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT RIGHT(@inputString, 4) +GO + +-- dependent objects +SELECT * FROM babel_4489_right_dep_view +GO + +EXEC babel_4489_right_dep_proc +GO + +SELECT * FROM babel_4489_right_dep_func() +GO + +SELECT * FROM babel_4489_right_itvf_func() +GO + +SELECT * FROM babel_4489_right_dep_view_1 +GO + +SELECT * FROM babel_4489_right_dep_view_2 +GO + +SELECT * FROM babel_4489_right_dep_view_3 +GO + +SELECT * FROM babel_4489_right_dep_view_4 +GO + +SELECT * FROM babel_4489_right_dep_view_5 +GO + +SELECT * FROM babel_4489_right_dep_view_6 +GO + +SELECT * FROM babel_4489_right_dep_view_7 +GO + +-- input type UDT +-- -- in table babel_4489_right_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT RIGHT(a, 3) FROM babel_4489_right_UDT +GO + +SELECT RIGHT(b, 3) FROM babel_4489_right_UDT +GO + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString decimal = 123456; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString numeric = 12345.12; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString float = 12345.1; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString real = 12345.1; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString bigint = 12345678; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString int = 12345678; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString smallint = 12356; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString tinyint = 235; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString money = 12356; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString smallmoney = 12356; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString bit = 1; +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT RIGHT(@inputString, 3) +GO + +SELECT RIGHT(a, 5) from babel_4489_right_image; +GO + +-- input datatype text +SELECT RIGHT(a, 5) FROM babel_4489_right_text +GO + +-- input datatype ntext +SELECT RIGHT(b, 5) FROM babel_4489_right_text +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT RIGHT(@inputString, 3) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RIGHT(CAST(@inputString AS VARCHAR(50)), 3) +GO diff --git a/test/JDBC/input/functions/string_functions/rtrim-before-15_8-or-16_4-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/rtrim-before-15_8-or-16_4-vu-cleanup.sql new file mode 100644 index 00000000000..f249ba024ba --- /dev/null +++ b/test/JDBC/input/functions/string_functions/rtrim-before-15_8-or-16_4-vu-cleanup.sql @@ -0,0 +1,80 @@ +DROP FUNCTION babel_4489_rtrim_itvf_func +GO + +DROP FUNCTION babel_4489_rtrim_dep_func +GO + +DROP PROCEDURE babel_4489_rtrim_dep_proc +GO + +DROP VIEW babel_4489_rtrim_dep_view +GO + +DROP VIEW babel_4489_rtrim_dep_view_1 +GO + +DROP VIEW babel_4489_rtrim_dep_view_2 +GO + +DROP VIEW babel_4489_rtrim_dep_view_3 +GO + +DROP VIEW babel_4489_rtrim_dep_view_4 +GO + +DROP VIEW babel_4489_rtrim_dep_view_5 +GO + +DROP VIEW babel_4489_rtrim_dep_view_6 +GO + +DROP VIEW babel_4489_rtrim_dep_view_7 +GO + +DROP TABLE babel_4489_rtrim_UDT +GO + +DROP TYPE dbo.babel_4489_rtrim_varUDT +GO + +DROP TYPE dbo.babel_4489_rtrim_imageUDT +GO + +DROP TABLE babel_4489_rtrim_text +GO + +DROP TABLE babel_4489_rtrim_image +GO + +DROP TABLE babel_4489_rtrim_arabic_ci_ai +GO + +DROP TABLE babel_4489_rtrim_arabic_cs_as +GO + +DROP TABLE babel_4489_rtrim_arabic_ci_as +GO + +DROP TABLE babel_4489_rtrim_chinese_prc_ci_ai +GO + +DROP TABLE babel_4489_rtrim_chinese_prc_cs_as +GO + +DROP TABLE babel_4489_rtrim_chinese_prc_ci_as +GO + +DROP TABLE babel_4489_rtrim_t5 +GO + +DROP TABLE babel_4489_rtrim_t4 +GO + +DROP TABLE babel_4489_rtrim_t3 +GO + +DROP TABLE babel_4489_rtrim_t2 +GO + +DROP TABLE babel_4489_rtrim_t1 +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/rtrim-before-15_8-or-16_4-vu-prepare.sql b/test/JDBC/input/functions/string_functions/rtrim-before-15_8-or-16_4-vu-prepare.sql new file mode 100644 index 00000000000..417234024f6 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/rtrim-before-15_8-or-16_4-vu-prepare.sql @@ -0,0 +1,126 @@ +CREATE TABLE babel_4489_rtrim_t1(a NCHAR(50)) +GO +INSERT INTO babel_4489_rtrim_t1 VALUES(N' abc🙂defghi🙂🙂 ') +INSERT INTO babel_4489_rtrim_t1 VALUES(N' 比尔·拉莫斯 ') +GO + +CREATE TABLE babel_4489_rtrim_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4489_rtrim_t2 VALUES(N' abc🙂defghi🙂🙂 ') +GO + +CREATE TABLE babel_4489_rtrim_t3(a CHAR(50)) +GO +INSERT INTO babel_4489_rtrim_t3 VALUES(' abcdefghi ') +GO + +CREATE TABLE babel_4489_rtrim_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4489_rtrim_t4 VALUES(' abcdefghi ') +GO + +CREATE TABLE babel_4489_rtrim_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4489_rtrim_t5 VALUES(0x2020616263642020) +GO + +CREATE TABLE babel_4489_rtrim_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4489_rtrim_chinese_prc_ci_as VALUES(N' 比尔·拉莫斯 ') +GO + +CREATE TABLE babel_4489_rtrim_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4489_rtrim_chinese_prc_cs_as VALUES(N' 比尔·拉莫斯 ') +GO + +CREATE TABLE babel_4489_rtrim_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4489_rtrim_chinese_prc_ci_ai VALUES(N' 比尔·拉莫斯 ') +GO + +CREATE TABLE babel_4489_rtrim_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4489_rtrim_arabic_ci_as VALUES(N' الله مع المتقين ') +GO + +CREATE TABLE babel_4489_rtrim_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4489_rtrim_arabic_cs_as VALUES(N' الله مع المتقين ') +GO + +CREATE TABLE babel_4489_rtrim_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4489_rtrim_arabic_ci_ai VALUES(N' الله مع المتقين ') +GO + +CREATE TABLE babel_4489_rtrim_image(a IMAGE) +GO +INSERT INTO babel_4489_rtrim_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_4489_rtrim_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4489_rtrim_text VALUES (N' abc🙂defghi🙂🙂 ', N' abc🙂defghi🙂🙂 ') +GO + +CREATE TYPE dbo.babel_4489_rtrim_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4489_rtrim_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4489_rtrim_UDT(a dbo.babel_4489_rtrim_imageUDT, b dbo.babel_4489_rtrim_varUDT) +GO +INSERT INTO babel_4489_rtrim_UDT VALUES(CAST('abcdef' as dbo.babel_4489_rtrim_imageUDT), CAST('abcdef' as dbo.babel_4489_rtrim_varUDT)) +GO + +CREATE VIEW babel_4489_rtrim_dep_view AS + SELECT ('|' + RTRIM(a) + '|') as result from babel_4489_rtrim_t2 +GO + +CREATE PROCEDURE babel_4489_rtrim_dep_proc AS + SELECT ('|' + RTRIM(a) + '|') as result from babel_4489_rtrim_t2 +GO + +CREATE FUNCTION babel_4489_rtrim_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 ('|' + RTRIM(a) + '|') FROM babel_4489_rtrim_t2) +END +GO + +CREATE VIEW babel_4489_rtrim_dep_view_1 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t1 +GO + +CREATE VIEW babel_4489_rtrim_dep_view_2 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t2 +GO + +CREATE VIEW babel_4489_rtrim_dep_view_3 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t3 +GO + +CREATE VIEW babel_4489_rtrim_dep_view_4 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t4 +GO + +CREATE VIEW babel_4489_rtrim_dep_view_5 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t5 +GO + +CREATE VIEW babel_4489_rtrim_dep_view_6 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_text +GO + +CREATE VIEW babel_4489_rtrim_dep_view_7 AS + SELECT ('|' + RTRIM(b) + '|') as result FROM babel_4489_rtrim_text +GO + +CREATE FUNCTION babel_4489_rtrim_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t2) +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/rtrim-before-15_8-or-16_4-vu-verify.sql b/test/JDBC/input/functions/string_functions/rtrim-before-15_8-or-16_4-vu-verify.sql new file mode 100644 index 00000000000..32e6f0925cf --- /dev/null +++ b/test/JDBC/input/functions/string_functions/rtrim-before-15_8-or-16_4-vu-verify.sql @@ -0,0 +1,270 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(50) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO + +-- NULL +SELECT RTRIM(NULL) +GO + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_ci_as +GO + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_rtrim_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_cs_as +GO + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_rtrim_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_ci_ai +GO + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_rtrim_chinese_prc_ci_ai +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_ci_as +GO + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_rtrim_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_cs_as +GO + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_rtrim_arabic_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_ci_ai +GO + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_rtrim_arabic_ci_ai +GO + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO + +-- with table column of type nchar +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO + +-- input type binary +DECLARE @inputString BINARY(10) = 0x202061626364656667682020 +SELECT '|' + RTRIM(@inputString) + '|' +GO + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x202061626364656667682020 +SELECT '|' + RTRIM(@inputString) + '|' +GO + +-- dependent objects +SELECT * FROM babel_4489_rtrim_dep_view +GO + +EXEC babel_4489_rtrim_dep_proc +GO + +SELECT * FROM babel_4489_rtrim_dep_func() +GO + +SELECT * FROM babel_4489_rtrim_itvf_func() +GO + +SELECT * FROM babel_4489_rtrim_dep_view_1 +GO + +SELECT * FROM babel_4489_rtrim_dep_view_2 +GO + +SELECT * FROM babel_4489_rtrim_dep_view_3 +GO + +SELECT * FROM babel_4489_rtrim_dep_view_4 +GO + +SELECT * FROM babel_4489_rtrim_dep_view_5 +GO + +SELECT * FROM babel_4489_rtrim_dep_view_6 +GO + +SELECT * FROM babel_4489_rtrim_dep_view_7 +GO + +-- input type UDT +-- -- in table babel_4489_rtrim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT RTRIM(a) FROM babel_4489_rtrim_UDT +GO + +SELECT RTRIM(b) FROM babel_4489_rtrim_UDT +GO + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT RTRIM(@inputString) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString decimal = 123456; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString numeric = 12345.12; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString float = 12345.1; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString real = 12345.1; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString bigint = 12345678; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString int = 12345678; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString smallint = 12356; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString tinyint = 235; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString money = 12356; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString smallmoney = 12356; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString bit = 1; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT RTRIM(@inputString) +GO + +SELECT RTRIM(a) from babel_4489_rtrim_image; +GO + +-- input datatype text +SELECT RTRIM(a) FROM babel_4489_rtrim_text +GO + +-- input datatype ntext +SELECT RTRIM(b) FROM babel_4489_rtrim_text +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO diff --git a/test/JDBC/input/functions/string_functions/rtrim-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/rtrim-vu-cleanup.sql new file mode 100644 index 00000000000..f249ba024ba --- /dev/null +++ b/test/JDBC/input/functions/string_functions/rtrim-vu-cleanup.sql @@ -0,0 +1,80 @@ +DROP FUNCTION babel_4489_rtrim_itvf_func +GO + +DROP FUNCTION babel_4489_rtrim_dep_func +GO + +DROP PROCEDURE babel_4489_rtrim_dep_proc +GO + +DROP VIEW babel_4489_rtrim_dep_view +GO + +DROP VIEW babel_4489_rtrim_dep_view_1 +GO + +DROP VIEW babel_4489_rtrim_dep_view_2 +GO + +DROP VIEW babel_4489_rtrim_dep_view_3 +GO + +DROP VIEW babel_4489_rtrim_dep_view_4 +GO + +DROP VIEW babel_4489_rtrim_dep_view_5 +GO + +DROP VIEW babel_4489_rtrim_dep_view_6 +GO + +DROP VIEW babel_4489_rtrim_dep_view_7 +GO + +DROP TABLE babel_4489_rtrim_UDT +GO + +DROP TYPE dbo.babel_4489_rtrim_varUDT +GO + +DROP TYPE dbo.babel_4489_rtrim_imageUDT +GO + +DROP TABLE babel_4489_rtrim_text +GO + +DROP TABLE babel_4489_rtrim_image +GO + +DROP TABLE babel_4489_rtrim_arabic_ci_ai +GO + +DROP TABLE babel_4489_rtrim_arabic_cs_as +GO + +DROP TABLE babel_4489_rtrim_arabic_ci_as +GO + +DROP TABLE babel_4489_rtrim_chinese_prc_ci_ai +GO + +DROP TABLE babel_4489_rtrim_chinese_prc_cs_as +GO + +DROP TABLE babel_4489_rtrim_chinese_prc_ci_as +GO + +DROP TABLE babel_4489_rtrim_t5 +GO + +DROP TABLE babel_4489_rtrim_t4 +GO + +DROP TABLE babel_4489_rtrim_t3 +GO + +DROP TABLE babel_4489_rtrim_t2 +GO + +DROP TABLE babel_4489_rtrim_t1 +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/rtrim-vu-prepare.sql b/test/JDBC/input/functions/string_functions/rtrim-vu-prepare.sql new file mode 100644 index 00000000000..417234024f6 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/rtrim-vu-prepare.sql @@ -0,0 +1,126 @@ +CREATE TABLE babel_4489_rtrim_t1(a NCHAR(50)) +GO +INSERT INTO babel_4489_rtrim_t1 VALUES(N' abc🙂defghi🙂🙂 ') +INSERT INTO babel_4489_rtrim_t1 VALUES(N' 比尔·拉莫斯 ') +GO + +CREATE TABLE babel_4489_rtrim_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4489_rtrim_t2 VALUES(N' abc🙂defghi🙂🙂 ') +GO + +CREATE TABLE babel_4489_rtrim_t3(a CHAR(50)) +GO +INSERT INTO babel_4489_rtrim_t3 VALUES(' abcdefghi ') +GO + +CREATE TABLE babel_4489_rtrim_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4489_rtrim_t4 VALUES(' abcdefghi ') +GO + +CREATE TABLE babel_4489_rtrim_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4489_rtrim_t5 VALUES(0x2020616263642020) +GO + +CREATE TABLE babel_4489_rtrim_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4489_rtrim_chinese_prc_ci_as VALUES(N' 比尔·拉莫斯 ') +GO + +CREATE TABLE babel_4489_rtrim_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4489_rtrim_chinese_prc_cs_as VALUES(N' 比尔·拉莫斯 ') +GO + +CREATE TABLE babel_4489_rtrim_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4489_rtrim_chinese_prc_ci_ai VALUES(N' 比尔·拉莫斯 ') +GO + +CREATE TABLE babel_4489_rtrim_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4489_rtrim_arabic_ci_as VALUES(N' الله مع المتقين ') +GO + +CREATE TABLE babel_4489_rtrim_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4489_rtrim_arabic_cs_as VALUES(N' الله مع المتقين ') +GO + +CREATE TABLE babel_4489_rtrim_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4489_rtrim_arabic_ci_ai VALUES(N' الله مع المتقين ') +GO + +CREATE TABLE babel_4489_rtrim_image(a IMAGE) +GO +INSERT INTO babel_4489_rtrim_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_4489_rtrim_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4489_rtrim_text VALUES (N' abc🙂defghi🙂🙂 ', N' abc🙂defghi🙂🙂 ') +GO + +CREATE TYPE dbo.babel_4489_rtrim_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4489_rtrim_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4489_rtrim_UDT(a dbo.babel_4489_rtrim_imageUDT, b dbo.babel_4489_rtrim_varUDT) +GO +INSERT INTO babel_4489_rtrim_UDT VALUES(CAST('abcdef' as dbo.babel_4489_rtrim_imageUDT), CAST('abcdef' as dbo.babel_4489_rtrim_varUDT)) +GO + +CREATE VIEW babel_4489_rtrim_dep_view AS + SELECT ('|' + RTRIM(a) + '|') as result from babel_4489_rtrim_t2 +GO + +CREATE PROCEDURE babel_4489_rtrim_dep_proc AS + SELECT ('|' + RTRIM(a) + '|') as result from babel_4489_rtrim_t2 +GO + +CREATE FUNCTION babel_4489_rtrim_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 ('|' + RTRIM(a) + '|') FROM babel_4489_rtrim_t2) +END +GO + +CREATE VIEW babel_4489_rtrim_dep_view_1 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t1 +GO + +CREATE VIEW babel_4489_rtrim_dep_view_2 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t2 +GO + +CREATE VIEW babel_4489_rtrim_dep_view_3 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t3 +GO + +CREATE VIEW babel_4489_rtrim_dep_view_4 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t4 +GO + +CREATE VIEW babel_4489_rtrim_dep_view_5 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t5 +GO + +CREATE VIEW babel_4489_rtrim_dep_view_6 AS + SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_text +GO + +CREATE VIEW babel_4489_rtrim_dep_view_7 AS + SELECT ('|' + RTRIM(b) + '|') as result FROM babel_4489_rtrim_text +GO + +CREATE FUNCTION babel_4489_rtrim_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT ('|' + RTRIM(a) + '|') as result FROM babel_4489_rtrim_t2) +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/rtrim-vu-verify.sql b/test/JDBC/input/functions/string_functions/rtrim-vu-verify.sql new file mode 100644 index 00000000000..32e6f0925cf --- /dev/null +++ b/test/JDBC/input/functions/string_functions/rtrim-vu-verify.sql @@ -0,0 +1,270 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(50) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO + +-- NULL +SELECT RTRIM(NULL) +GO + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_ci_as +GO + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_rtrim_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_cs_as +GO + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_rtrim_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_chinese_prc_ci_ai +GO + +SELECT '|' + RTRIM(a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_rtrim_chinese_prc_ci_ai +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_ci_as +GO + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_rtrim_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_cs_as +GO + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_rtrim_arabic_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_arabic_ci_ai +GO + +SELECT '|' + RTRIM(a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_rtrim_arabic_ci_ai +GO + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO + +-- with table column of type nchar +SELECT '|' + RTRIM(a) + '|' FROM babel_4489_rtrim_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + RTRIM(@inputString) + '|' +GO + +-- input type binary +DECLARE @inputString BINARY(10) = 0x202061626364656667682020 +SELECT '|' + RTRIM(@inputString) + '|' +GO + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x202061626364656667682020 +SELECT '|' + RTRIM(@inputString) + '|' +GO + +-- dependent objects +SELECT * FROM babel_4489_rtrim_dep_view +GO + +EXEC babel_4489_rtrim_dep_proc +GO + +SELECT * FROM babel_4489_rtrim_dep_func() +GO + +SELECT * FROM babel_4489_rtrim_itvf_func() +GO + +SELECT * FROM babel_4489_rtrim_dep_view_1 +GO + +SELECT * FROM babel_4489_rtrim_dep_view_2 +GO + +SELECT * FROM babel_4489_rtrim_dep_view_3 +GO + +SELECT * FROM babel_4489_rtrim_dep_view_4 +GO + +SELECT * FROM babel_4489_rtrim_dep_view_5 +GO + +SELECT * FROM babel_4489_rtrim_dep_view_6 +GO + +SELECT * FROM babel_4489_rtrim_dep_view_7 +GO + +-- input type UDT +-- -- in table babel_4489_rtrim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT RTRIM(a) FROM babel_4489_rtrim_UDT +GO + +SELECT RTRIM(b) FROM babel_4489_rtrim_UDT +GO + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT RTRIM(@inputString) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString decimal = 123456; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString numeric = 12345.12; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString float = 12345.1; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString real = 12345.1; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString bigint = 12345678; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString int = 12345678; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString smallint = 12356; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString tinyint = 235; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString money = 12356; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString smallmoney = 12356; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString bit = 1; +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT RTRIM(@inputString) +GO + +SELECT RTRIM(a) from babel_4489_rtrim_image; +GO + +-- input datatype text +SELECT RTRIM(a) FROM babel_4489_rtrim_text +GO + +-- input datatype ntext +SELECT RTRIM(b) FROM babel_4489_rtrim_text +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT RTRIM(@inputString) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT RTRIM(CAST(@inputString AS VARCHAR(50))) +GO diff --git a/test/JDBC/input/functions/string_functions/stuff-before-15_8-or-16_4-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/stuff-before-15_8-or-16_4-vu-cleanup.sql new file mode 100644 index 00000000000..7a86f289238 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/stuff-before-15_8-or-16_4-vu-cleanup.sql @@ -0,0 +1,74 @@ +DROP FUNCTION babel_4838_stuff_itvf_func +GO + +DROP FUNCTION babel_4838_stuff_dep_func +GO + +DROP PROCEDURE babel_4838_stuff_dep_proc +GO + +DROP VIEW babel_4838_stuff_dep_view +GO + +DROP TABLE babel_4838_stuff_UDT +GO + +DROP VIEW babel_4838_stuff_dep_view_1 +GO + +DROP VIEW babel_4838_stuff_dep_view_2 +GO + +DROP VIEW babel_4838_stuff_dep_view_3 +GO + +DROP VIEW babel_4838_stuff_dep_view_4 +GO + +DROP VIEW babel_4838_stuff_dep_view_5 +GO + +DROP TYPE dbo.babel_4838_stuff_varUDT +GO + +DROP TYPE dbo.babel_4838_stuff_imageUDT +GO + +DROP TABLE babel_4838_stuff_text +GO + +DROP TABLE babel_4838_stuff_image +GO + +DROP TABLE babel_4838_stuff_arabic_ci_ai +GO + +DROP TABLE babel_4838_stuff_arabic_cs_as +GO + +DROP TABLE babel_4838_stuff_arabic_ci_as +GO + +DROP TABLE babel_4838_stuff_chinese_prc_ci_ai +GO + +DROP TABLE babel_4838_stuff_chinese_prc_cs_as +GO + +DROP TABLE babel_4838_stuff_chinese_prc_ci_as +GO + +DROP TABLE babel_4838_stuff_t5 +GO + +DROP TABLE babel_4838_stuff_t4 +GO + +DROP TABLE babel_4838_stuff_t3 +GO + +DROP TABLE babel_4838_stuff_t2 +GO + +DROP TABLE babel_4838_stuff_t1 +GO diff --git a/test/JDBC/input/functions/string_functions/stuff-before-15_8-or-16_4-vu-prepare.sql b/test/JDBC/input/functions/string_functions/stuff-before-15_8-or-16_4-vu-prepare.sql new file mode 100644 index 00000000000..7ca66b87ac2 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/stuff-before-15_8-or-16_4-vu-prepare.sql @@ -0,0 +1,118 @@ +CREATE TABLE babel_4838_stuff_t1(a NCHAR(50)) +GO +INSERT INTO babel_4838_stuff_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_4838_stuff_t1 VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4838_stuff_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4838_stuff_t2 VALUES(N'abc🙂defghi🙂🙂') +GO + +CREATE TABLE babel_4838_stuff_t3(a CHAR(50)) +GO +INSERT INTO babel_4838_stuff_t3 VALUES('abcdefghi') +GO + +CREATE TABLE babel_4838_stuff_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4838_stuff_t4 VALUES('abcdefghi') +GO + +CREATE TABLE babel_4838_stuff_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4838_stuff_t5 VALUES(0x2020616263642020) +GO + +CREATE TABLE babel_4838_stuff_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4838_stuff_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4838_stuff_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4838_stuff_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4838_stuff_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4838_stuff_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4838_stuff_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4838_stuff_arabic_ci_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4838_stuff_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4838_stuff_arabic_cs_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4838_stuff_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4838_stuff_arabic_ci_ai VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4838_stuff_image(a IMAGE) +GO +INSERT INTO babel_4838_stuff_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_4838_stuff_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4838_stuff_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO + +CREATE TYPE dbo.babel_4838_stuff_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4838_stuff_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4838_stuff_UDT(a dbo.babel_4838_stuff_imageUDT, b dbo.babel_4838_stuff_varUDT) +GO +INSERT INTO babel_4838_stuff_UDT VALUES(CAST('abcdef' as dbo.babel_4838_stuff_imageUDT), CAST('abcdef' as dbo.babel_4838_stuff_varUDT)) +GO + +CREATE VIEW babel_4838_stuff_dep_view AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result from babel_4838_stuff_t2 +GO + +CREATE PROCEDURE babel_4838_stuff_dep_proc AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result from babel_4838_stuff_t2 +GO + +CREATE FUNCTION babel_4838_stuff_dep_func() +RETURNS NVARCHAR(200) +AS +BEGIN +RETURN (SELECT TOP 1 stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') from babel_4838_stuff_t2) +END +GO + +CREATE VIEW babel_4838_stuff_dep_view_1 AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result FROM babel_4838_stuff_t1 +GO + +CREATE VIEW babel_4838_stuff_dep_view_2 AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result FROM babel_4838_stuff_t2 +GO + +CREATE VIEW babel_4838_stuff_dep_view_3 AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result FROM babel_4838_stuff_t3 +GO + +CREATE VIEW babel_4838_stuff_dep_view_4 AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result FROM babel_4838_stuff_t4 +GO + +CREATE VIEW babel_4838_stuff_dep_view_5 AS + SELECT stuff(a, 4, 2, 0x6566) as result FROM babel_4838_stuff_t5 +GO + +CREATE FUNCTION babel_4838_stuff_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result from babel_4838_stuff_t2) +GO diff --git a/test/JDBC/input/functions/string_functions/stuff-before-15_8-or-16_4-vu-verify.sql b/test/JDBC/input/functions/string_functions/stuff-before-15_8-or-16_4-vu-verify.sql new file mode 100644 index 00000000000..892b6aadd5d --- /dev/null +++ b/test/JDBC/input/functions/string_functions/stuff-before-15_8-or-16_4-vu-verify.sql @@ -0,0 +1,1119 @@ +-- NULL +SELECT stuff(NULL, 2, 1, 'ab') +GO +SELECT stuff('ab', 2, 1, NULL) +GO +SELECT stuff('ab', NULL, 1, 'bc') +GO +SELECT stuff('ab', 2, NULL, 'bc') +GO +SELECT stuff('ab', NULL, '1', 'bc') +GO +SELECT stuff('ab', '2', NULL, 'bc') +GO +SELECT stuff('ab', NULL, NULL, 'bc') +GO + +-- Different no. of arguments +SELECT stuff('abc', 1, 2) +GO + +SELECT stuff('abc', 1, 1, 'xy', 1) +GO + +-- edge case values for second parameter +SELECT stuff('AbdefGhi', 0, 1, 'xy') +GO + +SELECT '|' + stuff('AbdefGhi', -1, 1, 'xy') + '|' +GO + +SELECT stuff('AbdefGhi', 1, 1, 'xy') +GO + +SELECT stuff('AbdefGhi', 8, 1, 'xy') +GO + +SELECT stuff('AbdefGhi', 9, 1, 'xy') +GO + +SELECT stuff('AbdefGhi', 2147483648, 1, 'xy') +GO + +-- edge case values for third parameter +SELECT stuff('AbdefGhi', 1, 0, 'xy') +GO + +SELECT stuff('AbdefGhi', 8, 0, 'xy') +GO + +SELECT stuff('AbdefGhi', 1, -1, 'xy') +GO + +SELECT stuff('AbdefGhi', 8, -1, 'xy') +GO + +SELECT stuff('AbdefGhi', 2, 9, 'xy') +GO + +SELECT stuff('AbdefGhi', 2, 2147483648, 'xy') +GO + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +SELECT stuff('abc🙂defghi🙂🙂', 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +SELECT stuff('比尔·拉莫斯', 4, 2, '拉·比') +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +SELECT stuff('比尔·拉莫斯', 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_ci_as +GO +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_ci_as +GO + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CI_AS FROM babel_4838_stuff_chinese_prc_ci_as +GO +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS FROM babel_4838_stuff_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_cs_as +GO +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_cs_as +GO + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CS_AS FROM babel_4838_stuff_chinese_prc_cs_as +GO +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CS_AS FROM babel_4838_stuff_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_ci_ai +GO +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_ci_ai +GO + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CI_AI FROM babel_4838_stuff_chinese_prc_ci_ai +GO +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AI FROM babel_4838_stuff_chinese_prc_ci_ai +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_ci_as +GO +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_ci_as +GO + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CI_AS FROM babel_4838_stuff_arabic_ci_as +GO +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CI_AS FROM babel_4838_stuff_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_cs_as +GO +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_cs_as +GO + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CS_AS FROM babel_4838_stuff_arabic_cs_as +GO +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CS_AS FROM babel_4838_stuff_arabic_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_ci_ai +GO +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_ci_ai +GO + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CI_AI FROM babel_4838_stuff_arabic_ci_ai +GO +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CI_AI FROM babel_4838_stuff_arabic_ci_ai +GO + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO + +-- with table column of type nchar +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, 0x6566) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 0, 1, 0x6566) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 13, 1, 0x6566) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, -1, 0x6566) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, 15, 0x6566) +GO + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, 0x6566) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 0, 1, 0x6566) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 13, 1, 0x6566) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, -1, 0x6566) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, 15, 0x6566) +GO + +-- dependent objects +SELECT * FROM babel_4838_stuff_dep_view +GO + +EXEC babel_4838_stuff_dep_proc +GO + +SELECT * FROM babel_4838_stuff_dep_func() +GO + +SELECT * FROM babel_4838_stuff_itvf_func() +GO + +SELECT * FROM babel_4838_stuff_dep_view_1 +GO + +SELECT * FROM babel_4838_stuff_dep_view_2 +GO + +SELECT * FROM babel_4838_stuff_dep_view_3 +GO + +SELECT * FROM babel_4838_stuff_dep_view_4 +GO + +SELECT * FROM babel_4838_stuff_dep_view_5 +GO + +-- input type UDT +-- in table babel_4838_stuff_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_UDT +GO + +SELECT stuff(b, 4, 2, b) FROM babel_4838_stuff_UDT +GO + +-- other different datatypes, should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString decimal = 123456; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString decimal = 123456; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString decimal = 123456; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString decimal = 123456; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString numeric = 12345.12; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString numeric = 12345.12; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString numeric = 12345.12; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString numeric = 12345.12; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString float = 12345.1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString float = 12345.1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString float = 12345.1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString float = 12345.1; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString real = 12345.1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString real = 12345.1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString real = 12345.1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString real = 12345.1; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString bigint = 12345678; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString bigint = 12345678; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString bigint = 12345678; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString bigint = 12345678; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString int = 12345678; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString int = 12345678; +SELECT stuff('abcd', 4, 1, @inputString) +GO +DECLARE @inputString int = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString int = 12345678; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString CHAR(25) = 'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString CHAR(25) = 'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString VARCHAR(25) = 'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString VARCHAR(25) = 'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO + +DECLARE @inputString smallint = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString smallint = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO +DECLARE @inputString smallint = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString smallint = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString NCHAR(25) = N'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString NCHAR(25) = N'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString NVARCHAR(25) = N'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString NVARCHAR(25) = N'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO + +DECLARE @inputString tinyint = 235; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString tinyint = 235; +SELECT stuff('abcd', 4, 1, @inputString) +GO +DECLARE @inputString tinyint = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString tinyint = 235; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO + +DECLARE @inputString money = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString money = 12356; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString money = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString money = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString smallmoney = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString smallmoney = 12356; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString smallmoney = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString smallmoney = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString bit = 1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString bit = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString bit = 1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString bit = 1; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('abcd', 4, 1, @inputString) +GO + +SELECT stuff(a, 4, 2, 'abcd') from babel_4838_stuff_image; +GO +SELECT stuff('abcd', a, 2, 'abcd') from babel_4838_stuff_image; +GO +SELECT stuff('abcd', 4, a, 'abcd') from babel_4838_stuff_image; +GO +SELECT stuff('abcd', 4, 2, a) from babel_4838_stuff_image; +GO + +-- input datatype text +SELECT stuff(a, 4, 2, 'abcd') FROM babel_4838_stuff_text +GO +SELECT stuff('abcd', a, 2, 'abcd') FROM babel_4838_stuff_text +GO +SELECT stuff('abcd', 4, a, 'abcd') FROM babel_4838_stuff_text +GO +SELECT stuff('abcd', 4, 2, a) FROM babel_4838_stuff_text +GO + +-- input datatype ntext +SELECT stuff(b, 4, 2, 'abcd') FROM babel_4838_stuff_text +GO +SELECT stuff('abcd', b, 2, 'abcd') FROM babel_4838_stuff_text +GO +SELECT stuff('abcd', 4, b, 'abcd') FROM babel_4838_stuff_text +GO +SELECT stuff('abcd', 4, 2, b) FROM babel_4838_stuff_text +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO diff --git a/test/JDBC/input/functions/string_functions/stuff-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/stuff-vu-cleanup.sql new file mode 100644 index 00000000000..7a86f289238 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/stuff-vu-cleanup.sql @@ -0,0 +1,74 @@ +DROP FUNCTION babel_4838_stuff_itvf_func +GO + +DROP FUNCTION babel_4838_stuff_dep_func +GO + +DROP PROCEDURE babel_4838_stuff_dep_proc +GO + +DROP VIEW babel_4838_stuff_dep_view +GO + +DROP TABLE babel_4838_stuff_UDT +GO + +DROP VIEW babel_4838_stuff_dep_view_1 +GO + +DROP VIEW babel_4838_stuff_dep_view_2 +GO + +DROP VIEW babel_4838_stuff_dep_view_3 +GO + +DROP VIEW babel_4838_stuff_dep_view_4 +GO + +DROP VIEW babel_4838_stuff_dep_view_5 +GO + +DROP TYPE dbo.babel_4838_stuff_varUDT +GO + +DROP TYPE dbo.babel_4838_stuff_imageUDT +GO + +DROP TABLE babel_4838_stuff_text +GO + +DROP TABLE babel_4838_stuff_image +GO + +DROP TABLE babel_4838_stuff_arabic_ci_ai +GO + +DROP TABLE babel_4838_stuff_arabic_cs_as +GO + +DROP TABLE babel_4838_stuff_arabic_ci_as +GO + +DROP TABLE babel_4838_stuff_chinese_prc_ci_ai +GO + +DROP TABLE babel_4838_stuff_chinese_prc_cs_as +GO + +DROP TABLE babel_4838_stuff_chinese_prc_ci_as +GO + +DROP TABLE babel_4838_stuff_t5 +GO + +DROP TABLE babel_4838_stuff_t4 +GO + +DROP TABLE babel_4838_stuff_t3 +GO + +DROP TABLE babel_4838_stuff_t2 +GO + +DROP TABLE babel_4838_stuff_t1 +GO diff --git a/test/JDBC/input/functions/string_functions/stuff-vu-prepare.sql b/test/JDBC/input/functions/string_functions/stuff-vu-prepare.sql new file mode 100644 index 00000000000..7ca66b87ac2 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/stuff-vu-prepare.sql @@ -0,0 +1,118 @@ +CREATE TABLE babel_4838_stuff_t1(a NCHAR(50)) +GO +INSERT INTO babel_4838_stuff_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_4838_stuff_t1 VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4838_stuff_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_4838_stuff_t2 VALUES(N'abc🙂defghi🙂🙂') +GO + +CREATE TABLE babel_4838_stuff_t3(a CHAR(50)) +GO +INSERT INTO babel_4838_stuff_t3 VALUES('abcdefghi') +GO + +CREATE TABLE babel_4838_stuff_t4(a VARCHAR(50)) +GO +INSERT INTO babel_4838_stuff_t4 VALUES('abcdefghi') +GO + +CREATE TABLE babel_4838_stuff_t5(a VARBINARY(50)) +GO +INSERT INTO babel_4838_stuff_t5 VALUES(0x2020616263642020) +GO + +CREATE TABLE babel_4838_stuff_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4838_stuff_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4838_stuff_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4838_stuff_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4838_stuff_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4838_stuff_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_4838_stuff_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4838_stuff_arabic_ci_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4838_stuff_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4838_stuff_arabic_cs_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4838_stuff_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4838_stuff_arabic_ci_ai VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_4838_stuff_image(a IMAGE) +GO +INSERT INTO babel_4838_stuff_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_4838_stuff_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4838_stuff_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO + +CREATE TYPE dbo.babel_4838_stuff_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4838_stuff_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4838_stuff_UDT(a dbo.babel_4838_stuff_imageUDT, b dbo.babel_4838_stuff_varUDT) +GO +INSERT INTO babel_4838_stuff_UDT VALUES(CAST('abcdef' as dbo.babel_4838_stuff_imageUDT), CAST('abcdef' as dbo.babel_4838_stuff_varUDT)) +GO + +CREATE VIEW babel_4838_stuff_dep_view AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result from babel_4838_stuff_t2 +GO + +CREATE PROCEDURE babel_4838_stuff_dep_proc AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result from babel_4838_stuff_t2 +GO + +CREATE FUNCTION babel_4838_stuff_dep_func() +RETURNS NVARCHAR(200) +AS +BEGIN +RETURN (SELECT TOP 1 stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') from babel_4838_stuff_t2) +END +GO + +CREATE VIEW babel_4838_stuff_dep_view_1 AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result FROM babel_4838_stuff_t1 +GO + +CREATE VIEW babel_4838_stuff_dep_view_2 AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result FROM babel_4838_stuff_t2 +GO + +CREATE VIEW babel_4838_stuff_dep_view_3 AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result FROM babel_4838_stuff_t3 +GO + +CREATE VIEW babel_4838_stuff_dep_view_4 AS + SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result FROM babel_4838_stuff_t4 +GO + +CREATE VIEW babel_4838_stuff_dep_view_5 AS + SELECT stuff(a, 4, 2, 0x6566) as result FROM babel_4838_stuff_t5 +GO + +CREATE FUNCTION babel_4838_stuff_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT stuff(a, 4, 2, 'xyz🙂🙂wuytgdy🙂') as result from babel_4838_stuff_t2) +GO diff --git a/test/JDBC/input/functions/string_functions/stuff-vu-verify.sql b/test/JDBC/input/functions/string_functions/stuff-vu-verify.sql new file mode 100644 index 00000000000..892b6aadd5d --- /dev/null +++ b/test/JDBC/input/functions/string_functions/stuff-vu-verify.sql @@ -0,0 +1,1119 @@ +-- NULL +SELECT stuff(NULL, 2, 1, 'ab') +GO +SELECT stuff('ab', 2, 1, NULL) +GO +SELECT stuff('ab', NULL, 1, 'bc') +GO +SELECT stuff('ab', 2, NULL, 'bc') +GO +SELECT stuff('ab', NULL, '1', 'bc') +GO +SELECT stuff('ab', '2', NULL, 'bc') +GO +SELECT stuff('ab', NULL, NULL, 'bc') +GO + +-- Different no. of arguments +SELECT stuff('abc', 1, 2) +GO + +SELECT stuff('abc', 1, 1, 'xy', 1) +GO + +-- edge case values for second parameter +SELECT stuff('AbdefGhi', 0, 1, 'xy') +GO + +SELECT '|' + stuff('AbdefGhi', -1, 1, 'xy') + '|' +GO + +SELECT stuff('AbdefGhi', 1, 1, 'xy') +GO + +SELECT stuff('AbdefGhi', 8, 1, 'xy') +GO + +SELECT stuff('AbdefGhi', 9, 1, 'xy') +GO + +SELECT stuff('AbdefGhi', 2147483648, 1, 'xy') +GO + +-- edge case values for third parameter +SELECT stuff('AbdefGhi', 1, 0, 'xy') +GO + +SELECT stuff('AbdefGhi', 8, 0, 'xy') +GO + +SELECT stuff('AbdefGhi', 1, -1, 'xy') +GO + +SELECT stuff('AbdefGhi', 8, -1, 'xy') +GO + +SELECT stuff('AbdefGhi', 2, 9, 'xy') +GO + +SELECT stuff('AbdefGhi', 2, 2147483648, 'xy') +GO + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +SELECT stuff('abc🙂defghi🙂🙂', 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +SELECT stuff('比尔·拉莫斯', 4, 2, '拉·比') +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +SELECT stuff('比尔·拉莫斯', 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_ci_as +GO +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_ci_as +GO + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CI_AS FROM babel_4838_stuff_chinese_prc_ci_as +GO +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS FROM babel_4838_stuff_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_cs_as +GO +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_cs_as +GO + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CS_AS FROM babel_4838_stuff_chinese_prc_cs_as +GO +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CS_AS FROM babel_4838_stuff_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_chinese_prc_ci_ai +GO +SELECT stuff(a, 4, 2, '拉·比') FROM babel_4838_stuff_chinese_prc_ci_ai +GO + +SELECT stuff(a, 4, 2, a) COLLATE CHINESE_PRC_CI_AI FROM babel_4838_stuff_chinese_prc_ci_ai +GO +SELECT stuff(a, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AI FROM babel_4838_stuff_chinese_prc_ci_ai +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_ci_as +GO +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_ci_as +GO + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CI_AS FROM babel_4838_stuff_arabic_ci_as +GO +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CI_AS FROM babel_4838_stuff_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_cs_as +GO +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_cs_as +GO + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CS_AS FROM babel_4838_stuff_arabic_cs_as +GO +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CS_AS FROM babel_4838_stuff_arabic_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_arabic_ci_ai +GO +SELECT stuff(a, 4, 2, 'معقيال') FROM babel_4838_stuff_arabic_ci_ai +GO + +SELECT stuff(a, 4, 2, a) COLLATE ARABIC_CI_AI FROM babel_4838_stuff_arabic_ci_ai +GO +SELECT stuff(a, 4, 2, 'معقيال') COLLATE ARABIC_CI_AI FROM babel_4838_stuff_arabic_ci_ai +GO + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO + +-- with table column of type nchar +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 4, 2, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 0, 1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 26, 1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, -1, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT stuff(@inputString, 2, 25, 'xyz🙂🙂wuytgdy🙂') +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString CHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString NVARCHAR(25) = N'拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARCHAR(25) = '拉·比' +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 0, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 26, 1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, -1, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT stuff(@inputString, 2, 25, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, 0x6566) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 0, 1, 0x6566) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 13, 1, 0x6566) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, -1, 0x6566) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, 15, 0x6566) +GO + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString CHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString NCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString NVARCHAR(25) = N'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARCHAR(25) = 'xyz🙂🙂wuytgdy🙂' +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString BINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +DECLARE @replaceString VARBINARY(10) = 0x6566 +SELECT stuff(@inputString, 4, 2, @replaceString) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, 0x6566) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 4, 2, '拉·比') COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 0, 1, 0x6566) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 13, 1, 0x6566) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, -1, 0x6566) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT stuff(@inputString, 2, 15, 0x6566) +GO + +-- dependent objects +SELECT * FROM babel_4838_stuff_dep_view +GO + +EXEC babel_4838_stuff_dep_proc +GO + +SELECT * FROM babel_4838_stuff_dep_func() +GO + +SELECT * FROM babel_4838_stuff_itvf_func() +GO + +SELECT * FROM babel_4838_stuff_dep_view_1 +GO + +SELECT * FROM babel_4838_stuff_dep_view_2 +GO + +SELECT * FROM babel_4838_stuff_dep_view_3 +GO + +SELECT * FROM babel_4838_stuff_dep_view_4 +GO + +SELECT * FROM babel_4838_stuff_dep_view_5 +GO + +-- input type UDT +-- in table babel_4838_stuff_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT stuff(a, 4, 2, a) FROM babel_4838_stuff_UDT +GO + +SELECT stuff(b, 4, 2, b) FROM babel_4838_stuff_UDT +GO + +-- other different datatypes, should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString date = '2016-12-21'; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString decimal = 123456; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString decimal = 123456; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString decimal = 123456; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString decimal = 123456; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString numeric = 12345.12; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString numeric = 12345.12; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString numeric = 12345.12; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString numeric = 12345.12; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString float = 12345.1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString float = 12345.1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString float = 12345.1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString float = 12345.1; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString real = 12345.1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString real = 12345.1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString real = 12345.1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString real = 12345.1; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString bigint = 12345678; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString bigint = 12345678; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString bigint = 12345678; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString bigint = 12345678; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString int = 12345678; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString int = 12345678; +SELECT stuff('abcd', 4, 1, @inputString) +GO +DECLARE @inputString int = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString int = 12345678; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString CHAR(25) = 'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString CHAR(25) = 'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString VARCHAR(25) = 'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString VARCHAR(25) = 'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO + +DECLARE @inputString smallint = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString smallint = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO +DECLARE @inputString smallint = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString smallint = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString NCHAR(25) = N'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString NCHAR(25) = N'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString NVARCHAR(25) = N'xyzd'; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString NVARCHAR(25) = N'xyzd'; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO + +DECLARE @inputString tinyint = 235; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString tinyint = 235; +SELECT stuff('abcd', 4, 1, @inputString) +GO +DECLARE @inputString tinyint = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString tinyint = 235; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO + +DECLARE @inputString money = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString money = 12356; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString money = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString money = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString smallmoney = 12356; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString smallmoney = 12356; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString smallmoney = 12356; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString smallmoney = 12356; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString bit = 1; +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString bit = 1; +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString bit = 1; +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString bit = 1; +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT stuff('abcd', 4, 1, @inputString) +GO + +SELECT stuff(a, 4, 2, 'abcd') from babel_4838_stuff_image; +GO +SELECT stuff('abcd', a, 2, 'abcd') from babel_4838_stuff_image; +GO +SELECT stuff('abcd', 4, a, 'abcd') from babel_4838_stuff_image; +GO +SELECT stuff('abcd', 4, 2, a) from babel_4838_stuff_image; +GO + +-- input datatype text +SELECT stuff(a, 4, 2, 'abcd') FROM babel_4838_stuff_text +GO +SELECT stuff('abcd', a, 2, 'abcd') FROM babel_4838_stuff_text +GO +SELECT stuff('abcd', 4, a, 'abcd') FROM babel_4838_stuff_text +GO +SELECT stuff('abcd', 4, 2, a) FROM babel_4838_stuff_text +GO + +-- input datatype ntext +SELECT stuff(b, 4, 2, 'abcd') FROM babel_4838_stuff_text +GO +SELECT stuff('abcd', b, 2, 'abcd') FROM babel_4838_stuff_text +GO +SELECT stuff('abcd', 4, b, 'abcd') FROM babel_4838_stuff_text +GO +SELECT stuff('abcd', 4, 2, b) FROM babel_4838_stuff_text +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff(@inputString, 4, 1, 'abcd') +GO +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('xysd', @inputString, 1, 'abcd') +GO +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('xysd', 1, @inputString, 'abcd') +GO +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT stuff('abcd', 4, 1, @inputString) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +DECLARE @inputString xml = CAST ('' AS xml) +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff(CAST(@inputString AS VARCHAR(50)), 4, 1, 'abcd') +GO +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT stuff('abcd', 4, 1, CAST(@inputString AS VARCHAR(50))) +GO diff --git a/test/JDBC/input/functions/string_functions/substring-before-15_8-or-16_4-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/substring-before-15_8-or-16_4-vu-cleanup.sql new file mode 100644 index 00000000000..86cd915f860 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/substring-before-15_8-or-16_4-vu-cleanup.sql @@ -0,0 +1,86 @@ +DROP FUNCTION babel_3658_substring_itvf_func +GO + +DROP FUNCTION babel_3658_substring_dep_func +GO + +DROP PROCEDURE babel_3658_substring_dep_proc +GO + +DROP VIEW babel_3658_substring_dep_view +GO + +DROP TABLE babel_3658_substring_UDT +GO + +DROP VIEW babel_3658_substring_dep_view_1 +GO + +DROP VIEW babel_3658_substring_dep_view_2 +GO + +DROP VIEW babel_3658_substring_dep_view_3 +GO + +DROP VIEW babel_3658_substring_dep_view_4 +GO + +DROP VIEW babel_3658_substring_dep_view_5 +GO + +DROP VIEW babel_3658_substring_dep_view_6 +GO + +DROP VIEW babel_3658_substring_dep_view_7 +GO + +DROP VIEW babel_3658_substring_dep_view_8 +GO + +DROP TYPE dbo.babel_3658_substring_varUDT +GO + +DROP TYPE dbo.babel_3658_substring_imageUDT +GO + +DROP TABLE babel_3658_substring_text +GO + +DROP TABLE babel_3658_substring_image +GO + +DROP TABLE babel_3658_substring_arabic_ci_ai +GO + +DROP TABLE babel_3658_substring_arabic_cs_as +GO + +DROP TABLE babel_3658_substring_arabic_ci_as +GO + +DROP TABLE babel_3658_substring_chinese_prc_ci_ai +GO + +DROP TABLE babel_3658_substring_chinese_prc_cs_as +GO + +DROP TABLE babel_3658_substring_chinese_prc_ci_as +GO + +DROP TABLE babel_3658_substring_t6 +GO + +DROP TABLE babel_3658_substring_t5 +GO + +DROP TABLE babel_3658_substring_t4 +GO + +DROP TABLE babel_3658_substring_t3 +GO + +DROP TABLE babel_3658_substring_t2 +GO + +DROP TABLE babel_3658_substring_t1 +GO diff --git a/test/JDBC/input/functions/string_functions/substring-before-15_8-or-16_4-vu-prepare.sql b/test/JDBC/input/functions/string_functions/substring-before-15_8-or-16_4-vu-prepare.sql new file mode 100644 index 00000000000..325e7fc57f1 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/substring-before-15_8-or-16_4-vu-prepare.sql @@ -0,0 +1,135 @@ +CREATE TABLE babel_3658_substring_t1(a NCHAR(50)) +GO +INSERT INTO babel_3658_substring_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_3658_substring_t1 VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_3658_substring_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_3658_substring_t2 VALUES(N'abc🙂defghi🙂🙂') +GO + +CREATE TABLE babel_3658_substring_t3(a CHAR(50)) +GO +INSERT INTO babel_3658_substring_t3 VALUES('abcdefghi') +GO + +CREATE TABLE babel_3658_substring_t4(a VARCHAR(50)) +GO +INSERT INTO babel_3658_substring_t4 VALUES('abcdefghi') +GO + +CREATE TABLE babel_3658_substring_t5(a VARBINARY(50)) +GO +INSERT INTO babel_3658_substring_t5 VALUES(0x2020616263642020) +GO + +CREATE TABLE babel_3658_substring_t6(a BINARY(50)) +GO +INSERT INTO babel_3658_substring_t6 VALUES(0x2020616263642020) +GO + +CREATE TABLE babel_3658_substring_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_3658_substring_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_3658_substring_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_3658_substring_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_3658_substring_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_3658_substring_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_3658_substring_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_3658_substring_arabic_ci_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_3658_substring_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_3658_substring_arabic_cs_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_3658_substring_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_3658_substring_arabic_ci_ai VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_3658_substring_image(a IMAGE) +GO +INSERT INTO babel_3658_substring_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_3658_substring_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_3658_substring_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO + +CREATE TYPE dbo.babel_3658_substring_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_3658_substring_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_3658_substring_UDT(a dbo.babel_3658_substring_imageUDT, b dbo.babel_3658_substring_varUDT) +GO +INSERT INTO babel_3658_substring_UDT VALUES(CAST('abcdef' as dbo.babel_3658_substring_imageUDT), CAST('abcdef' as dbo.babel_3658_substring_varUDT)) +GO + +CREATE VIEW babel_3658_substring_dep_view AS + SELECT substring(a, 4, 1) as result from babel_3658_substring_t2 +GO + +CREATE PROCEDURE babel_3658_substring_dep_proc AS + SELECT substring(a, 4, 1) as result from babel_3658_substring_t2 +GO + +CREATE FUNCTION babel_3658_substring_dep_func() +RETURNS NVARCHAR(200) +AS +BEGIN +RETURN (SELECT TOP 1 substring(a, 4, 1) from babel_3658_substring_t2) +END +GO + +CREATE VIEW babel_3658_substring_dep_view_1 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t1 +GO + +CREATE VIEW babel_3658_substring_dep_view_2 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t2 +GO + +CREATE VIEW babel_3658_substring_dep_view_3 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t3 +GO + +CREATE VIEW babel_3658_substring_dep_view_4 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t4 +GO + +CREATE VIEW babel_3658_substring_dep_view_5 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t5 +GO + +CREATE VIEW babel_3658_substring_dep_view_6 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_text +GO + +CREATE VIEW babel_3658_substring_dep_view_7 AS + SELECT substring(b, 4, 1) as result FROM babel_3658_substring_text +GO + +CREATE VIEW babel_3658_substring_dep_view_8 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t6 +GO + +CREATE FUNCTION babel_3658_substring_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT substring(a, 4, 1) as result from babel_3658_substring_t2) +GO diff --git a/test/JDBC/input/functions/string_functions/substring-before-15_8-or-16_4-vu-verify.sql b/test/JDBC/input/functions/string_functions/substring-before-15_8-or-16_4-vu-verify.sql new file mode 100644 index 00000000000..c9591a8d7d5 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/substring-before-15_8-or-16_4-vu-verify.sql @@ -0,0 +1,426 @@ +-- NULL +SELECT substring(NULL, 2, 1) +GO + +SELECT substring(CAST(NULL AS int), 2, 1) +GO + +SELECT substring(CAST(NULL AS varbinary), 2, 1) +GO + +SELECT substring(CAST(NULL AS decimal), 2, 1) +GO + +SELECT substring('abc', NULL, 1) +GO + +SELECT substring('abc', CAST(NULL AS text), 1) +GO + +SELECT substring('abc', CAST(NULL AS varchar), 1) +GO + +SELECT substring('abc', CAST(NULL AS int), 1) +GO + +SELECT substring('abc', 2, NULL) +GO + +SELECT substring('abc', 2, CAST(NULL AS text)) +GO + +SELECT substring('abc', 2, CAST(NULL AS varchar)) +GO + +SELECT substring('abc', 2, CAST(NULL AS int)) +GO + +SELECT substring(NULL, 2, NULL) +GO + +SELECT substring('abc', NULL, NULL) +GO + +SELECT substring(NULL, NULL, 1) +GO + +SELECT substring(NULL, NULL, NULL) +GO + +-- Different no. of arguments +SELECT substring('abc', 1) +GO + +SELECT substring('abc', 1, 1, 1) +GO + +-- edge case values for second parameter +SELECT substring('AbdefGhi', 0, 1) +GO + +SELECT '|' + substring('AbdefGhi', -1, 1) + '|' +GO + +SELECT substring('AbdefGhi', 1, 1) +GO + +SELECT substring('AbdefGhi', 8, 1) +GO + +SELECT substring('AbdefGhi', 9, 1) +GO + +SELECT substring('AbdefGhi', 2147483648, 1) +GO + +-- edge case values for third parameter +SELECT substring('AbdefGhi', 1, 0) +GO + +SELECT substring('AbdefGhi', 8, 0) +GO + +SELECT substring('AbdefGhi', 1, -1) +GO + +SELECT substring('AbdefGhi', 8, -1) +GO + +SELECT substring('AbdefGhi', 2, 9) +GO + +SELECT substring('AbdefGhi', 2, 2147483648) +GO + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 0, 1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 13, 1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 2, 15) COLLATE CHINESE_PRC_CI_AS +GO + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 0, 1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 13, 1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS +SELECT substring(@inputString, 2, 15) COLLATE CHINESE_PRC_CI_AS +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_ci_as +GO + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CI_AS FROM babel_3658_substring_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_cs_as +GO + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CS_AS FROM babel_3658_substring_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_ci_ai +GO + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CI_AI FROM babel_3658_substring_chinese_prc_ci_ai +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_ci_as +GO + +SELECT substring(a, 4, 2) COLLATE ARABIC_CI_AS FROM babel_3658_substring_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_cs_as +GO + +SELECT substring(a, 4, 2) COLLATE ARABIC_CS_AS FROM babel_3658_substring_arabic_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_ci_ai +GO + +SELECT substring(a, 4, 2) COLLATE ARABIC_CI_AI FROM babel_3658_substring_arabic_ci_ai +GO + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO + +-- with table column of type nchar +SELECT substring(a, 4, 2) FROM babel_3658_substring_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 4, 2) +SELECT substring(@inputString, 0, 1) +SELECT substring(@inputString, 13, 1) +SELECT substring(@inputString, 2, -1) +SELECT substring(@inputString, 2, 15) +GO + +SELECT substring(0x0a0b0c, 1,2), substring(0x0a0b0c,2,1) +GO + +-- dependent objects +SELECT * FROM babel_3658_substring_dep_view +GO + +EXEC babel_3658_substring_dep_proc +GO + +SELECT * FROM babel_3658_substring_dep_func() +GO + +SELECT * FROM babel_3658_substring_itvf_func() +GO + +SELECT * FROM babel_3658_substring_dep_view_1 +GO + +SELECT * FROM babel_3658_substring_dep_view_2 +GO + +SELECT * FROM babel_3658_substring_dep_view_3 +GO + +SELECT * FROM babel_3658_substring_dep_view_4 +GO + +SELECT * FROM babel_3658_substring_dep_view_5 +GO + +SELECT * FROM babel_3658_substring_dep_view_6 +GO + +SELECT * FROM babel_3658_substring_dep_view_7 +GO + +SELECT * FROM babel_3658_substring_dep_view_8 +GO + +-- input type UDT +-- in table babel_3658_substring_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT substring(a, 4, 2) FROM babel_3658_substring_UDT +GO + +SELECT substring(b, 4, 2) FROM babel_3658_substring_UDT +GO + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString decimal = 123456; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString numeric = 12345.12; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString float = 12345.1; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString real = 12345.1; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString bigint = 12345678; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString int = 12345678; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString smallint = 12356; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString tinyint = 235; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString money = 12356; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString smallmoney = 12356; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString bit = 1; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT substring(@inputString, 4, 1) +GO + +SELECT substring(a, 4, 2) from babel_3658_substring_image; +GO +SELECT substring(a, 0, 1) from babel_3658_substring_image; +GO +SELECT substring(a, 13, 1) from babel_3658_substring_image; +GO +SELECT substring(a, 2, -1) from babel_3658_substring_image; +GO +SELECT substring(a, 2, 15) from babel_3658_substring_image; +GO + +-- input datatype text +SELECT substring(a, 4, 2) FROM babel_3658_substring_text +GO +SELECT substring(a, 0, 1) from babel_3658_substring_text; +GO +SELECT substring(a, 13, 1) from babel_3658_substring_text; +GO +SELECT substring(a, 2, -1) from babel_3658_substring_text; +GO +SELECT substring(a, 2, 15) from babel_3658_substring_text; +GO + +-- input datatype ntext +SELECT substring(b, 4, 2) FROM babel_3658_substring_text +GO +SELECT substring(b, 0, 1) from babel_3658_substring_text; +GO +SELECT substring(b, 13, 1) from babel_3658_substring_text; +GO +SELECT substring(b, 2, -1) from babel_3658_substring_text; +GO +SELECT substring(b, 2, 15) from babel_3658_substring_text; +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO diff --git a/test/JDBC/input/functions/string_functions/substring-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/substring-vu-cleanup.sql new file mode 100644 index 00000000000..86cd915f860 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/substring-vu-cleanup.sql @@ -0,0 +1,86 @@ +DROP FUNCTION babel_3658_substring_itvf_func +GO + +DROP FUNCTION babel_3658_substring_dep_func +GO + +DROP PROCEDURE babel_3658_substring_dep_proc +GO + +DROP VIEW babel_3658_substring_dep_view +GO + +DROP TABLE babel_3658_substring_UDT +GO + +DROP VIEW babel_3658_substring_dep_view_1 +GO + +DROP VIEW babel_3658_substring_dep_view_2 +GO + +DROP VIEW babel_3658_substring_dep_view_3 +GO + +DROP VIEW babel_3658_substring_dep_view_4 +GO + +DROP VIEW babel_3658_substring_dep_view_5 +GO + +DROP VIEW babel_3658_substring_dep_view_6 +GO + +DROP VIEW babel_3658_substring_dep_view_7 +GO + +DROP VIEW babel_3658_substring_dep_view_8 +GO + +DROP TYPE dbo.babel_3658_substring_varUDT +GO + +DROP TYPE dbo.babel_3658_substring_imageUDT +GO + +DROP TABLE babel_3658_substring_text +GO + +DROP TABLE babel_3658_substring_image +GO + +DROP TABLE babel_3658_substring_arabic_ci_ai +GO + +DROP TABLE babel_3658_substring_arabic_cs_as +GO + +DROP TABLE babel_3658_substring_arabic_ci_as +GO + +DROP TABLE babel_3658_substring_chinese_prc_ci_ai +GO + +DROP TABLE babel_3658_substring_chinese_prc_cs_as +GO + +DROP TABLE babel_3658_substring_chinese_prc_ci_as +GO + +DROP TABLE babel_3658_substring_t6 +GO + +DROP TABLE babel_3658_substring_t5 +GO + +DROP TABLE babel_3658_substring_t4 +GO + +DROP TABLE babel_3658_substring_t3 +GO + +DROP TABLE babel_3658_substring_t2 +GO + +DROP TABLE babel_3658_substring_t1 +GO diff --git a/test/JDBC/input/functions/string_functions/substring-vu-prepare.sql b/test/JDBC/input/functions/string_functions/substring-vu-prepare.sql new file mode 100644 index 00000000000..325e7fc57f1 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/substring-vu-prepare.sql @@ -0,0 +1,135 @@ +CREATE TABLE babel_3658_substring_t1(a NCHAR(50)) +GO +INSERT INTO babel_3658_substring_t1 VALUES(N'abc🙂defghi🙂🙂') +INSERT INTO babel_3658_substring_t1 VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_3658_substring_t2(a NVARCHAR(50)) +GO +INSERT INTO babel_3658_substring_t2 VALUES(N'abc🙂defghi🙂🙂') +GO + +CREATE TABLE babel_3658_substring_t3(a CHAR(50)) +GO +INSERT INTO babel_3658_substring_t3 VALUES('abcdefghi') +GO + +CREATE TABLE babel_3658_substring_t4(a VARCHAR(50)) +GO +INSERT INTO babel_3658_substring_t4 VALUES('abcdefghi') +GO + +CREATE TABLE babel_3658_substring_t5(a VARBINARY(50)) +GO +INSERT INTO babel_3658_substring_t5 VALUES(0x2020616263642020) +GO + +CREATE TABLE babel_3658_substring_t6(a BINARY(50)) +GO +INSERT INTO babel_3658_substring_t6 VALUES(0x2020616263642020) +GO + +CREATE TABLE babel_3658_substring_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_3658_substring_chinese_prc_ci_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_3658_substring_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_3658_substring_chinese_prc_cs_as VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_3658_substring_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_3658_substring_chinese_prc_ci_ai VALUES(N'比尔·拉莫斯') +GO + +CREATE TABLE babel_3658_substring_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_3658_substring_arabic_ci_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_3658_substring_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_3658_substring_arabic_cs_as VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_3658_substring_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_3658_substring_arabic_ci_ai VALUES(N'الله مع المتقين') +GO + +CREATE TABLE babel_3658_substring_image(a IMAGE) +GO +INSERT INTO babel_3658_substring_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_3658_substring_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_3658_substring_text VALUES (N'abc🙂defghi🙂🙂', N'abc🙂defghi🙂🙂') +GO + +CREATE TYPE dbo.babel_3658_substring_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_3658_substring_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_3658_substring_UDT(a dbo.babel_3658_substring_imageUDT, b dbo.babel_3658_substring_varUDT) +GO +INSERT INTO babel_3658_substring_UDT VALUES(CAST('abcdef' as dbo.babel_3658_substring_imageUDT), CAST('abcdef' as dbo.babel_3658_substring_varUDT)) +GO + +CREATE VIEW babel_3658_substring_dep_view AS + SELECT substring(a, 4, 1) as result from babel_3658_substring_t2 +GO + +CREATE PROCEDURE babel_3658_substring_dep_proc AS + SELECT substring(a, 4, 1) as result from babel_3658_substring_t2 +GO + +CREATE FUNCTION babel_3658_substring_dep_func() +RETURNS NVARCHAR(200) +AS +BEGIN +RETURN (SELECT TOP 1 substring(a, 4, 1) from babel_3658_substring_t2) +END +GO + +CREATE VIEW babel_3658_substring_dep_view_1 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t1 +GO + +CREATE VIEW babel_3658_substring_dep_view_2 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t2 +GO + +CREATE VIEW babel_3658_substring_dep_view_3 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t3 +GO + +CREATE VIEW babel_3658_substring_dep_view_4 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t4 +GO + +CREATE VIEW babel_3658_substring_dep_view_5 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t5 +GO + +CREATE VIEW babel_3658_substring_dep_view_6 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_text +GO + +CREATE VIEW babel_3658_substring_dep_view_7 AS + SELECT substring(b, 4, 1) as result FROM babel_3658_substring_text +GO + +CREATE VIEW babel_3658_substring_dep_view_8 AS + SELECT substring(a, 4, 1) as result FROM babel_3658_substring_t6 +GO + +CREATE FUNCTION babel_3658_substring_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT substring(a, 4, 1) as result from babel_3658_substring_t2) +GO diff --git a/test/JDBC/input/functions/string_functions/substring-vu-verify.sql b/test/JDBC/input/functions/string_functions/substring-vu-verify.sql new file mode 100644 index 00000000000..fc03c706794 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/substring-vu-verify.sql @@ -0,0 +1,522 @@ +-- NULL +SELECT substring(NULL, 2, 1) +GO + +SELECT substring(CAST(NULL AS int), 2, 1) +GO + +SELECT substring(CAST(NULL AS varbinary), 2, 1) +GO + +SELECT substring(CAST(NULL AS decimal), 2, 1) +GO + +SELECT substring('abc', NULL, 1) +GO + +SELECT substring('abc', CAST(NULL AS text), 1) +GO + +SELECT substring('abc', CAST(NULL AS varchar), 1) +GO + +SELECT substring('abc', CAST(NULL AS int), 1) +GO + +SELECT substring('abc', 2, NULL) +GO + +SELECT substring('abc', 2, CAST(NULL AS text)) +GO + +SELECT substring('abc', 2, CAST(NULL AS varchar)) +GO + +SELECT substring('abc', 2, CAST(NULL AS int)) +GO + +SELECT substring(NULL, 2, NULL) +GO + +SELECT substring('abc', NULL, NULL) +GO + +SELECT substring(NULL, NULL, 1) +GO + +SELECT substring(NULL, NULL, NULL) +GO + +-- Different no. of arguments +SELECT substring('abc', 1) +GO + +SELECT substring('abc', 1, 1, 1) +GO + +-- edge case values for second parameter +SELECT substring('AbdefGhi', 0, 1) +GO + +SELECT '|' + substring('AbdefGhi', -1, 1) + '|' +GO + +SELECT substring('AbdefGhi', 1, 1) +GO + +SELECT substring('AbdefGhi', 8, 1) +GO + +SELECT substring('AbdefGhi', 9, 1) +GO + +SELECT substring('AbdefGhi', 2147483648, 1) +GO + +-- edge case values for third parameter +SELECT substring('AbdefGhi', 1, 0) +GO + +SELECT substring('AbdefGhi', 8, 0) +GO + +SELECT substring('AbdefGhi', 1, -1) +GO + +SELECT substring('AbdefGhi', 8, -1) +GO + +SELECT substring('AbdefGhi', 2, 9) +GO + +SELECT substring('AbdefGhi', 2, 2147483648) +GO + +-- input type char +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 0, 1) +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 13, 1) +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, -1) +GO +DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, 15) +GO + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) +GO + +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString CHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) COLLATE CHINESE_PRC_CI_AS +GO + +-- input type varchar +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 0, 1) +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 13, 1) +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, -1) +GO +DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, 15) +GO + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) +GO + +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS +GO +DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) COLLATE CHINESE_PRC_CI_AS +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_ci_as +GO + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CI_AS FROM babel_3658_substring_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_cs_as +GO + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CS_AS FROM babel_3658_substring_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT substring(a, 4, 2) FROM babel_3658_substring_chinese_prc_ci_ai +GO + +SELECT substring(a, 4, 2) COLLATE CHINESE_PRC_CI_AI FROM babel_3658_substring_chinese_prc_ci_ai +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_ci_as +GO + +SELECT substring(a, 4, 2) COLLATE ARABIC_CI_AS FROM babel_3658_substring_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_cs_as +GO + +SELECT substring(a, 4, 2) COLLATE ARABIC_CS_AS FROM babel_3658_substring_arabic_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT substring(a, 4, 2) FROM babel_3658_substring_arabic_ci_ai +GO + +SELECT substring(a, 4, 2) COLLATE ARABIC_CI_AI FROM babel_3658_substring_arabic_ci_ai +GO + +-- input type nchar +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 0, 1) +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 13, 1) +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, -1) +GO +DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, 15) +GO + +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) +GO +DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) +GO + +-- with table column of type nchar +SELECT substring(a, 4, 2) FROM babel_3658_substring_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 4, 2) +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 0, 1) +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 13, 1) +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, -1) +GO +DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' +SELECT substring(@inputString, 2, 15) +GO + +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 4, 2) +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 0, 1) +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 13, 1) +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 2, -1) +GO +DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' +SELECT substring(@inputString, 2, 15) +GO + +-- input type binary +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 4, 2) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 0, 1) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 13, 1) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 2, -1) +GO +DECLARE @inputString BINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 2, 15) +GO + +-- input type varbinary +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 4, 2) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 0, 1) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 13, 1) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 2, -1) +GO +DECLARE @inputString VARBINARY(10) = 0x6162636465666768 +SELECT substring(@inputString, 2, 15) +GO + +SELECT substring(0x0a0b0c, 1,2), substring(0x0a0b0c,2,1) +GO + +-- dependent objects +SELECT * FROM babel_3658_substring_dep_view +GO + +EXEC babel_3658_substring_dep_proc +GO + +SELECT * FROM babel_3658_substring_dep_func() +GO + +SELECT * FROM babel_3658_substring_itvf_func() +GO + +SELECT * FROM babel_3658_substring_dep_view_1 +GO + +SELECT * FROM babel_3658_substring_dep_view_2 +GO + +SELECT * FROM babel_3658_substring_dep_view_3 +GO + +SELECT * FROM babel_3658_substring_dep_view_4 +GO + +SELECT * FROM babel_3658_substring_dep_view_5 +GO + +SELECT * FROM babel_3658_substring_dep_view_6 +GO + +SELECT * FROM babel_3658_substring_dep_view_7 +GO + +SELECT * FROM babel_3658_substring_dep_view_8 +GO + +-- input type UDT +-- in table babel_3658_substring_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT substring(a, 4, 2) FROM babel_3658_substring_UDT +GO + +SELECT substring(b, 4, 2) FROM babel_3658_substring_UDT +GO + +-- other different datatypes, datatypes that are not implicitly coercible to varchar/nvarchar should throw error +DECLARE @inputString date = '2016-12-21'; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString decimal = 123456; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString numeric = 12345.12; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString float = 12345.1; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString real = 12345.1; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString bigint = 12345678; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString int = 12345678; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString smallint = 12356; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString tinyint = 235; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString money = 12356; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString smallmoney = 12356; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString bit = 1; +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT substring(@inputString, 4, 1) +GO + +SELECT substring(a, 4, 2) from babel_3658_substring_image; +GO +SELECT substring(a, 0, 1) from babel_3658_substring_image; +GO +SELECT substring(a, 13, 1) from babel_3658_substring_image; +GO +SELECT substring(a, 2, -1) from babel_3658_substring_image; +GO +SELECT substring(a, 2, 15) from babel_3658_substring_image; +GO + +-- input datatype text +SELECT substring(a, 4, 2) FROM babel_3658_substring_text +GO +SELECT substring(a, 0, 1) from babel_3658_substring_text; +GO +SELECT substring(a, 13, 1) from babel_3658_substring_text; +GO +SELECT substring(a, 2, -1) from babel_3658_substring_text; +GO +SELECT substring(a, 2, 15) from babel_3658_substring_text; +GO + +-- input datatype ntext +SELECT substring(b, 4, 2) FROM babel_3658_substring_text +GO +SELECT substring(b, 0, 1) from babel_3658_substring_text; +GO +SELECT substring(b, 13, 1) from babel_3658_substring_text; +GO +SELECT substring(b, 2, -1) from babel_3658_substring_text; +GO +SELECT substring(b, 2, 15) from babel_3658_substring_text; +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT substring(@inputString, 4, 1) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT substring(CAST(@inputString AS VARCHAR(50)), 4, 1) +GO diff --git a/test/JDBC/input/functions/string_functions/translate-before-15_8-or-16_4-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/translate-before-15_8-or-16_4-vu-cleanup.sql new file mode 100644 index 00000000000..d6a6689cf43 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/translate-before-15_8-or-16_4-vu-cleanup.sql @@ -0,0 +1,56 @@ +DROP FUNCTION babel_4837_translate_itvf_func +GO + +DROP FUNCTION babel_4837_translate_dep_func +GO + +DROP PROCEDURE babel_4837_translate_dep_proc +GO + +DROP VIEW babel_4837_translate_dep_view +GO + +DROP VIEW babel_4837_translate_dep_view1 +GO + +DROP TABLE babel_4837_translate_UDT +GO + +DROP TYPE dbo.babel_4837_translate_varUDT +GO + +DROP TYPE dbo.babel_4837_translate_imageUDT +GO + +DROP TABLE babel_4837_translate_text +GO + +DROP TABLE babel_4837_translate_image +GO + +DROP TABLE babel_4837_translate_arabic_ci_ai +GO + +DROP TABLE babel_4837_translate_arabic_cs_as +GO + +DROP TABLE babel_4837_translate_arabic_ci_as +GO + +DROP TABLE babel_4837_translate_chinese_prc_ci_ai +GO + +DROP TABLE babel_4837_translate_chinese_prc_cs_as +GO + +DROP TABLE babel_4837_translate_chinese_prc_ci_as +GO + +DROP TABLE babel_4837_translate_t3 +GO + +DROP TABLE babel_4837_translate_t2 +GO + +DROP TABLE babel_4837_translate_t1 +GO diff --git a/test/JDBC/input/functions/string_functions/translate-before-15_8-or-16_4-vu-prepare.sql b/test/JDBC/input/functions/string_functions/translate-before-15_8-or-16_4-vu-prepare.sql new file mode 100644 index 00000000000..4bb55ad0273 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/translate-before-15_8-or-16_4-vu-prepare.sql @@ -0,0 +1,92 @@ +CREATE TABLE babel_4837_translate_t1(a NCHAR(50), b NCHAR(20), c NCHAR(20)) +GO +INSERT INTO babel_4837_translate_t1 VALUES(N' abc🙂defghi🙂🙂 ', N'ab🙂', N'x🙂y') +INSERT INTO babel_4837_translate_t1 VALUES(N' 比尔·拉莫斯 ', N'比拉斯', N'尔·比') +GO + +CREATE TABLE babel_4837_translate_t2(a NVARCHAR(50), b NVARCHAR(20), c NVARCHAR(20)) +GO +INSERT INTO babel_4837_translate_t2 VALUES(N' abc🙂defghi🙂🙂 ', N'ab🙂', N'x🙂y') +GO + +CREATE TABLE babel_4837_translate_t3(a VARCHAR(50), b VARCHAR(20), c VARCHAR(20)) +GO +INSERT INTO babel_4837_translate_t3 VALUES(' abc🙂defghi🙂🙂 ', 'ab🙂', 'x🙂y') +GO + +CREATE TABLE babel_4837_translate_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CI_AS, c VARCHAR(20) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4837_translate_chinese_prc_ci_as VALUES(N' 比尔·拉莫斯 ', N'比拉斯', N'尔·比') +GO + +CREATE TABLE babel_4837_translate_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CS_AS, c VARCHAR(20) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4837_translate_chinese_prc_cs_as VALUES(N' 比尔·拉莫斯 ', N'比拉斯', N'尔·比') +GO + +CREATE TABLE babel_4837_translate_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI, b VARCHAR(20) COLLATE CHINESE_PRC_CI_AI, c VARCHAR(20) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4837_translate_chinese_prc_ci_ai VALUES(N' 比尔·拉莫斯 ', N'比拉斯', N'尔·比') +GO + +CREATE TABLE babel_4837_translate_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS, b VARCHAR(20) COLLATE ARABIC_CI_AS, c VARCHAR(20) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4837_translate_arabic_ci_as VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO + +CREATE TABLE babel_4837_translate_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS, b VARCHAR(20) COLLATE ARABIC_CS_AS, c VARCHAR(20) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4837_translate_arabic_cs_as VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO + +CREATE TABLE babel_4837_translate_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI, b VARCHAR(20) COLLATE ARABIC_CI_AI, c VARCHAR(20) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4837_translate_arabic_ci_ai VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO + +CREATE TABLE babel_4837_translate_image(a IMAGE) +GO +INSERT INTO babel_4837_translate_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_4837_translate_text(a TEXT, b NTEXT, c NTEXT) +GO +INSERT INTO babel_4837_translate_text VALUES (N' abc🙂defghi🙂🙂 ', N' abc🙂defghi🙂🙂 ', N' sbc🙂defjhi🙂🙂 ') +GO + +CREATE TYPE dbo.babel_4837_translate_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4837_translate_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4837_translate_UDT(a dbo.babel_4837_translate_imageUDT, b dbo.babel_4837_translate_varUDT, c dbo.babel_4837_translate_varUDT) +GO +INSERT INTO babel_4837_translate_UDT VALUES(CAST('abcdef' as dbo.babel_4837_translate_imageUDT), CAST('abcdef' as dbo.babel_4837_translate_varUDT), CAST('abcdef' as dbo.babel_4837_translate_varUDT)) +GO + +CREATE VIEW babel_4837_translate_dep_view AS + SELECT ('|' + TRANSLATE(a, b, c) + '|') as result FROM babel_4837_translate_t2 +GO + +CREATE VIEW babel_4837_translate_dep_view1 AS + SELECT ('|' + TRANSLATE(a, b, c) + '|') as result FROM babel_4837_translate_t3 +GO + +CREATE PROCEDURE babel_4837_translate_dep_proc AS + SELECT ('|' + TRANSLATE(a, b, c) + '|') as result FROM babel_4837_translate_t2 +GO + +CREATE FUNCTION babel_4837_translate_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 ('|' + TRANSLATE(a, b, c) + '|') FROM babel_4837_translate_t2) +END +GO + +CREATE FUNCTION babel_4837_translate_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT ('|' + TRANSLATE(a, b, c) + '|') as result FROM babel_4837_translate_t2) +GO diff --git a/test/JDBC/input/functions/string_functions/translate-before-15_8-or-16_4-vu-verify.sql b/test/JDBC/input/functions/string_functions/translate-before-15_8-or-16_4-vu-verify.sql new file mode 100644 index 00000000000..0f9c47850dc --- /dev/null +++ b/test/JDBC/input/functions/string_functions/translate-before-15_8-or-16_4-vu-verify.sql @@ -0,0 +1,1298 @@ +DECLARE @string1 nvarchar(30) = N'比尔·拉' +DECLARE @characters nvarchar(10) = N'尔', @translation nvarchar(10) = N'莫' +SELECT TRANSLATE(@string1, @characters, @translation) +GO + +-- NULL +SELECT TRANSLATE(NULL, 'acs', 'scd') +GO + +SELECT TRANSLATE('scd', NULL, 'scd') +GO + +SELECT TRANSLATE('scd', 'scd', NULL) +GO + +SELECT TRANSLATE(NULL, NULL, NULL) +GO + +SELECT TRANSLATE(NULL, 'aces', 'scdwe') +GO + +-- different no. of arguments +SELECT TRANSLATE('aceds', 'aces', 'scdwe', 'acsdes') +GO + +SELECT TRANSLATE('aces', 'scdwe') +GO + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(10) = '比拉斯 ', @translations CHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(10) = '比拉斯 ', @translations CHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(10) = '比拉斯 ', @translations VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(10) = '比拉斯 ', @translations VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(MAX) = '比拉斯 ', @translations VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(MAX) = '比拉斯 ', @translations VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_ci_as +GO + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4837_translate_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_cs_as +GO + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4837_translate_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_ci_ai +GO + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4837_translate_chinese_prc_ci_ai +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_ci_as +GO + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CI_AS + '|' FROM babel_4837_translate_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_cs_as +GO + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CS_AS + '|' FROM babel_4837_translate_arabic_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_ci_ai +GO + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CI_AI + '|' FROM babel_4837_translate_arabic_ci_ai +GO + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(10) = N'比拉斯 ', @translations NCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(10) = N'比拉斯 ', @translations NCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +-- with table column of type nchar +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(10) = N'比拉斯 ', @translations NVARCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(10) = N'比拉斯 ', @translations NVARCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(MAX) = N'比拉斯 ', @translations NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(MAX) = N'比拉斯 ', @translations NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +-- dependent objects +SELECT * FROM babel_4837_translate_dep_view +GO + +SELECT * FROM babel_4837_translate_dep_view1 +GO + +EXEC babel_4837_translate_dep_proc +GO + +SELECT * FROM babel_4837_translate_dep_func() +GO + +SELECT * FROM babel_4837_translate_itvf_func() +GO + +-- different datatypes of inputString and characters/translations +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations)+ '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' ABCDEF ', @characters BINARY(4) = 0x414243, @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARBINARY(50) = 0x41424344, @characters NCHAR(20) = N'尔·比?', @translations VARBINARY(2) = 0x4144 +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +-- input type UDT +-- in table babel_4837_translate_UDT, col 'a' has basetype image and col 'b' and 'c' have basetype varchar +SELECT TRANSLATE(a, b, c) FROM babel_4837_translate_UDT +GO + +SELECT TRANSLATE(b, b, c) FROM babel_4837_translate_UDT +GO + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT TRANSLATE(@inputString, '12', '06'); +GO + +DECLARE @inputString date = '2016-12-21', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters date = '2016-12-21', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters VARCHAR(20) = '2016-12-21', @translations date = '2016-12-21'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString date = '2016-12-21' +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @date date = '2016-12-21', @translations VARCHAR(10) = '06'; +DECLARE @characters datetime = @date; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters VARCHAR(20) = '2016-12-21', @date date = '2016-12-21'; +DECLARE @translations datetime = @date; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @characters smalldatetime = '2016-12-21 12:43:10', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @characters VARCHAR(30) = '2016-12-21 12:43:10', @translations smalldatetime = '2016-12-21 12:43:10'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString time(4) = '12:10:05.1237', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @characters time(4) = '12:10:05.1237', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @characters VARCHAR(30) = '12:10:05.1237', @translations time(4) = '12:10:05.1237'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @characters datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @characters VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @translations datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @characters datetime2(4) = '1968-10-23 12:45:37.1237', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @characters VARCHAR(50) = '1968-10-23 12:45:37.1237', @translations datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString decimal = 123456, @characters decimal = 12, @translations decimal = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters decimal = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations decimal = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString numeric = 12345.12, @characters numeric = 12, @translations numeric = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters numeric = 12.12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations numeric = 12.12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString float = 12345.1, @characters float = 12, @translations float = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters float = 12.1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations float = 12.1; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString real = 12345.1, @characters real = 12, @translations real = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters real = 12.1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations real = 12.1; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString bigint = 12345678, @characters bigint = 12, @translations bigint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters bigint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations bigint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString int = 12345678, @characters int = 12, @translations int = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters int = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations int = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString smallint = 12356, @characters smallint = 12, @translations smallint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters smallint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations smallint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString tinyint = 235, @characters tinyint = 12, @translations tinyint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters tinyint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations tinyint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString money = 12356, @characters money = 12, @translations money = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters money = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations money = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString smallmoney = 12356, @characters smallmoney = 12, @translations smallmoney = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters smallmoney = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations smallmoney = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString bit = 1, @characters bit = 1, @translations bit = 0; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters bit = 1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations bit = 0; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO + +SELECT TRANSLATE(a, a, a) FROM babel_4837_translate_image; +GO + +SELECT TRANSLATE('a', a, 'a') FROM babel_4837_translate_image; +GO + +SELECT TRANSLATE('a', 'a', a) FROM babel_4837_translate_image; +GO + +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(a, @characters, @translations) from babel_4837_translate_image; +GO + +SELECT TRANSLATE(a, b, c) FROM babel_4837_translate_text +GO +SELECT TRANSLATE('qw', a, 'cd') FROM babel_4837_translate_text +GO +SELECT TRANSLATE('qw', 'ab', a) FROM babel_4837_translate_text +GO +SELECT TRANSLATE(b, a, c) FROM babel_4837_translate_text +GO +SELECT TRANSLATE('qw', c, 'cd') FROM babel_4837_translate_text +GO +SELECT TRANSLATE('qw', 'ab', b) FROM babel_4837_translate_text +GO + +DECLARE @characters VARCHAR(20) = 'ab?', @translations VARCHAR(10) = 'x?y'; +SELECT TRANSLATE(a, @characters, @translations) FROM babel_4837_translate_text +GO + +DECLARE @characters VARCHAR(20) = 'ab?', @translations VARCHAR(10) = 'x?y'; +SELECT TRANSLATE(b, @characters, @translations) FROM babel_4837_translate_text +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @characters xml = CAST ('' AS xml), @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters xml = CAST ('' AS xml), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters geometry = geometry::STGeomFromText('POINT (1 2)', 0), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters geography = geography::STGeomFromText('POINT (1 2)', 4326), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations geography = geography::STGeomFromText('POINT (1 2)', 4326); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), @characters, @translations) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @characters xml = CAST ('' AS xml), @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), CAST (@characters AS VARCHAR(50)), CAST (@translations AS VARCHAR(50))) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), @characters, @translations) +GO diff --git a/test/JDBC/input/functions/string_functions/translate-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/translate-vu-cleanup.sql new file mode 100644 index 00000000000..d6a6689cf43 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/translate-vu-cleanup.sql @@ -0,0 +1,56 @@ +DROP FUNCTION babel_4837_translate_itvf_func +GO + +DROP FUNCTION babel_4837_translate_dep_func +GO + +DROP PROCEDURE babel_4837_translate_dep_proc +GO + +DROP VIEW babel_4837_translate_dep_view +GO + +DROP VIEW babel_4837_translate_dep_view1 +GO + +DROP TABLE babel_4837_translate_UDT +GO + +DROP TYPE dbo.babel_4837_translate_varUDT +GO + +DROP TYPE dbo.babel_4837_translate_imageUDT +GO + +DROP TABLE babel_4837_translate_text +GO + +DROP TABLE babel_4837_translate_image +GO + +DROP TABLE babel_4837_translate_arabic_ci_ai +GO + +DROP TABLE babel_4837_translate_arabic_cs_as +GO + +DROP TABLE babel_4837_translate_arabic_ci_as +GO + +DROP TABLE babel_4837_translate_chinese_prc_ci_ai +GO + +DROP TABLE babel_4837_translate_chinese_prc_cs_as +GO + +DROP TABLE babel_4837_translate_chinese_prc_ci_as +GO + +DROP TABLE babel_4837_translate_t3 +GO + +DROP TABLE babel_4837_translate_t2 +GO + +DROP TABLE babel_4837_translate_t1 +GO diff --git a/test/JDBC/input/functions/string_functions/translate-vu-prepare.sql b/test/JDBC/input/functions/string_functions/translate-vu-prepare.sql new file mode 100644 index 00000000000..4bb55ad0273 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/translate-vu-prepare.sql @@ -0,0 +1,92 @@ +CREATE TABLE babel_4837_translate_t1(a NCHAR(50), b NCHAR(20), c NCHAR(20)) +GO +INSERT INTO babel_4837_translate_t1 VALUES(N' abc🙂defghi🙂🙂 ', N'ab🙂', N'x🙂y') +INSERT INTO babel_4837_translate_t1 VALUES(N' 比尔·拉莫斯 ', N'比拉斯', N'尔·比') +GO + +CREATE TABLE babel_4837_translate_t2(a NVARCHAR(50), b NVARCHAR(20), c NVARCHAR(20)) +GO +INSERT INTO babel_4837_translate_t2 VALUES(N' abc🙂defghi🙂🙂 ', N'ab🙂', N'x🙂y') +GO + +CREATE TABLE babel_4837_translate_t3(a VARCHAR(50), b VARCHAR(20), c VARCHAR(20)) +GO +INSERT INTO babel_4837_translate_t3 VALUES(' abc🙂defghi🙂🙂 ', 'ab🙂', 'x🙂y') +GO + +CREATE TABLE babel_4837_translate_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CI_AS, c VARCHAR(20) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4837_translate_chinese_prc_ci_as VALUES(N' 比尔·拉莫斯 ', N'比拉斯', N'尔·比') +GO + +CREATE TABLE babel_4837_translate_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CS_AS, c VARCHAR(20) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4837_translate_chinese_prc_cs_as VALUES(N' 比尔·拉莫斯 ', N'比拉斯', N'尔·比') +GO + +CREATE TABLE babel_4837_translate_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI, b VARCHAR(20) COLLATE CHINESE_PRC_CI_AI, c VARCHAR(20) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4837_translate_chinese_prc_ci_ai VALUES(N' 比尔·拉莫斯 ', N'比拉斯', N'尔·比') +GO + +CREATE TABLE babel_4837_translate_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS, b VARCHAR(20) COLLATE ARABIC_CI_AS, c VARCHAR(20) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4837_translate_arabic_ci_as VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO + +CREATE TABLE babel_4837_translate_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS, b VARCHAR(20) COLLATE ARABIC_CS_AS, c VARCHAR(20) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4837_translate_arabic_cs_as VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO + +CREATE TABLE babel_4837_translate_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI, b VARCHAR(20) COLLATE ARABIC_CI_AI, c VARCHAR(20) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4837_translate_arabic_ci_ai VALUES(N' الله مع المتقين ', N'ين', N'مع') +GO + +CREATE TABLE babel_4837_translate_image(a IMAGE) +GO +INSERT INTO babel_4837_translate_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_4837_translate_text(a TEXT, b NTEXT, c NTEXT) +GO +INSERT INTO babel_4837_translate_text VALUES (N' abc🙂defghi🙂🙂 ', N' abc🙂defghi🙂🙂 ', N' sbc🙂defjhi🙂🙂 ') +GO + +CREATE TYPE dbo.babel_4837_translate_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4837_translate_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4837_translate_UDT(a dbo.babel_4837_translate_imageUDT, b dbo.babel_4837_translate_varUDT, c dbo.babel_4837_translate_varUDT) +GO +INSERT INTO babel_4837_translate_UDT VALUES(CAST('abcdef' as dbo.babel_4837_translate_imageUDT), CAST('abcdef' as dbo.babel_4837_translate_varUDT), CAST('abcdef' as dbo.babel_4837_translate_varUDT)) +GO + +CREATE VIEW babel_4837_translate_dep_view AS + SELECT ('|' + TRANSLATE(a, b, c) + '|') as result FROM babel_4837_translate_t2 +GO + +CREATE VIEW babel_4837_translate_dep_view1 AS + SELECT ('|' + TRANSLATE(a, b, c) + '|') as result FROM babel_4837_translate_t3 +GO + +CREATE PROCEDURE babel_4837_translate_dep_proc AS + SELECT ('|' + TRANSLATE(a, b, c) + '|') as result FROM babel_4837_translate_t2 +GO + +CREATE FUNCTION babel_4837_translate_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 ('|' + TRANSLATE(a, b, c) + '|') FROM babel_4837_translate_t2) +END +GO + +CREATE FUNCTION babel_4837_translate_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT ('|' + TRANSLATE(a, b, c) + '|') as result FROM babel_4837_translate_t2) +GO diff --git a/test/JDBC/input/functions/string_functions/translate-vu-verify.sql b/test/JDBC/input/functions/string_functions/translate-vu-verify.sql new file mode 100644 index 00000000000..0f9c47850dc --- /dev/null +++ b/test/JDBC/input/functions/string_functions/translate-vu-verify.sql @@ -0,0 +1,1298 @@ +DECLARE @string1 nvarchar(30) = N'比尔·拉' +DECLARE @characters nvarchar(10) = N'尔', @translation nvarchar(10) = N'莫' +SELECT TRANSLATE(@string1, @characters, @translation) +GO + +-- NULL +SELECT TRANSLATE(NULL, 'acs', 'scd') +GO + +SELECT TRANSLATE('scd', NULL, 'scd') +GO + +SELECT TRANSLATE('scd', 'scd', NULL) +GO + +SELECT TRANSLATE(NULL, NULL, NULL) +GO + +SELECT TRANSLATE(NULL, 'aces', 'scdwe') +GO + +-- different no. of arguments +SELECT TRANSLATE('aceds', 'aces', 'scdwe', 'acsdes') +GO + +SELECT TRANSLATE('aces', 'scdwe') +GO + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(10) = '比拉斯 ', @translations CHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(10) = '比拉斯 ', @translations CHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(10) = '比拉斯 ', @translations VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(10) = '比拉斯 ', @translations VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(MAX) = '比拉斯 ', @translations VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(MAX) = '比拉斯 ', @translations VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_ci_as +GO + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4837_translate_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_cs_as +GO + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4837_translate_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_chinese_prc_ci_ai +GO + +SELECT '|' + TRANSLATE(a, b, c) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4837_translate_chinese_prc_ci_ai +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_ci_as +GO + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CI_AS + '|' FROM babel_4837_translate_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_cs_as +GO + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CS_AS + '|' FROM babel_4837_translate_arabic_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_arabic_ci_ai +GO + +SELECT '|' + TRANSLATE(a, b, c) COLLATE ARABIC_CI_AI + '|' FROM babel_4837_translate_arabic_ci_ai +GO + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(10) = N'比拉斯 ', @translations NCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(10) = N'比拉斯 ', @translations NCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +-- with table column of type nchar +SELECT '|' + TRANSLATE(a, b, c) + '|' FROM babel_4837_translate_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab🙂', 'x🙂y') + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab?', 'x🙂y') + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRANSLATE(@inputString, 'ab😎', 'x🙂y') + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRANSLATE(@inputString, '比拉斯 ', '尔·比?') COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(10) = N'比拉斯 ', @translations NVARCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(10) = N'比拉斯 ', @translations NVARCHAR(10) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(MAX) = N'比拉斯 ', @translations NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(MAX) = N'比拉斯 ', @translations NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +-- dependent objects +SELECT * FROM babel_4837_translate_dep_view +GO + +SELECT * FROM babel_4837_translate_dep_view1 +GO + +EXEC babel_4837_translate_dep_proc +GO + +SELECT * FROM babel_4837_translate_dep_func() +GO + +SELECT * FROM babel_4837_translate_itvf_func() +GO + +-- different datatypes of inputString and characters/translations +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations)+ '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab🙂', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab😎', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters NVARCHAR(20) = N'比拉斯 ', @translations NVARCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab🙂', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab😎', @translations CHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab🙂', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab😎', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters VARCHAR(20) = '比拉斯 ', @translations VARCHAR(20) = '尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab🙂', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab😎', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations NVARCHAR(20) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations VARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations CHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(20) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂y' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations VARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NVARCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations CHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @translations NCHAR(40) = 'x🙂y' +SELECT '|' + TRANSLATE(@inputString, 'ab?', @translations) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(40) = 'ab?' +SELECT '|' + TRANSLATE(@inputString, @characters, 'x🙂y') + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' ABCDEF ', @characters BINARY(4) = 0x414243, @translations NCHAR(20) = N'尔·比?' +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +DECLARE @inputString VARBINARY(50) = 0x41424344, @characters NCHAR(20) = N'尔·比?', @translations VARBINARY(2) = 0x4144 +SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' +GO + +-- input type UDT +-- in table babel_4837_translate_UDT, col 'a' has basetype image and col 'b' and 'c' have basetype varchar +SELECT TRANSLATE(a, b, c) FROM babel_4837_translate_UDT +GO + +SELECT TRANSLATE(b, b, c) FROM babel_4837_translate_UDT +GO + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT TRANSLATE(@inputString, '12', '06'); +GO + +DECLARE @inputString date = '2016-12-21', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters date = '2016-12-21', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters VARCHAR(20) = '2016-12-21', @translations date = '2016-12-21'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString date = '2016-12-21' +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @date date = '2016-12-21', @translations VARCHAR(10) = '06'; +DECLARE @characters datetime = @date; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(20) = '2016-12-21', @characters VARCHAR(20) = '2016-12-21', @date date = '2016-12-21'; +DECLARE @translations datetime = @date; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @characters smalldatetime = '2016-12-21 12:43:10', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(30) = '2016-12-21 12:43:10', @characters VARCHAR(30) = '2016-12-21 12:43:10', @translations smalldatetime = '2016-12-21 12:43:10'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString time(4) = '12:10:05.1237', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @characters time(4) = '12:10:05.1237', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(30) = '12:10:05.1237', @characters VARCHAR(30) = '12:10:05.1237', @translations time(4) = '12:10:05.1237'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @characters datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @characters VARCHAR(50) = '1968-10-23 12:45:37.1234 +10:0', @translations datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @characters VARCHAR(10) = '12', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @characters datetime2(4) = '1968-10-23 12:45:37.1237', @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1968-10-23 12:45:37.1237', @characters VARCHAR(50) = '1968-10-23 12:45:37.1237', @translations datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString decimal = 123456, @characters decimal = 12, @translations decimal = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters decimal = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations decimal = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString numeric = 12345.12, @characters numeric = 12, @translations numeric = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters numeric = 12.12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations numeric = 12.12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString float = 12345.1, @characters float = 12, @translations float = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters float = 12.1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations float = 12.1; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString real = 12345.1, @characters real = 12, @translations real = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters real = 12.1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations real = 12.1; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString bigint = 12345678, @characters bigint = 12, @translations bigint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters bigint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations bigint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString int = 12345678, @characters int = 12, @translations int = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters int = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations int = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString smallint = 12356, @characters smallint = 12, @translations smallint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters smallint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations smallint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString tinyint = 235, @characters tinyint = 12, @translations tinyint = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters tinyint = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations tinyint = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString money = 12356, @characters money = 12, @translations money = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters money = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations money = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString smallmoney = 12356, @characters smallmoney = 12, @translations smallmoney = 06; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters smallmoney = 12, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations smallmoney = 12; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString bit = 1, @characters bit = 1, @translations bit = 0; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters bit = 1, @translations VARCHAR(10) = '06'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '1234', @translations bit = 0; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO + +SELECT TRANSLATE(a, a, a) FROM babel_4837_translate_image; +GO + +SELECT TRANSLATE('a', a, 'a') FROM babel_4837_translate_image; +GO + +SELECT TRANSLATE('a', 'a', a) FROM babel_4837_translate_image; +GO + +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(a, @characters, @translations) from babel_4837_translate_image; +GO + +SELECT TRANSLATE(a, b, c) FROM babel_4837_translate_text +GO +SELECT TRANSLATE('qw', a, 'cd') FROM babel_4837_translate_text +GO +SELECT TRANSLATE('qw', 'ab', a) FROM babel_4837_translate_text +GO +SELECT TRANSLATE(b, a, c) FROM babel_4837_translate_text +GO +SELECT TRANSLATE('qw', c, 'cd') FROM babel_4837_translate_text +GO +SELECT TRANSLATE('qw', 'ab', b) FROM babel_4837_translate_text +GO + +DECLARE @characters VARCHAR(20) = 'ab?', @translations VARCHAR(10) = 'x?y'; +SELECT TRANSLATE(a, @characters, @translations) FROM babel_4837_translate_text +GO + +DECLARE @characters VARCHAR(20) = 'ab?', @translations VARCHAR(10) = 'x?y'; +SELECT TRANSLATE(b, @characters, @translations) FROM babel_4837_translate_text +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @characters xml = CAST ('' AS xml), @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters xml = CAST ('' AS xml), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters geometry = geometry::STGeomFromText('POINT (1 2)', 0), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters geography = geography::STGeomFromText('POINT (1 2)', 4326), @translations VARCHAR(10) = '6F9619FF-8B86-D011-B42D-00C04FC964FF'; +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString VARCHAR(50) = '1234', @characters VARCHAR(50) = '6F9619FF-8B86-D011-B42D-00C04FC964FF', @translations geography = geography::STGeomFromText('POINT (1 2)', 4326); +SELECT TRANSLATE(@inputString, @characters, @translations) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); +SELECT TRANSLATE(@inputString, @inputString, @inputString) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @characters VARCHAR(10) = '6F', @translations VARCHAR(10) = '5A'; +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), @characters, @translations) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @characters xml = CAST ('' AS xml), @translations xml = CAST ('' AS xml); +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), CAST (@characters AS VARCHAR(50)), CAST (@translations AS VARCHAR(50))) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @characters VARCHAR(10) = '(1 2)', @translations VARCHAR(10) = '(4 5)'; +SELECT TRANSLATE(CAST (@inputString AS VARCHAR(50)), @characters, @translations) +GO diff --git a/test/JDBC/input/functions/string_functions/trim-before-15_8-or-16_4-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/trim-before-15_8-or-16_4-vu-cleanup.sql new file mode 100644 index 00000000000..fef5323495e --- /dev/null +++ b/test/JDBC/input/functions/string_functions/trim-before-15_8-or-16_4-vu-cleanup.sql @@ -0,0 +1,77 @@ +DROP FUNCTION babel_4489_trim_itvf_func +GO + +DROP FUNCTION babel_4489_trim_dep_func +GO + +DROP PROCEDURE babel_4489_trim_dep_proc +GO + +DROP VIEW babel_4489_trim_dep_view +GO + +DROP VIEW babel_4489_trim_dep_view_1 +GO + +DROP VIEW babel_4489_trim_dep_view_2 +GO + +DROP VIEW babel_4489_trim_dep_view_3 +GO + +DROP VIEW babel_4489_trim_dep_view_4 +GO + +DROP VIEW babel_4489_trim_dep_view_5 +GO + +DROP VIEW babel_4489_trim_dep_view_6 +GO + +DROP TABLE babel_4489_trim_UDT +GO + +DROP TYPE dbo.babel_4489_trim_varUDT +GO + +DROP TYPE dbo.babel_4489_trim_imageUDT +GO + +DROP TABLE babel_4489_trim_text +GO + +DROP TABLE babel_4489_trim_image +GO + +DROP TABLE babel_4489_trim_arabic_ci_ai +GO + +DROP TABLE babel_4489_trim_arabic_cs_as +GO + +DROP TABLE babel_4489_trim_arabic_ci_as +GO + +DROP TABLE babel_4489_trim_chinese_prc_ci_ai +GO + +DROP TABLE babel_4489_trim_chinese_prc_cs_as +GO + +DROP TABLE babel_4489_trim_chinese_prc_ci_as +GO + +DROP TABLE babel_4489_trim_t5 +GO + +DROP TABLE babel_4489_trim_t4 +GO + +DROP TABLE babel_4489_trim_t3 +GO + +DROP TABLE babel_4489_trim_t2 +GO + +DROP TABLE babel_4489_trim_t1 +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/trim-before-15_8-or-16_4-vu-prepare.sql b/test/JDBC/input/functions/string_functions/trim-before-15_8-or-16_4-vu-prepare.sql new file mode 100644 index 00000000000..a771d12b4b0 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/trim-before-15_8-or-16_4-vu-prepare.sql @@ -0,0 +1,122 @@ +CREATE TABLE babel_4489_trim_t1(a NCHAR(50), b NCHAR(20)) +GO +INSERT INTO babel_4489_trim_t1 VALUES(N' abc🙂defghi🙂🙂 ', N'ab🙂 ') +INSERT INTO babel_4489_trim_t1 VALUES(N' 比尔·拉莫斯 ', N'比拉斯 ') +GO + +CREATE TABLE babel_4489_trim_t2(a NVARCHAR(50), b NVARCHAR(20)) +GO +INSERT INTO babel_4489_trim_t2 VALUES(N' abc🙂defghi🙂🙂 ', N'ab🙂 ') +GO + +CREATE TABLE babel_4489_trim_t3(a CHAR(50), b CHAR(20)) +GO +INSERT INTO babel_4489_trim_t3 VALUES(' abcdefghi ', 'abi ') +GO + +CREATE TABLE babel_4489_trim_t4(a VARCHAR(50), b VARCHAR(20)) +GO +INSERT INTO babel_4489_trim_t4 VALUES(' abcdefghi ', 'abi ') +GO + +CREATE TABLE babel_4489_trim_t5(a VARBINARY(50), b VARBINARY(50)) +GO +INSERT INTO babel_4489_trim_t5 VALUES(0x61626364, 0x6164) +GO + +CREATE TABLE babel_4489_trim_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4489_trim_chinese_prc_ci_as VALUES(N' 比尔·拉莫斯 ', N'比拉斯 ') +GO + +CREATE TABLE babel_4489_trim_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4489_trim_chinese_prc_cs_as VALUES(N' 比尔·拉莫斯 ', N'比拉斯 ') +GO + +CREATE TABLE babel_4489_trim_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI, b VARCHAR(20) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4489_trim_chinese_prc_ci_ai VALUES(N' 比尔·拉莫斯 ', N'比拉斯 ') +GO + +CREATE TABLE babel_4489_trim_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS, b VARCHAR(20) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4489_trim_arabic_ci_as VALUES(N' الله مع المتقين ', N'ين ') +GO + +CREATE TABLE babel_4489_trim_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS, b VARCHAR(20) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4489_trim_arabic_cs_as VALUES(N' الله مع المتقين ', N'ين ') +GO + +CREATE TABLE babel_4489_trim_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI, b VARCHAR(20) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4489_trim_arabic_ci_ai VALUES(N' الله مع المتقين ', N'ين ') +GO + +CREATE TABLE babel_4489_trim_image(a IMAGE) +GO +INSERT INTO babel_4489_trim_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_4489_trim_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4489_trim_text VALUES (N' abc🙂defghi🙂🙂 ', N' abc🙂defghi🙂🙂 ') +GO + +CREATE TYPE dbo.babel_4489_trim_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4489_trim_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4489_trim_UDT(a dbo.babel_4489_trim_imageUDT, b dbo.babel_4489_trim_varUDT) +GO +INSERT INTO babel_4489_trim_UDT VALUES(CAST('abcdef' as dbo.babel_4489_trim_imageUDT), CAST('abcdef' as dbo.babel_4489_trim_varUDT)) +GO + +CREATE VIEW babel_4489_trim_dep_view AS + SELECT ('|' + TRIM(b FROM a) + '|') as result FROM babel_4489_trim_t2 +GO + +CREATE PROCEDURE babel_4489_trim_dep_proc AS + SELECT ('|' + TRIM(b FROM a) + '|') as result FROM babel_4489_trim_t2 +GO + +CREATE FUNCTION babel_4489_trim_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 ('|' + TRIM(b FROM a) + '|') FROM babel_4489_trim_t2) +END +GO + +CREATE VIEW babel_4489_trim_dep_view_1 AS + SELECT ('|' + TRIM(a) + '|') as result FROM babel_4489_trim_t1 +GO + +CREATE VIEW babel_4489_trim_dep_view_2 AS + SELECT ('|' + TRIM(a) + '|') as result FROM babel_4489_trim_t2 +GO + +CREATE VIEW babel_4489_trim_dep_view_3 AS + SELECT ('|' + TRIM(a) + '|') as result FROM babel_4489_trim_t3 +GO + +CREATE VIEW babel_4489_trim_dep_view_4 AS + SELECT ('|' + TRIM(a) + '|') as result FROM babel_4489_trim_t4 +GO + +CREATE VIEW babel_4489_trim_dep_view_5 AS + SELECT ('|' + TRIM(a) + '|') as result FROM babel_4489_trim_t5 +GO + +CREATE VIEW babel_4489_trim_dep_view_6 AS + SELECT ('|' + TRIM(b FROM a) + '|') as result FROM babel_4489_trim_t4 +GO + +CREATE FUNCTION babel_4489_trim_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT ('|' + TRIM(b FROM a) + '|') as result FROM babel_4489_trim_t2) +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/trim-before-15_8-or-16_4-vu-verify.sql b/test/JDBC/input/functions/string_functions/trim-before-15_8-or-16_4-vu-verify.sql new file mode 100644 index 00000000000..00892e69363 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/trim-before-15_8-or-16_4-vu-verify.sql @@ -0,0 +1,619 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(50) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO + +-- NULL +SELECT TRIM(NULL) +GO + +SELECT TRIM(NULL FROM NULL) +GO + +SELECT TRIM('' FROM NULL) +GO + +SELECT TRIM(NULL FROM '') +GO + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab? ' FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂 ' FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab😎 ' FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab? ' FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂 ' FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab😎 ' FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_ci_as +GO + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_trim_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_cs_as +GO + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_trim_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_ci_ai +GO + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_trim_chinese_prc_ci_ai +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_ci_as +GO + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_trim_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_cs_as +GO + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_trim_arabic_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_ci_ai +GO + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_trim_arabic_ci_ai +GO + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' ab😎c🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂😎 ' FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +-- with table column of type nchar +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' ab😎c🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂😎 ' FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +-- dependent objects +SELECT * FROM babel_4489_trim_dep_view +GO + +EXEC babel_4489_trim_dep_proc +GO + +SELECT * FROM babel_4489_trim_dep_func() +GO + +SELECT * FROM babel_4489_trim_itvf_func() +GO + +SELECT * FROM babel_4489_trim_dep_view_1 +GO + +SELECT * FROM babel_4489_trim_dep_view_2 +GO + +SELECT * FROM babel_4489_trim_dep_view_3 +GO + +SELECT * FROM babel_4489_trim_dep_view_4 +GO + +SELECT * FROM babel_4489_trim_dep_view_5 +GO + +SELECT * FROM babel_4489_trim_dep_view_6 +GO + +-- different datatypes of inputString and charSet +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' ABCDEF ', @charSet BINARY(4) = 0x414243 +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARBINARY(50) = 0x41424344, @charSet VARBINARY(2) = 0x4144 +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +-- input type UDT +-- -- in table babel_4489_trim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT TRIM(a) FROM babel_4489_trim_UDT +GO + +SELECT TRIM(b) FROM babel_4489_trim_UDT +GO + +DECLARE @charSet VARCHAR(10) = 'ab' +SELECT TRIM(@charSet FROM a) FROM babel_4489_trim_UDT +GO + +DECLARE @charSet VARCHAR(10) = 'ab' +SELECT TRIM(@charSet FROM b) FROM babel_4489_trim_UDT +GO + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT TRIM('12' FROM @inputString) +GO + +DECLARE @inputString date = '2016-12-21', @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString date = '2016-12-21' +SELECT TRIM(@inputString FROM @inputString) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT TRIM(@inputString FROM @inputString) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT TRIM(@inputString FROM @inputString) +GO + +DECLARE @inputString time(4) = '12:10:05.1237', @charSet VARCHAR(10) = '10'; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT TRIM(@inputString FROM @inputString) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @charSet VARCHAR(10) = '23'; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRIM(@inputString FROM @inputString) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @charSet VARCHAR(10) = '23'; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRIM(@inputString FROM @inputString) +GO + +DECLARE @inputString decimal = 123456, @charSet decimal = 12; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString numeric = 12345.12, @charSet numeric = 12; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString float = 12345.1, @charSet float = 12; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString real = 12345.1, @charSet real = 12; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString bigint = 12345678, @charSet bigint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString int = 12345678, @charSet int = 12; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString smallint = 12356, @charSet smallint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString tinyint = 235, @charSet tinyint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString money = 12356, @charSet money = 12; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString smallmoney = 12356, @charSet smallmoney = 12; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString bit = 1, @charSet bit = 1; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM @inputString) +GO +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@inputString FROM @inputString) +GO + +SELECT TRIM(a FROM a) FROM babel_4489_trim_image; +GO + +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM a) from babel_4489_trim_image; +GO + +SELECT TRIM(a FROM b) FROM babel_4489_trim_text +GO +SELECT TRIM(b FROM a) FROM babel_4489_trim_text +GO + +DECLARE @charSet VARCHAR(20) = 'ab? ' +SELECT TRIM(@charSet FROM a) FROM babel_4489_trim_text +GO + +DECLARE @charSet VARCHAR(20) = 'ab? ' +SELECT TRIM(@charSet FROM b) FROM babel_4489_trim_text +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM @inputString) +GO +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@inputString FROM @inputString) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @charSet xml = CAST ('' AS xml); +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @charSet VARCHAR(10) = '(1 2)'; +SELECT TRIM(@charSet FROM @inputString) +GO +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @charSet VARCHAR(10) = '(1 2)'; +SELECT TRIM(@inputString FROM @inputString) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @charSet VARCHAR(10) = '2'; +SELECT TRIM(@charSet FROM @inputString) +GO +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @charSet VARCHAR(10) = '2'; +SELECT TRIM(@inputString FROM @inputString) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM CAST(@inputString AS VARCHAR(50))) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @charSet xml = CAST ('' AS xml); +SELECT TRIM(CAST(@charSet AS VARCHAR) FROM CAST(@inputString AS VARCHAR(50))) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @charSet VARCHAR(10) = '(1 2)'; +SELECT TRIM(@charSet FROM CAST(@inputString AS VARCHAR(50))) +GO diff --git a/test/JDBC/input/functions/string_functions/trim-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/trim-vu-cleanup.sql new file mode 100644 index 00000000000..fef5323495e --- /dev/null +++ b/test/JDBC/input/functions/string_functions/trim-vu-cleanup.sql @@ -0,0 +1,77 @@ +DROP FUNCTION babel_4489_trim_itvf_func +GO + +DROP FUNCTION babel_4489_trim_dep_func +GO + +DROP PROCEDURE babel_4489_trim_dep_proc +GO + +DROP VIEW babel_4489_trim_dep_view +GO + +DROP VIEW babel_4489_trim_dep_view_1 +GO + +DROP VIEW babel_4489_trim_dep_view_2 +GO + +DROP VIEW babel_4489_trim_dep_view_3 +GO + +DROP VIEW babel_4489_trim_dep_view_4 +GO + +DROP VIEW babel_4489_trim_dep_view_5 +GO + +DROP VIEW babel_4489_trim_dep_view_6 +GO + +DROP TABLE babel_4489_trim_UDT +GO + +DROP TYPE dbo.babel_4489_trim_varUDT +GO + +DROP TYPE dbo.babel_4489_trim_imageUDT +GO + +DROP TABLE babel_4489_trim_text +GO + +DROP TABLE babel_4489_trim_image +GO + +DROP TABLE babel_4489_trim_arabic_ci_ai +GO + +DROP TABLE babel_4489_trim_arabic_cs_as +GO + +DROP TABLE babel_4489_trim_arabic_ci_as +GO + +DROP TABLE babel_4489_trim_chinese_prc_ci_ai +GO + +DROP TABLE babel_4489_trim_chinese_prc_cs_as +GO + +DROP TABLE babel_4489_trim_chinese_prc_ci_as +GO + +DROP TABLE babel_4489_trim_t5 +GO + +DROP TABLE babel_4489_trim_t4 +GO + +DROP TABLE babel_4489_trim_t3 +GO + +DROP TABLE babel_4489_trim_t2 +GO + +DROP TABLE babel_4489_trim_t1 +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/trim-vu-prepare.sql b/test/JDBC/input/functions/string_functions/trim-vu-prepare.sql new file mode 100644 index 00000000000..a771d12b4b0 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/trim-vu-prepare.sql @@ -0,0 +1,122 @@ +CREATE TABLE babel_4489_trim_t1(a NCHAR(50), b NCHAR(20)) +GO +INSERT INTO babel_4489_trim_t1 VALUES(N' abc🙂defghi🙂🙂 ', N'ab🙂 ') +INSERT INTO babel_4489_trim_t1 VALUES(N' 比尔·拉莫斯 ', N'比拉斯 ') +GO + +CREATE TABLE babel_4489_trim_t2(a NVARCHAR(50), b NVARCHAR(20)) +GO +INSERT INTO babel_4489_trim_t2 VALUES(N' abc🙂defghi🙂🙂 ', N'ab🙂 ') +GO + +CREATE TABLE babel_4489_trim_t3(a CHAR(50), b CHAR(20)) +GO +INSERT INTO babel_4489_trim_t3 VALUES(' abcdefghi ', 'abi ') +GO + +CREATE TABLE babel_4489_trim_t4(a VARCHAR(50), b VARCHAR(20)) +GO +INSERT INTO babel_4489_trim_t4 VALUES(' abcdefghi ', 'abi ') +GO + +CREATE TABLE babel_4489_trim_t5(a VARBINARY(50), b VARBINARY(50)) +GO +INSERT INTO babel_4489_trim_t5 VALUES(0x61626364, 0x6164) +GO + +CREATE TABLE babel_4489_trim_chinese_prc_ci_as(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CI_AS) +GO +INSERT INTO babel_4489_trim_chinese_prc_ci_as VALUES(N' 比尔·拉莫斯 ', N'比拉斯 ') +GO + +CREATE TABLE babel_4489_trim_chinese_prc_cs_as(a VARCHAR(50) COLLATE CHINESE_PRC_CS_AS, b VARCHAR(20) COLLATE CHINESE_PRC_CS_AS) +GO +INSERT INTO babel_4489_trim_chinese_prc_cs_as VALUES(N' 比尔·拉莫斯 ', N'比拉斯 ') +GO + +CREATE TABLE babel_4489_trim_chinese_prc_ci_ai(a VARCHAR(50) COLLATE CHINESE_PRC_CI_AI, b VARCHAR(20) COLLATE CHINESE_PRC_CI_AI) +GO +INSERT INTO babel_4489_trim_chinese_prc_ci_ai VALUES(N' 比尔·拉莫斯 ', N'比拉斯 ') +GO + +CREATE TABLE babel_4489_trim_arabic_ci_as(a VARCHAR(50) COLLATE ARABIC_CI_AS, b VARCHAR(20) COLLATE ARABIC_CI_AS) +GO +INSERT INTO babel_4489_trim_arabic_ci_as VALUES(N' الله مع المتقين ', N'ين ') +GO + +CREATE TABLE babel_4489_trim_arabic_cs_as(a VARCHAR(50) COLLATE ARABIC_CS_AS, b VARCHAR(20) COLLATE ARABIC_CS_AS) +GO +INSERT INTO babel_4489_trim_arabic_cs_as VALUES(N' الله مع المتقين ', N'ين ') +GO + +CREATE TABLE babel_4489_trim_arabic_ci_ai(a VARCHAR(50) COLLATE ARABIC_CI_AI, b VARCHAR(20) COLLATE ARABIC_CI_AI) +GO +INSERT INTO babel_4489_trim_arabic_ci_ai VALUES(N' الله مع المتقين ', N'ين ') +GO + +CREATE TABLE babel_4489_trim_image(a IMAGE) +GO +INSERT INTO babel_4489_trim_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +CREATE TABLE babel_4489_trim_text(a TEXT, b NTEXT) +GO +INSERT INTO babel_4489_trim_text VALUES (N' abc🙂defghi🙂🙂 ', N' abc🙂defghi🙂🙂 ') +GO + +CREATE TYPE dbo.babel_4489_trim_imageUDT FROM image; +GO + +CREATE TYPE dbo.babel_4489_trim_varUDT FROM varchar(50); +GO + +CREATE TABLE babel_4489_trim_UDT(a dbo.babel_4489_trim_imageUDT, b dbo.babel_4489_trim_varUDT) +GO +INSERT INTO babel_4489_trim_UDT VALUES(CAST('abcdef' as dbo.babel_4489_trim_imageUDT), CAST('abcdef' as dbo.babel_4489_trim_varUDT)) +GO + +CREATE VIEW babel_4489_trim_dep_view AS + SELECT ('|' + TRIM(b FROM a) + '|') as result FROM babel_4489_trim_t2 +GO + +CREATE PROCEDURE babel_4489_trim_dep_proc AS + SELECT ('|' + TRIM(b FROM a) + '|') as result FROM babel_4489_trim_t2 +GO + +CREATE FUNCTION babel_4489_trim_dep_func() +RETURNS NVARCHAR(50) +AS +BEGIN +RETURN (SELECT TOP 1 ('|' + TRIM(b FROM a) + '|') FROM babel_4489_trim_t2) +END +GO + +CREATE VIEW babel_4489_trim_dep_view_1 AS + SELECT ('|' + TRIM(a) + '|') as result FROM babel_4489_trim_t1 +GO + +CREATE VIEW babel_4489_trim_dep_view_2 AS + SELECT ('|' + TRIM(a) + '|') as result FROM babel_4489_trim_t2 +GO + +CREATE VIEW babel_4489_trim_dep_view_3 AS + SELECT ('|' + TRIM(a) + '|') as result FROM babel_4489_trim_t3 +GO + +CREATE VIEW babel_4489_trim_dep_view_4 AS + SELECT ('|' + TRIM(a) + '|') as result FROM babel_4489_trim_t4 +GO + +CREATE VIEW babel_4489_trim_dep_view_5 AS + SELECT ('|' + TRIM(a) + '|') as result FROM babel_4489_trim_t5 +GO + +CREATE VIEW babel_4489_trim_dep_view_6 AS + SELECT ('|' + TRIM(b FROM a) + '|') as result FROM babel_4489_trim_t4 +GO + +CREATE FUNCTION babel_4489_trim_itvf_func() +RETURNS TABLE +AS +RETURN (SELECT ('|' + TRIM(b FROM a) + '|') as result FROM babel_4489_trim_t2) +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/string_functions/trim-vu-verify.sql b/test/JDBC/input/functions/string_functions/trim-vu-verify.sql new file mode 100644 index 00000000000..00892e69363 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/trim-vu-verify.sql @@ -0,0 +1,619 @@ +-- customer case, mentioned in the jira description +DECLARE @custname NVARCHAR(50) = N'比尔·拉莫斯' +SELECT @custname, + TRIM(@custname) as [TRIM] + , LTRIM(@custname) as [LTRIM] + , RTRIM(@custname) as [RTRIM] + , LEFT(@custname, 4) as [LEFT4] + , RIGHT(@custname, 4) as [RIGHT4] + , SUBSTRING(@custname, 2, 4) as [SUBSTRING_2_4] +; +GO + +-- NULL +SELECT TRIM(NULL) +GO + +SELECT TRIM(NULL FROM NULL) +GO + +SELECT TRIM('' FROM NULL) +GO + +SELECT TRIM(NULL FROM '') +GO + +-- input type char +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab? ' FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂 ' FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab😎 ' FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +-- input type varchar +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab? ' FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂 ' FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab😎 ' FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(10) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(MAX) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) COLLATE CHINESE_PRC_CI_AS + '|' +GO + +-- with table column of type varchar with collation chinese_prc_ci_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_ci_as +GO + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CI_AS + '|' FROM babel_4489_trim_chinese_prc_ci_as +GO + +-- with table column of type varchar with collation chinese_prc_cs_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_cs_as +GO + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CS_AS + '|' FROM babel_4489_trim_chinese_prc_cs_as +GO + +-- with table column of type varchar with collation chinese_prc_ci_ai +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_chinese_prc_ci_ai +GO + +SELECT '|' + TRIM(b FROM a) COLLATE CHINESE_PRC_CI_AI + '|' FROM babel_4489_trim_chinese_prc_ci_ai +GO + +-- with table column of type varchar with collation arabic_prc_ci_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_ci_as +GO + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CI_AS + '|' FROM babel_4489_trim_arabic_ci_as +GO + +-- with table column of type varchar with collation arabic_prc_cs_as +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_cs_as +GO + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CS_AS + '|' FROM babel_4489_trim_arabic_cs_as +GO + +-- with table column of type varchar with collation arabic_prc_ci_ai +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_arabic_ci_ai +GO + +SELECT '|' + TRIM(b FROM a) COLLATE ARABIC_CI_AI + '|' FROM babel_4489_trim_arabic_ci_ai +GO + +-- input type nchar +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' ab😎c🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂😎 ' FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +-- with table column of type nchar +SELECT '|' + TRIM(b FROM a) + '|' FROM babel_4489_trim_t1 +GO + +-- input type nvarchar +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ' +SELECT '|' + TRIM(@inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM(@inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' ab😎c🙂defghi🙂🙂 ' +SELECT '|' + TRIM('ab🙂😎 ' FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ' +SELECT '|' + TRIM('比拉斯 ' FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(MAX) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +-- dependent objects +SELECT * FROM babel_4489_trim_dep_view +GO + +EXEC babel_4489_trim_dep_proc +GO + +SELECT * FROM babel_4489_trim_dep_func() +GO + +SELECT * FROM babel_4489_trim_itvf_func() +GO + +SELECT * FROM babel_4489_trim_dep_view_1 +GO + +SELECT * FROM babel_4489_trim_dep_view_2 +GO + +SELECT * FROM babel_4489_trim_dep_view_3 +GO + +SELECT * FROM babel_4489_trim_dep_view_4 +GO + +SELECT * FROM babel_4489_trim_dep_view_5 +GO + +SELECT * FROM babel_4489_trim_dep_view_6 +GO + +-- different datatypes of inputString and charSet +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NVARCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @charSet NVARCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet CHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet CHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab? ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet VARCHAR(20) = 'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet VARCHAR(20) = '比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab🙂 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' abc🙂defghi🙂🙂 ', @charSet NCHAR(20) = N'ab😎 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @charSet NCHAR(20) = N'比拉斯 ' +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString NVARCHAR(50) = N' ABCDEF ', @charSet BINARY(4) = 0x414243 +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +DECLARE @inputString VARBINARY(50) = 0x41424344, @charSet VARBINARY(2) = 0x4144 +SELECT '|' + TRIM(@charSet FROM @inputString) + '|' +GO + +-- input type UDT +-- -- in table babel_4489_trim_UDT, col 'a' has basetype image and col 'b' has basetype varchar +SELECT TRIM(a) FROM babel_4489_trim_UDT +GO + +SELECT TRIM(b) FROM babel_4489_trim_UDT +GO + +DECLARE @charSet VARCHAR(10) = 'ab' +SELECT TRIM(@charSet FROM a) FROM babel_4489_trim_UDT +GO + +DECLARE @charSet VARCHAR(10) = 'ab' +SELECT TRIM(@charSet FROM b) FROM babel_4489_trim_UDT +GO + +-- other different datatypes, all of these should be blocked +DECLARE @inputString date = '2016-12-21' +SELECT TRIM('12' FROM @inputString) +GO + +DECLARE @inputString date = '2016-12-21', @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString date = '2016-12-21' +SELECT TRIM(@inputString FROM @inputString) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date, @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @date date = '12-21-16'; +DECLARE @inputString datetime = @date; +SELECT TRIM(@inputString FROM @inputString) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10', @charSet VARCHAR(10) = '12'; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; +SELECT TRIM(@inputString FROM @inputString) +GO + +DECLARE @inputString time(4) = '12:10:05.1237', @charSet VARCHAR(10) = '10'; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString time(4) = '12:10:05.1237'; +SELECT TRIM(@inputString FROM @inputString) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0', @charSet VARCHAR(10) = '23'; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT TRIM(@inputString FROM @inputString) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237', @charSet VARCHAR(10) = '23'; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT TRIM(@inputString FROM @inputString) +GO + +DECLARE @inputString decimal = 123456, @charSet decimal = 12; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString numeric = 12345.12, @charSet numeric = 12; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString float = 12345.1, @charSet float = 12; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString real = 12345.1, @charSet real = 12; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString bigint = 12345678, @charSet bigint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString int = 12345678, @charSet int = 12; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString smallint = 12356, @charSet smallint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString tinyint = 235, @charSet tinyint = 12; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString money = 12356, @charSet money = 12; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString smallmoney = 12356, @charSet smallmoney = 12; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString bit = 1, @charSet bit = 1; +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM @inputString) +GO +DECLARE @inputString UNIQUEIDENTIFIER = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS UNIQUEIDENTIFIER) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@inputString FROM @inputString) +GO + +SELECT TRIM(a FROM a) FROM babel_4489_trim_image; +GO + +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM a) from babel_4489_trim_image; +GO + +SELECT TRIM(a FROM b) FROM babel_4489_trim_text +GO +SELECT TRIM(b FROM a) FROM babel_4489_trim_text +GO + +DECLARE @charSet VARCHAR(20) = 'ab? ' +SELECT TRIM(@charSet FROM a) FROM babel_4489_trim_text +GO + +DECLARE @charSet VARCHAR(20) = 'ab? ' +SELECT TRIM(@charSet FROM b) FROM babel_4489_trim_text +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM @inputString) +GO +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@inputString FROM @inputString) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @charSet xml = CAST ('' AS xml); +SELECT TRIM(@charSet FROM @inputString) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @charSet VARCHAR(10) = '(1 2)'; +SELECT TRIM(@charSet FROM @inputString) +GO +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @charSet VARCHAR(10) = '(1 2)'; +SELECT TRIM(@inputString FROM @inputString) +GO + +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @charSet VARCHAR(10) = '2'; +SELECT TRIM(@charSet FROM @inputString) +GO +DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326), @charSet VARCHAR(10) = '2'; +SELECT TRIM(@inputString FROM @inputString) +GO + +DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +DECLARE @charSet VARCHAR(10) = '6F'; +SELECT TRIM(@charSet FROM CAST(@inputString AS VARCHAR(50))) +GO + +DECLARE @inputString xml = CAST ('' AS xml) +DECLARE @charSet xml = CAST ('' AS xml); +SELECT TRIM(CAST(@charSet AS VARCHAR) FROM CAST(@inputString AS VARCHAR(50))) +GO + +DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0), @charSet VARCHAR(10) = '(1 2)'; +SELECT TRIM(@charSet FROM CAST(@inputString AS VARCHAR(50))) +GO diff --git a/test/JDBC/input/functions/string_functions/upper_lower-before-15_8-or-16_4-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/upper_lower-before-15_8-or-16_4-vu-cleanup.sql new file mode 100644 index 00000000000..a6576612e7e --- /dev/null +++ b/test/JDBC/input/functions/string_functions/upper_lower-before-15_8-or-16_4-vu-cleanup.sql @@ -0,0 +1,46 @@ +DROP VIEW IF EXISTS dep_view_upper +GO +DROP TABLE IF EXISTS tab_arabic_ci_ai +GO +DROP TABLE IF EXISTS tab_arabic_ci_as +GO +DROP TABLE IF EXISTS tab_arabic_cs_as +GO +DROP TABLE IF EXISTS tab_chinese_ci_ai +GO +DROP TABLE IF EXISTS tab_chinese_ci_as +GO +DROP TABLE IF EXISTS tab_chinese_cs_as +GO +DROP PROCEDURE IF EXISTS dep_proc_upper +GO +DROP FUNCTION IF EXISTS dep_func_upper +GO +DROP VIEW IF EXISTS dep_view_lower +GO +DROP PROCEDURE IF EXISTS dep_proc_lower +GO +DROP VIEW IF EXISTS dep_view_upper_lower +GO +DROP PROCEDURE IF EXISTS dep_proc_upper_lower +GO +DROP VIEW IF EXISTS dep_view_upper_lower1 +GO +DROP PROCEDURE IF EXISTS dep_proc_upper_lower1 +GO +DROP FUNCTION IF EXISTS dep_func_lower +GO +DROP FUNCTION IF EXISTS tvp_func_upper_lower +GO +DROP TABLE IF EXISTS upper_lower_dt; +GO +DROP TABLE IF EXISTS upper_lower_text; +GO +DROP TABLE IF EXISTS upper_lower_ntext; +GO +DROP TABLE IF EXISTS upper_lower_image; +GO +DROP VIEW IF EXISTS dep_view_lower1; +GO +DROP TYPE IF EXISTS dbo.MyUDT; +GO diff --git a/test/JDBC/input/functions/string_functions/upper_lower-before-15_8-or-16_4-vu-prepare.sql b/test/JDBC/input/functions/string_functions/upper_lower-before-15_8-or-16_4-vu-prepare.sql new file mode 100644 index 00000000000..8f2c6f70c36 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/upper_lower-before-15_8-or-16_4-vu-prepare.sql @@ -0,0 +1,126 @@ +CREATE TABLE upper_lower_dt (a VARCHAR(20), b NVARCHAR(24), c CHAR(20), d NCHAR(24)) +GO +INSERT INTO upper_lower_dt(a,b,c,d) values(N'Anikait ', N'Agrawal ', N'Anikait ', N'Agrawal ') +GO +INSERT INTO upper_lower_dt(a,b,c,d) values(N' Anikait', N' Agrawal', N' Anikait', N' Agrawal') +GO +INSERT INTO upper_lower_dt(a,b,c,d) values(N' A',N' 🤣😃',N' A',N' 🤣😃') +GO +INSERT INTO upper_lower_dt(a,b,c,d) values(N' ',N' ',N' ',N' ') +GO +INSERT INTO upper_lower_dt(a,b,c,d) values(N'',N'',N'',N'') +GO +INSERT INTO upper_lower_dt(a,b,c,d) values(N'a',N'A',N'a',N'A') +GO +INSERT INTO upper_lower_dt(a,b,c,d) values(NULL,NULL,NULL,NULL) +GO +INSERT INTO upper_lower_dt(a, b, c, d) values(N'比尔·拉', N'比尔·拉', N'比尔·拉', N'比尔·拉') +GO + +CREATE TABLE upper_lower_text(a TEXT) +GO +INSERT INTO upper_lower_text values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS text)) +GO + +CREATE TABLE upper_lower_ntext(a NTEXT) +GO +INSERT INTO upper_lower_ntext values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS ntext)) +GO + +CREATE TABLE upper_lower_image(a IMAGE) +GO +INSERT INTO upper_lower_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +-- UPPER +CREATE VIEW dep_view_upper AS +select UPPER(a) AS upper_a, UPPER(b) AS upper_b, UPPER(c) AS upper_c, UPPER(d) AS upper_d from upper_lower_dt WHERE UPPER(a) = N'ANIKAIT' and UPPER(b) = N'AGRAWAL' and UPPER(c) = N'ANIKAIT' and UPPER(d) = N'AGRAWAL'; +GO + +CREATE TABLE tab_arabic_ci_ai(col varchar(20) COLLATE arabic_ci_ai); +INSERT INTO tab_arabic_ci_ai VALUES ('لقد'); +GO + +CREATE TABLE tab_arabic_ci_as(col varchar(20) COLLATE arabic_ci_as); +INSERT INTO tab_arabic_ci_as VALUES ('لقد'); +GO + +CREATE TABLE tab_arabic_cs_as(col varchar(20) COLLATE arabic_cs_as); +INSERT INTO tab_arabic_cs_as VALUES ('لقد'); +GO + +CREATE TABLE tab_chinese_ci_ai(col varchar(20) COLLATE chinese_prc_ci_ai); +INSERT INTO tab_chinese_ci_ai VALUES ('比尔·拉'); +GO + +CREATE TABLE tab_chinese_ci_as(col varchar(20) COLLATE chinese_prc_ci_as); +INSERT INTO tab_chinese_ci_as VALUES ('比尔·拉'); +GO + +CREATE TABLE tab_chinese_cs_as(col varchar(20) COLLATE chinese_prc_cs_as); +INSERT INTO tab_chinese_cs_as VALUES ('比尔·拉'); +GO + +CREATE PROC dep_proc_upper AS +select UPPER(a), UPPER(b), UPPER(c), UPPER(d) from upper_lower_dt WHERE UPPER(a) = N'ANIKAIT' and UPPER(b) = N'AGRAWAL' and UPPER(c) = N'ANIKAIT' and UPPER(d) = N'AGRAWAL'; +GO + +CREATE FUNCTION dbo.dep_func_upper() +RETURNS VARCHAR(50) +AS +BEGIN +RETURN (select TOP 1 UPPER(a) from upper_lower_dt); +END +GO + +CREATE VIEW dep_view_upper_lower AS +select UPPER(a) AS upper_a, LOWER(a) AS lower_a from upper_lower_text; +GO + +CREATE PROC dep_proc_upper_lower AS +select UPPER(a), LOWER(a) from upper_lower_text; +GO + +CREATE VIEW dep_view_upper_lower1 AS +select UPPER(a) AS upper_a, LOWER(a) AS lower_a from upper_lower_ntext; +GO + +CREATE PROC dep_proc_upper_lower1 AS +select UPPER(a), LOWER(a) from upper_lower_ntext; +GO + +-- LOWER +CREATE VIEW dep_view_lower AS +select LOWER(a) AS lower_a, LOWER(b) AS lower_b, LOWER(c) AS lower_c, LOWER(d) AS lower_d from upper_lower_dt WHERE LOWER(a) = N'anikait' and LOWER(b) = N'agrawal' and LOWER(c) = N'anikait' and LOWER(d) = N'agrawal'; +GO + +CREATE PROC dep_proc_lower AS +select LOWER(a), LOWER(b), LOWER(c), LOWER(d) from upper_lower_dt WHERE LOWER(a) = N'anikait' and LOWER(b) = N'agrawal' and LOWER(c) = N'anikait' and LOWER(d) = N'agrawal'; +GO + +CREATE FUNCTION dbo.dep_func_lower() +RETURNS VARCHAR(50) +AS +BEGIN +RETURN (select TOP 1 LOWER(a) from upper_lower_dt); +END +GO + +CREATE FUNCTION dbo.tvp_func_upper_lower() +RETURNS TABLE +AS +RETURN +( + SELECT CAST (UPPER(a) as VARCHAR) AS upper_a, CAST (LOWER(a) as VARCHAR) AS lower_a + FROM upper_lower_dt +); +GO + +CREATE VIEW dep_view_lower1 AS ( + select + lower(cast(N'ADJNFJH' as varchar(50))) as db1 + ); +GO + +CREATE TYPE dbo.MyUDT FROM image; +GO diff --git a/test/JDBC/input/functions/string_functions/upper_lower-before-15_8-or-16_4-vu-verify.sql b/test/JDBC/input/functions/string_functions/upper_lower-before-15_8-or-16_4-vu-verify.sql new file mode 100644 index 00000000000..5226b70f187 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/upper_lower-before-15_8-or-16_4-vu-verify.sql @@ -0,0 +1,259 @@ +DECLARE @class NCHAR(30) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE (@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'ANIKAIT AGRAWAL' +SELECT '[' + @class + ']' WHERE upper(@class) = N'Anikait Agrawal ' +SELECT '[' + @class + ']' WHERE lower(@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE lower(@class) = N'anikait agrawal' +SELECT '[' + @class + ']' WHERE lower(@class) = N'Anikait Agrawal ' +GO + +DECLARE @class CHAR(30) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE (@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'ANIKAIT AGRAWAL' +SELECT '[' + @class + ']' WHERE upper(@class) = N'Anikait Agrawal ' +SELECT '[' + @class + ']' WHERE lower(@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE lower(@class) = N'anikait agrawal' +SELECT '[' + @class + ']' WHERE lower(@class) = N'Anikait Agrawal ' +GO + +DECLARE @class NCHAR = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'ANIKAIT AGRAWAL' +SELECT '[' + @class + ']' WHERE lower(@class) = N'anikait agrawal' +GO + +DECLARE @class CHAR = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'ANIKAIT AGRAWAL' +SELECT '[' + @class + ']' WHERE lower(@class) = N'anikait agrawal' +GO + +-- different result from TSQL, should be fixed under BABEL-4807 +declare @string1 varchar(30) = N'比尔·拉' COLLATE chinese_prc_ci_as +SELECT UPPER(@string1) +SELECT UPPER(@string1) COLLATE chinese_prc_ci_as +SELECT LOWER(@string1) +SELECT LOWER(@string1) COLLATE chinese_prc_ci_as +go + +declare @string1 char(30) = N'比尔·拉' COLLATE chinese_prc_ci_as +SELECT '|' + UPPER(@string1) + '|' +SELECT '|' + UPPER(@string1) + '|' COLLATE chinese_prc_ci_as +SELECT '|' + LOWER(@string1) + '|' +SELECT '|' + LOWER(@string1) + '|' COLLATE chinese_prc_ci_as +go + +SELECT UPPER(NULL) +SELECT LOWER(NULL) +GO + +DECLARE @inputString BINARY(30) = 0x4142434445 +SELECT UPPER(@inputString) +SELECT LOWER(@inputString) +SELECT CONVERT(BINARY(50), UPPER(@inputString)); +SELECT CONVERT(BINARY(50), LOWER(@inputString)); +GO + +DECLARE @inputString VARBINARY(30) = 0x4142434445 +SELECT UPPER(@inputString) +SELECT LOWER(@inputString) +SELECT CONVERT(VARBINARY(50), UPPER(@inputString)); +SELECT CONVERT(VARBINARY(50), LOWER(@inputString)); +GO + +-- different result from TSQL, should be fixed under BABEL-4803 +declare @string1 nchar(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO + +-- different result from TSQL, should be fixed under BABEL-1664 +DECLARE @date date = '12-21-16'; +DECLARE @datetime datetime = @date; +SELECT UPPER(@datetime) +SELECT LOWER(@datetime) +GO + +-- different result from TSQL, should be fixed under BABEL-1664 +DECLARE @smalldatetime smalldatetime = '1955-12-13 12:43:10'; +SELECT UPPER(@smalldatetime) +SELECT LOWER(@smalldatetime) +GO + +DECLARE @date date = '2016-12-21'; +SELECT UPPER(@date) +SELECT LOWER(@date) +GO + +DECLARE @time time(4) = '12:10:05.1237'; +SELECT UPPER(@time) +SELECT LOWER(@time) +GO + +DECLARE @datetimeoffset datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT UPPER(@datetimeoffset) +SELECT LOWER(@datetimeoffset) +GO + +DECLARE @datetime2 datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT UPPER(@datetime2) +SELECT LOWER(@datetime2) +GO + +DECLARE @decimal decimal = 123; +SELECT UPPER(@decimal) +SELECT LOWER(@decimal) +GO + +DECLARE @numeric numeric = 12345.12; +SELECT UPPER(@numeric) +SELECT LOWER(@numeric) +GO + +DECLARE @float float = 12345.1; +SELECT UPPER(@float) +SELECT LOWER(@float) +GO + +DECLARE @real real = 12345.1; +SELECT UPPER(@real) +SELECT LOWER(@real) +GO + +DECLARE @bigint bigint = 2; +SELECT UPPER(@bigint) +SELECT LOWER(@bigint) +GO + +DECLARE @int int = 2; +SELECT UPPER(@int) +SELECT LOWER(@int) +GO + +DECLARE @smallint smallint = 2; +SELECT UPPER(@smallint) +SELECT LOWER(@smallint) +GO + +DECLARE @tinyint tinyint = 2; +SELECT UPPER(@tinyint) +SELECT LOWER(@tinyint) +GO + +DECLARE @money money = 2; +SELECT UPPER(@money) +SELECT LOWER(@money) +GO + +DECLARE @smallmoney smallmoney = 2; +SELECT UPPER(@smallmoney) +SELECT LOWER(@smallmoney) +GO + +DECLARE @bit bit = 1; +SELECT UPPER(@bit) +SELECT LOWER(@bit) +GO + +DECLARE @myid uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO + +DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO + +DECLARE @myid xml = CAST ('' AS xml) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO + +DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO + +DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO + +DECLARE @myid xml = CAST ('' AS xml) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO + +DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO + +Select UPPER(a), LOWER(a) from upper_lower_text +GO +Select UPPER(a), LOWER(a) from upper_lower_ntext +GO +Select UPPER(a), LOWER(a) from upper_lower_image +GO + +declare @string1 nvarchar(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO + +declare @string1 char(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO + +declare @string1 varchar(30) = N'比尔·拉'; +select UPPER(@string1) +select LOWER(@string1) +GO + +SELECT * from upper_lower_dt where UPPER(a) = N'Anikait'; +GO +SELECT * from upper_lower_dt where LOWER(c) = N'比尔·拉拉'; +GO + +SELECT * from dep_view_upper +GO +SELECT upper(col), lower(col) FROM tab_arabic_ci_ai; +GO +SELECT upper(col), lower(col) FROM tab_arabic_ci_as; +GO +SELECT upper(col), lower(col) FROM tab_arabic_cs_as; +GO +SELECT upper(col), lower(col) FROM tab_chinese_ci_ai; +GO +SELECT upper(col), lower(col) FROM tab_chinese_ci_as; +GO +SELECT upper(col), lower(col) FROM tab_chinese_cs_as; +GO +EXEC dep_proc_upper +GO +select dbo.dep_func_upper() +GO + +SELECT * from dep_view_lower +GO +EXEC dep_proc_lower +GO +SELECT * from dep_view_upper_lower +GO +EXEC dep_proc_upper_lower +GO +SELECT * from dep_view_upper_lower1 +GO +EXEC dep_proc_upper_lower1 +GO +select dbo.dep_func_lower() +GO +select dbo.tvp_func_upper_lower() +GO +SELECT * from dep_view_lower1 +GO +declare @b dbo.MyUDT = CAST('scsdc' AS dbo.MyUDT) +select upper(@b) +GO diff --git a/test/JDBC/input/functions/string_functions/upper_lower-vu-cleanup.sql b/test/JDBC/input/functions/string_functions/upper_lower-vu-cleanup.sql new file mode 100644 index 00000000000..a6576612e7e --- /dev/null +++ b/test/JDBC/input/functions/string_functions/upper_lower-vu-cleanup.sql @@ -0,0 +1,46 @@ +DROP VIEW IF EXISTS dep_view_upper +GO +DROP TABLE IF EXISTS tab_arabic_ci_ai +GO +DROP TABLE IF EXISTS tab_arabic_ci_as +GO +DROP TABLE IF EXISTS tab_arabic_cs_as +GO +DROP TABLE IF EXISTS tab_chinese_ci_ai +GO +DROP TABLE IF EXISTS tab_chinese_ci_as +GO +DROP TABLE IF EXISTS tab_chinese_cs_as +GO +DROP PROCEDURE IF EXISTS dep_proc_upper +GO +DROP FUNCTION IF EXISTS dep_func_upper +GO +DROP VIEW IF EXISTS dep_view_lower +GO +DROP PROCEDURE IF EXISTS dep_proc_lower +GO +DROP VIEW IF EXISTS dep_view_upper_lower +GO +DROP PROCEDURE IF EXISTS dep_proc_upper_lower +GO +DROP VIEW IF EXISTS dep_view_upper_lower1 +GO +DROP PROCEDURE IF EXISTS dep_proc_upper_lower1 +GO +DROP FUNCTION IF EXISTS dep_func_lower +GO +DROP FUNCTION IF EXISTS tvp_func_upper_lower +GO +DROP TABLE IF EXISTS upper_lower_dt; +GO +DROP TABLE IF EXISTS upper_lower_text; +GO +DROP TABLE IF EXISTS upper_lower_ntext; +GO +DROP TABLE IF EXISTS upper_lower_image; +GO +DROP VIEW IF EXISTS dep_view_lower1; +GO +DROP TYPE IF EXISTS dbo.MyUDT; +GO diff --git a/test/JDBC/input/functions/string_functions/upper_lower-vu-prepare.sql b/test/JDBC/input/functions/string_functions/upper_lower-vu-prepare.sql new file mode 100644 index 00000000000..72921a74c5a --- /dev/null +++ b/test/JDBC/input/functions/string_functions/upper_lower-vu-prepare.sql @@ -0,0 +1,126 @@ +CREATE TABLE upper_lower_dt (a VARCHAR(20), b NVARCHAR(24), c CHAR(20), d NCHAR(24)) +GO +INSERT INTO upper_lower_dt(a,b,c,d) values(N'Anikait ', N'Agrawal ', N'Anikait ', N'Agrawal ') +GO +INSERT INTO upper_lower_dt(a,b,c,d) values(N' Anikait', N' Agrawal', N' Anikait', N' Agrawal') +GO +INSERT INTO upper_lower_dt(a,b,c,d) values(N' A',N' 🤣😃',N' A',N' 🤣😃') +GO +INSERT INTO upper_lower_dt(a,b,c,d) values(N' ',N' ',N' ',N' ') +GO +INSERT INTO upper_lower_dt(a,b,c,d) values(N'',N'',N'',N'') +GO +INSERT INTO upper_lower_dt(a,b,c,d) values(N'a',N'A',N'a',N'A') +GO +INSERT INTO upper_lower_dt(a,b,c,d) values(NULL,NULL,NULL,NULL) +GO +INSERT INTO upper_lower_dt(a, b, c, d) values(N'比尔·拉', N'比尔·拉', N'比尔·拉', N'比尔·拉') +GO + +CREATE TABLE upper_lower_text(a TEXT) +GO +INSERT INTO upper_lower_text values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS text)) +GO + +CREATE TABLE upper_lower_ntext(a NTEXT) +GO +INSERT INTO upper_lower_ntext values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS ntext)) +GO + +CREATE TABLE upper_lower_image(a IMAGE) +GO +INSERT INTO upper_lower_image values(CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS image)) +GO + +-- UPPER +CREATE VIEW dep_view_upper AS +select UPPER(a) AS upper_a, UPPER(b) AS upper_b, UPPER(c) AS upper_c, UPPER(d) AS upper_d from upper_lower_dt WHERE UPPER(a) = N'ANIKAIT' and UPPER(b) = N'AGRAWAL' and UPPER(c) = N'ANIKAIT' and UPPER(d) = N'AGRAWAL'; +GO + +CREATE TABLE tab_arabic_ci_ai(col varchar(20) COLLATE arabic_ci_ai); +INSERT INTO tab_arabic_ci_ai VALUES ('لقد'); +GO + +CREATE TABLE tab_arabic_ci_as(col varchar(20) COLLATE arabic_ci_as); +INSERT INTO tab_arabic_ci_as VALUES ('لقد'); +GO + +CREATE TABLE tab_arabic_cs_as(col varchar(20) COLLATE arabic_cs_as); +INSERT INTO tab_arabic_cs_as VALUES ('لقد'); +GO + +CREATE TABLE tab_chinese_ci_ai(col varchar(20) COLLATE chinese_prc_ci_ai); +INSERT INTO tab_chinese_ci_ai VALUES ('比尔·拉'); +GO + +CREATE TABLE tab_chinese_ci_as(col varchar(20) COLLATE chinese_prc_ci_as); +INSERT INTO tab_chinese_ci_as VALUES ('比尔·拉'); +GO + +CREATE TABLE tab_chinese_cs_as(col varchar(20) COLLATE chinese_prc_cs_as); +INSERT INTO tab_chinese_cs_as VALUES ('比尔·拉'); +GO + +CREATE PROC dep_proc_upper AS +select UPPER(a), UPPER(b), UPPER(c), UPPER(d) from upper_lower_dt WHERE UPPER(a) = N'ANIKAIT' and UPPER(b) = N'AGRAWAL' and UPPER(c) = N'ANIKAIT' and UPPER(d) = N'AGRAWAL'; +GO + +CREATE FUNCTION dbo.dep_func_upper() +RETURNS VARCHAR(50) +AS +BEGIN +RETURN (select TOP 1 UPPER(a) from upper_lower_dt); +END +GO + +CREATE VIEW dep_view_upper_lower AS +select UPPER(a) AS upper_a, LOWER(a) AS lower_a from upper_lower_text; +GO + +CREATE PROC dep_proc_upper_lower AS +select UPPER(a), LOWER(a) from upper_lower_text; +GO + +CREATE VIEW dep_view_upper_lower1 AS +select UPPER(a) AS upper_a, LOWER(a) AS lower_a from upper_lower_ntext; +GO + +CREATE PROC dep_proc_upper_lower1 AS +select UPPER(a), LOWER(a) from upper_lower_ntext; +GO + +-- LOWER +CREATE VIEW dep_view_lower AS +select LOWER(a) AS lower_a, LOWER(b) AS lower_b, LOWER(c) AS lower_c, LOWER(d) AS lower_d from upper_lower_dt WHERE LOWER(a) = N'anikait' and LOWER(b) = N'agrawal' and LOWER(c) = N'anikait' and LOWER(d) = N'agrawal'; +GO + +CREATE PROC dep_proc_lower AS +select LOWER(a), LOWER(b), LOWER(c), LOWER(d) from upper_lower_dt WHERE LOWER(a) = N'anikait' and LOWER(b) = N'agrawal' and LOWER(c) = N'anikait' and LOWER(d) = N'agrawal'; +GO + +CREATE FUNCTION dbo.dep_func_lower() +RETURNS VARCHAR(50) +AS +BEGIN +RETURN (select TOP 1 LOWER(a) from upper_lower_dt); +END +GO + +CREATE FUNCTION dbo.tvp_func_upper_lower() +RETURNS TABLE +AS +RETURN +( + SELECT UPPER(a) AS upper_a, LOWER(a) AS lower_a + FROM upper_lower_dt +); +GO + +CREATE VIEW dep_view_lower1 AS ( + select + lower(cast(N'ADJNFJH' as varchar(50))) as db1 + ); +GO + +CREATE TYPE dbo.MyUDT FROM image; +GO diff --git a/test/JDBC/input/functions/string_functions/upper_lower-vu-verify.sql b/test/JDBC/input/functions/string_functions/upper_lower-vu-verify.sql new file mode 100644 index 00000000000..2dec99a1d82 --- /dev/null +++ b/test/JDBC/input/functions/string_functions/upper_lower-vu-verify.sql @@ -0,0 +1,263 @@ +DECLARE @class NCHAR(30) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE (@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'ANIKAIT AGRAWAL' +SELECT '[' + @class + ']' WHERE upper(@class) = N'Anikait Agrawal ' +SELECT '[' + @class + ']' WHERE lower(@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE lower(@class) = N'anikait agrawal' +SELECT '[' + @class + ']' WHERE lower(@class) = N'Anikait Agrawal ' +GO + +DECLARE @class CHAR(30) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE (@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'ANIKAIT AGRAWAL' +SELECT '[' + @class + ']' WHERE upper(@class) = N'Anikait Agrawal ' +SELECT '[' + @class + ']' WHERE lower(@class) = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE lower(@class) = N'anikait agrawal' +SELECT '[' + @class + ']' WHERE lower(@class) = N'Anikait Agrawal ' +GO + +DECLARE @class NCHAR = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'ANIKAIT AGRAWAL' +SELECT '[' + @class + ']' WHERE lower(@class) = N'anikait agrawal' +GO + +DECLARE @class CHAR = N'Anikait Agrawal' +SELECT '[' + @class + ']' WHERE upper(@class) = N'ANIKAIT AGRAWAL' +SELECT '[' + @class + ']' WHERE lower(@class) = N'anikait agrawal' +GO + +-- different result from TSQL, should be fixed under BABEL-4807 +declare @string1 varchar(30) = N'比尔·拉' COLLATE chinese_prc_ci_as +SELECT UPPER(@string1) +SELECT UPPER(@string1) COLLATE chinese_prc_ci_as +SELECT LOWER(@string1) +SELECT LOWER(@string1) COLLATE chinese_prc_ci_as +go + +declare @string1 char(30) = N'比尔·拉' COLLATE chinese_prc_ci_as +SELECT '|' + UPPER(@string1) + '|' +SELECT '|' + UPPER(@string1) + '|' COLLATE chinese_prc_ci_as +SELECT '|' + LOWER(@string1) + '|' +SELECT '|' + LOWER(@string1) + '|' COLLATE chinese_prc_ci_as +go + +SELECT UPPER(NULL) +SELECT LOWER(NULL) +GO + +DECLARE @inputString BINARY(30) = 0x4142434445 +SELECT UPPER(@inputString) +SELECT LOWER(@inputString) +SELECT CONVERT(BINARY(50), UPPER(@inputString)); +SELECT CONVERT(BINARY(50), LOWER(@inputString)); +GO + +DECLARE @inputString VARBINARY(30) = 0x4142434445 +SELECT UPPER(@inputString) +SELECT LOWER(@inputString) +SELECT CONVERT(VARBINARY(50), UPPER(@inputString)); +SELECT CONVERT(VARBINARY(50), LOWER(@inputString)); +GO + +-- different result from TSQL, should be fixed under BABEL-4803 +declare @string1 nchar(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO + +-- different result from TSQL, should be fixed under BABEL-1664 +DECLARE @date date = '12-21-16'; +DECLARE @datetime datetime = @date; +SELECT UPPER(@datetime) +SELECT LOWER(@datetime) +GO + +-- different result from TSQL, should be fixed under BABEL-1664 +DECLARE @smalldatetime smalldatetime = '1955-12-13 12:43:10'; +SELECT UPPER(@smalldatetime) +SELECT LOWER(@smalldatetime) +GO + +DECLARE @date date = '2016-12-21'; +SELECT UPPER(@date) +SELECT LOWER(@date) +GO + +DECLARE @time time(4) = '12:10:05.1237'; +SELECT UPPER(@time) +SELECT LOWER(@time) +GO + +DECLARE @datetimeoffset datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; +SELECT UPPER(@datetimeoffset) +SELECT LOWER(@datetimeoffset) +GO + +DECLARE @datetime2 datetime2(4) = '1968-10-23 12:45:37.1237'; +SELECT UPPER(@datetime2) +SELECT LOWER(@datetime2) +GO + +DECLARE @decimal decimal = 123; +SELECT UPPER(@decimal) +SELECT LOWER(@decimal) +GO + +DECLARE @numeric numeric = 12345.12; +SELECT UPPER(@numeric) +SELECT LOWER(@numeric) +GO + +DECLARE @float float = 12345.1; +SELECT UPPER(@float) +SELECT LOWER(@float) +GO + +DECLARE @real real = 12345.1; +SELECT UPPER(@real) +SELECT LOWER(@real) +GO + +DECLARE @bigint bigint = 2; +SELECT UPPER(@bigint) +SELECT LOWER(@bigint) +GO + +DECLARE @int int = 2; +SELECT UPPER(@int) +SELECT LOWER(@int) +GO + +DECLARE @smallint smallint = 2; +SELECT UPPER(@smallint) +SELECT LOWER(@smallint) +GO + +DECLARE @tinyint tinyint = 2; +SELECT UPPER(@tinyint) +SELECT LOWER(@tinyint) +GO + +DECLARE @money money = 2; +SELECT UPPER(@money) +SELECT LOWER(@money) +GO + +DECLARE @smallmoney smallmoney = 2; +SELECT UPPER(@smallmoney) +SELECT LOWER(@smallmoney) +GO + +DECLARE @bit bit = 1; +SELECT UPPER(@bit) +SELECT LOWER(@bit) +GO + +DECLARE @myid uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO + +DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO + +DECLARE @myid xml = CAST ('' AS xml) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO + +DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) +SELECT UPPER(@myid) +SELECT LOWER(@myid) +GO + +DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO + +DECLARE @myid xml = CAST ('' AS xml) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO + +DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) +SELECT UPPER(CAST (@myid AS VARCHAR)) +SELECT LOWER(CAST (@myid AS VARCHAR)) +GO + +Select UPPER(a), LOWER(a) from upper_lower_text +GO +Select UPPER(a), LOWER(a) from upper_lower_ntext +GO +Select UPPER(a), LOWER(a) from upper_lower_image +GO + +declare @string1 nvarchar(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO + +declare @string1 char(30) = N'比尔·拉'; +select '|' + UPPER(@string1) + '|' +select '|' + LOWER(@string1) + '|' +GO + +declare @string1 varchar(30) = N'比尔·拉'; +select UPPER(@string1) +select LOWER(@string1) +GO + +SELECT upper(a), lower(b), lower(c), upper(d) from upper_lower_dt; +GO +SELECT * from upper_lower_dt where UPPER(a) = N'Anikait'; +GO +SELECT * from upper_lower_dt where LOWER(c) = N'比尔·拉'; +GO +SELECT * from upper_lower_dt where LOWER(d) = N'比尔·拉'; +GO + +SELECT * from dep_view_upper +GO +SELECT upper(col), lower(col) FROM tab_arabic_ci_ai; +GO +SELECT upper(col), lower(col) FROM tab_arabic_ci_as; +GO +SELECT upper(col), lower(col) FROM tab_arabic_cs_as; +GO +SELECT upper(col), lower(col) FROM tab_chinese_ci_ai; +GO +SELECT upper(col), lower(col) FROM tab_chinese_ci_as; +GO +SELECT upper(col), lower(col) FROM tab_chinese_cs_as; +GO +EXEC dep_proc_upper +GO +select dbo.dep_func_upper() +GO + +SELECT * from dep_view_lower +GO +EXEC dep_proc_lower +GO +SELECT * from dep_view_upper_lower +GO +EXEC dep_proc_upper_lower +GO +SELECT * from dep_view_upper_lower1 +GO +EXEC dep_proc_upper_lower1 +GO +select dbo.dep_func_lower() +GO +select dbo.tvp_func_upper_lower() +GO +SELECT * from dep_view_lower1 +GO +declare @b dbo.MyUDT = CAST('scsdc' AS dbo.MyUDT) +select upper(@b) +GO diff --git a/test/JDBC/input/functions/sys-host_name-before-15_8-or-16_4-vu-cleanup.sql b/test/JDBC/input/functions/sys-host_name-before-15_8-or-16_4-vu-cleanup.sql new file mode 100644 index 00000000000..f26a20c06b2 --- /dev/null +++ b/test/JDBC/input/functions/sys-host_name-before-15_8-or-16_4-vu-cleanup.sql @@ -0,0 +1,26 @@ +DROP VIEW sys_host_name_vu_prepare__host_name_view +GO + +DROP FUNCTION sys_host_name_vu_prepare__host_name_func +GO + +DROP PROCEDURE sys_host_name_vu_prepare__host_name_proc +GO + +DROP VIEW sys_host_name_vu_prepare__dm_exec_connections_view +GO + +DROP FUNCTION sys_host_name_vu_prepare__dm_exec_connections_func +GO + +DROP PROCEDURE sys_host_name_vu_prepare__dm_exec_connections_proc +GO + +DROP VIEW sys_host_name_vu_prepare__dm_exec_sessions_view +GO + +DROP FUNCTION sys_host_name_vu_prepare__dm_exec_sessions_func +GO + +DROP PROCEDURE sys_host_name_vu_prepare__dm_exec_sessions_proc +GO \ No newline at end of file diff --git a/test/JDBC/input/functions/sys-host_name-before-15_8-or-16_4-vu-prepare.sql b/test/JDBC/input/functions/sys-host_name-before-15_8-or-16_4-vu-prepare.sql new file mode 100644 index 00000000000..c4153e6ca81 --- /dev/null +++ b/test/JDBC/input/functions/sys-host_name-before-15_8-or-16_4-vu-prepare.sql @@ -0,0 +1,42 @@ +CREATE VIEW sys_host_name_vu_prepare__host_name_view AS SELECT DISTINCT hostname FROM sys.sysprocesses WHERE spid = @@SPID +GO + +CREATE FUNCTION sys_host_name_vu_prepare__host_name_func(@pid int) +RETURNS TABLE +AS +RETURN (SELECT DISTINCT CAST(hostname as nvarchar(128)) FROM sys.sysprocesses WHERE spid = @pid); +GO + +CREATE PROCEDURE sys_host_name_vu_prepare__host_name_proc +AS +SELECT DISTINCT hostname FROM sys.sysprocesses WHERE spid = @@SPID +GO + +-- Create objects that relied on dependent functions that were modified +CREATE VIEW sys_host_name_vu_prepare__dm_exec_connections_view AS select net_transport, protocol_type, protocol_version, endpoint_id, encrypt_option from sys.dm_exec_connections where session_id = @@SPID +GO + +CREATE FUNCTION sys_host_name_vu_prepare__dm_exec_connections_func(@pid int) +RETURNS TABLE +AS +RETURN (select net_transport, protocol_type, protocol_version, endpoint_id, encrypt_option from sys.dm_exec_connections where session_id = @pid); +GO + +CREATE PROCEDURE sys_host_name_vu_prepare__dm_exec_connections_proc +AS +select net_transport, protocol_type, protocol_version, endpoint_id, encrypt_option from sys.dm_exec_connections where session_id = @@SPID +GO + +CREATE VIEW sys_host_name_vu_prepare__dm_exec_sessions_view AS select language, host_name, client_version, TRIM('0123456789.' FROM client_interface_name), program_name, date_format, date_first from sys.dm_exec_sessions where session_id = @@SPID +GO + +CREATE FUNCTION sys_host_name_vu_prepare__dm_exec_sessions_func(@pid int) +RETURNS TABLE +AS +RETURN (select language, host_name, client_version, TRIM('0123456789.' FROM client_interface_name), program_name, date_format, date_first from sys.dm_exec_sessions where session_id = @pid); +GO + +CREATE PROCEDURE sys_host_name_vu_prepare__dm_exec_sessions_proc +AS +select language, host_name, client_version, TRIM('0123456789.' FROM client_interface_name), program_name, date_format, date_first from sys.dm_exec_sessions where session_id = @@SPID +GO diff --git a/test/JDBC/input/functions/sys-host_name-before-15_8-or-16_4-vu-verify.mix b/test/JDBC/input/functions/sys-host_name-before-15_8-or-16_4-vu-verify.mix new file mode 100644 index 00000000000..6cab155c011 --- /dev/null +++ b/test/JDBC/input/functions/sys-host_name-before-15_8-or-16_4-vu-verify.mix @@ -0,0 +1,33 @@ +-- explicitly specify a workstation name to check the HOST_NAME +-- T-SQL function and hostname entry in sys.sysprocesses view + +-- tsql password=12345678;workstationID=a_nice_workstation_name +SELECT HOST_NAME() +GO + +SELECT * from sys_host_name_vu_prepare__host_name_func(@@SPID) +GO + +SELECT * FROM sys_host_name_vu_prepare__host_name_view +GO + +EXECUTE sys_host_name_vu_prepare__host_name_proc +GO + +SELECT * from sys_host_name_vu_prepare__dm_exec_connections_func(@@SPID) +GO + +SELECT * FROM sys_host_name_vu_prepare__dm_exec_connections_view +GO + +EXECUTE sys_host_name_vu_prepare__dm_exec_connections_proc +GO + +SELECT * from sys_host_name_vu_prepare__dm_exec_sessions_func(@@SPID) +GO + +SELECT * FROM sys_host_name_vu_prepare__dm_exec_sessions_view +GO + +EXECUTE sys_host_name_vu_prepare__dm_exec_sessions_proc +GO diff --git a/test/JDBC/input/login_token.mix b/test/JDBC/input/login_token.mix index 29f2f2985cf..e3abf1968b2 100644 --- a/test/JDBC/input/login_token.mix +++ b/test/JDBC/input/login_token.mix @@ -8,6 +8,12 @@ go create user login_token2; go +create role login_token_role +go + +alter role login_token_role add member login_token2 +go + create login login_token3 with password = '12345678' go @@ -39,6 +45,12 @@ select name, type, usage from sys.user_token order by name; go -- tsql +alter role login_token_role drop member login_token2 +go + +drop role login_token_role +go + drop user login_token2; go diff --git a/test/JDBC/input/openjson/BABEL-3820-vu-cleanup.sql b/test/JDBC/input/openjson/BABEL-3820-vu-cleanup.sql new file mode 100644 index 00000000000..e059909d60a --- /dev/null +++ b/test/JDBC/input/openjson/BABEL-3820-vu-cleanup.sql @@ -0,0 +1,33 @@ +drop procedure openjson_3820_p1 +go + +drop procedure openjson_3820_p2 +go + +drop procedure openjson_3820_p3 +go + +drop procedure openjson_3820_p4 +go + +drop procedure openjson_3820_p5 +go + +drop procedure openjson_3820_p6 +go + +drop procedure openjson_3820_p7 +go + +drop procedure openjson_3820_p8 +go + +drop procedure openjson_3820_p9 +go + + +drop procedure openjson_3820_p10 +go + +drop procedure openjson_3820_p11 +go \ No newline at end of file diff --git a/test/JDBC/input/openjson/BABEL-3820-vu-prepare.sql b/test/JDBC/input/openjson/BABEL-3820-vu-prepare.sql new file mode 100644 index 00000000000..4d0b0d5e386 --- /dev/null +++ b/test/JDBC/input/openjson/BABEL-3820-vu-prepare.sql @@ -0,0 +1,106 @@ +-- Test strict mode where path does not exist +-- Expect error +CREATE PROCEDURE openjson_3820_p1 +AS +BEGIN + SELECT * FROM OPENJSON('{}') WITH(field int 'strict$.field') +END; +GO + +-- Test lax mode where path does not exist +-- Expect empty result and no error +CREATE PROCEDURE openjson_3820_p2 +AS +BEGIN + DECLARE @json_p2 NVarChar(max)=N'{"someKey" : "someValue"}'; + SELECT * from OPENJSON(@json_p2,'$.somePathWhichDoesNotExists') WITH (id VARCHAR(100) '$') +END; +GO + +-- Test strict mode where path does not exist +-- Expect an error for no path +CREATE PROCEDURE openjson_3820_p3 +AS +BEGIN + DECLARE @json_p3 NVarChar(max)=N'{"someKey" : "someValue"}'; + SELECT * from OPENJSON(@json_p3,'strict $.somePathWhichDoesNotExists') WITH (id VARCHAR(100) '$') +END; +GO + +-- Test standard OPENJSON call +-- Expect result +CREATE PROCEDURE openjson_3820_p4 +AS +BEGIN + DECLARE @json_p4 NVarChar(max)=N'{"obj":{"a":1}}'; + SELECT * FROM OPENJSON(@json_p4, 'strict $.obj') WITH (a char(20)) +END; +GO + +-- Test strict mode where path does not exist +-- Expect error in strict mode +CREATE PROCEDURE openjson_3820_p5 +AS +BEGIN + SELECT * FROM OPENJSON(N'[{"Item": {"Price":2024.9940}}]') WITH(field int 'strict $.field') +END; +GO + +-- Test lax mode where path does not exist +-- Expect empty result because path does not exist +CREATE PROCEDURE openjson_3820_p6 +AS +BEGIN + DECLARE @json_p6 NVARCHAR(4000) = N'{"to":{"sub-object":["en-GB", "en-UK","de-AT","es-AR","sr-Cyrl"]}}'; + SELECT [key], value FROM OPENJSON(@json_p6,'lax$.path.to."sub-object"') +END; +GO + +-- Test OPENJSON strict call where path exists +-- Expect json result +CREATE PROCEDURE openjson_3820_p7 +AS +BEGIN + DECLARE @json_p7 NVARCHAR(4000) = N'{"path": {"to":{"sub-object":["en-GB", "en-UK","de-AT","es-AR","sr-Cyrl"]}}}'; + SELECT [key], value FROM OPENJSON(@json_p7,'strict $.path.to."sub-object"') +END; +GO + +-- Test OPENJSON strict call where path exists, strict is mixed case, +-- and no space between "strict" and the path. Expect json result +CREATE PROCEDURE openjson_3820_p8 +AS +BEGIN + DECLARE @json_p8 NVARCHAR(4000) = N'{"path": {"to":{"sub-object":["en-GB", "en-UK","de-AT","es-AR","sr-Cyrl"]}}}'; + SELECT [key], value FROM OPENJSON(@json_p8,'sTrIct$.path.to."sub-object"') +END; +GO + +-- Test OPENJSON strict with incorrect path +-- Expect error +CREATE PROCEDURE openjson_3820_p9 +AS +BEGIN + DECLARE @json_p9 NVARCHAR(4000) = N'{"to":{"sub-object":["en-GB", "en-UK","de-AT","es-AR","sr-Cyrl"]}}'; + SELECT [key], value FROM OPENJSON(@json_p9,'strict $.path.to."sub-object"') +END; +GO + +-- Test OPENJSON with incorrect path +-- Expect empty result +CREATE PROCEDURE openjson_3820_p10 +AS +BEGIN + DECLARE @json_p10 NVARCHAR(4000) = N'{"to":{"sub-object":["en-GB", "en-UK","de-AT","es-AR","sr-Cyrl"]}}'; + SELECT [key], value FROM OPENJSON(@json_p10,'$.path.to."sub-object"') +END; +GO + +-- Test strict mode where path does not exist +-- Expect error in strict mode +CREATE PROCEDURE openjson_3820_p11 +AS +BEGIN + SELECT * FROM OPENJSON(N'{}') WITH(field int 'strict $.field') +END; +GO \ No newline at end of file diff --git a/test/JDBC/input/openjson/BABEL-3820-vu-verify.sql b/test/JDBC/input/openjson/BABEL-3820-vu-verify.sql new file mode 100644 index 00000000000..114e569e6ef --- /dev/null +++ b/test/JDBC/input/openjson/BABEL-3820-vu-verify.sql @@ -0,0 +1,54 @@ +-- Test strict mode where path does not exist +-- Expect error +exec openjson_3820_p1 +go + +-- Test lax mode where path does not exist +-- Expect empty result and no error +exec openjson_3820_p2 +go + +-- Test strict mode where path does not exist +-- Expect an error for no path +exec openjson_3820_p3 +go + +-- Test standard OPENJSON call +-- Expect result +exec openjson_3820_p4 +go + +-- Test strict mode where path does not exist +-- Expect error in strict mode +exec openjson_3820_p5 +go + +-- Test lax mode where path does not exist +-- Expect empty result because path does not exist +exec openjson_3820_p6 +go + +-- Test OPENJSON strict call where path exists +-- Expect json result +exec openjson_3820_p7 +go + +-- Test OPENJSON strict call where path exists, strict is mixed case, +-- and no space between "strict" and the path. Expect json result +exec openjson_3820_p8 +go + +-- Test OPENJSON strict with incorrect path +-- Expect error +exec openjson_3820_p9 +go + +-- Test OPENJSON with incorrect path +-- Expect empty result +exec openjson_3820_p10 +go + +-- Test strict mode where path does not exist +-- Expect error in strict mode +exec openjson_3820_p11 +go \ No newline at end of file diff --git a/test/JDBC/input/output_into_fires_trigger.sql b/test/JDBC/input/output_into_fires_trigger.sql new file mode 100644 index 00000000000..181aedb9863 --- /dev/null +++ b/test/JDBC/input/output_into_fires_trigger.sql @@ -0,0 +1,295 @@ +-- Below statements will fire an after trigger +-- INSERT non local table OUTPUT ... INTO local table +-- UPDATE non local table OUTPUT ... INTO local table +-- DELETE non local table OUTPUT ... INTO local table + +-- REPEAT THE ABOVE INSIDE + -- PROCEDURE + -- TRIGGER + -- FUNCTION (functions should not be allowed to create for output to client or non local object) + +-- SOME MORE CASES OF OUTPUT CLAUSE WHICH SHOULD NOT BE ALLOWED INSIDE PLTSQL FUNCTIONS +-- OUTPUT TO CLIENT & OUTPUT INTO NON LOCAL OBJECT + + + +CREATE TABLE babel_4859_t (id INT) +GO + + +-- INSERT table OUTPUT ... INTO table variable +CREATE TRIGGER [dbo].[babel_4859_trigger_insert] + ON [dbo].[babel_4859_t] +AFTER INSERT +AS +SET NOCOUNT ON +SELECT 1; +GO + +DECLARE @babel_4859_tabvar TABLE (id INT); +INSERT INTO babel_4859_t OUTPUT INSERTED.id INTO @babel_4859_tabvar VALUES (4859), (9584), (2), (3) +GO + +-- UPDATE table OUTPUT ... INTO table variable +CREATE TRIGGER [dbo].[babel_4859_trigger_update] + ON [dbo].[babel_4859_t] +AFTER UPDATE +AS +SET NOCOUNT ON +SELECT 1; +GO + +DECLARE @babel_4859_tabvar TABLE (id INT, id_old INT); +UPDATE babel_4859_t SET id = 77 OUTPUT INSERTED.id, DELETED.id INTO @babel_4859_tabvar +GO + +-- DELETE table OUTPUT ... INTO table variable +CREATE TRIGGER [dbo].[babel_4859_trigger_delete] + ON [dbo].[babel_4859_t] +AFTER delete +AS +SET NOCOUNT ON +SELECT 1; +GO + +DECLARE @babel_4859_tabvar TABLE (id_old INT); +DELETE babel_4859_t OUTPUT DELETED.id INTO @babel_4859_tabvar +GO + +-- INSERT table OUTPUT ... INTO table variable INSIDE PROCEDURE +CREATE PROCEDURE babel_4859_p +AS +DECLARE @babel_4859_tabvar TABLE (id INT); +INSERT INTO babel_4859_t OUTPUT INSERTED.id INTO @babel_4859_tabvar VALUES (4859), (9584), (2), (3) +GO + +EXEC babel_4859_p +GO + +DROP PROC babel_4859_p +GO + +-- UPDATE table OUTPUT ... INTO table variable INSIDE PROCEDURE +CREATE PROCEDURE babel_4859_p +AS +DECLARE @babel_4859_tabvar TABLE (id INT, id_old INT); +UPDATE babel_4859_t SET id = 77 OUTPUT INSERTED.id, DELETED.id INTO @babel_4859_tabvar +GO + +EXEC babel_4859_p +GO + +DROP PROC babel_4859_p +GO + +-- DELETE table OUTPUT ... INTO table variable INSIDE PROCEDURE +CREATE PROCEDURE babel_4859_p +AS +DECLARE @babel_4859_tabvar TABLE (id_old INT); +DELETE babel_4859_t OUTPUT DELETED.id INTO @babel_4859_tabvar +GO + +EXEC babel_4859_p +GO + +DROP PROC babel_4859_p +GO + +CREATE TABLE babel_4859_t2 (id INT) +GO + +-- INSERT table OUTPUT ... INTO table variable INSIDE TRIGGER which will in turn fire another trigger +CREATE TRIGGER [dbo].[babel_4859_t2_trigger_insert] + ON [dbo].[babel_4859_t2] +AFTER INSERT +AS +SET NOCOUNT ON +DECLARE @babel_4859_tabvar TABLE (id INT); +INSERT INTO babel_4859_t OUTPUT INSERTED.id INTO @babel_4859_tabvar VALUES (4859), (9584), (2), (3) +SELECT * FROM @babel_4859_tabvar +GO + +INSERT INTO babel_4859_t2 VALUES (1) +GO + +DROP TRIGGER [dbo].[babel_4859_t2_trigger_insert] +GO + +-- UPDATE table OUTPUT ... INTO table variable INSIDE TRIGGER which will in turn fire another trigger +CREATE TRIGGER [dbo].[babel_4859_t2_trigger_insert] + ON [dbo].[babel_4859_t2] +AFTER INSERT +AS +SET NOCOUNT ON +DECLARE @babel_4859_tabvar TABLE (id INT, id_old INT); +UPDATE babel_4859_t SET id = 77 OUTPUT INSERTED.id, DELETED.id INTO @babel_4859_tabvar +SELECT * FROM @babel_4859_tabvar +GO + +INSERT INTO babel_4859_t2 VALUES (1) +GO + +DROP TRIGGER [dbo].[babel_4859_t2_trigger_insert] +GO + +-- DELETE table OUTPUT ... INTO table variable INSIDE TRIGGER which will in turn fire another trigger +CREATE TRIGGER [dbo].[babel_4859_t2_trigger_insert] + ON [dbo].[babel_4859_t2] +AFTER INSERT +AS +SET NOCOUNT ON +DECLARE @babel_4859_tabvar TABLE (id_old INT); +DELETE babel_4859_t OUTPUT DELETED.id INTO @babel_4859_tabvar +SELECT * FROM @babel_4859_tabvar +GO + +INSERT INTO babel_4859_t2 VALUES (1) +GO + +DROP TRIGGER [dbo].[babel_4859_t2_trigger_insert] +GO + + +-- INSERT table OUTPUT ... INTO table variable INSIDE FUNCTION +-- Should fail because inserting into non local object +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT); + INSERT INTO babel_4859_t OUTPUT INSERTED.id INTO @babel_4859_tabvar VALUES (4859), (9584), (2), (3) + RETURN 1 +END +GO + +-- UPDATE table OUTPUT ... INTO table variable INSIDE FUNCTION +-- Should fail because updating non local object +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT, id_old INT); + UPDATE babel_4859_t SET id = 77 OUTPUT INSERTED.id, DELETED.id INTO @babel_4859_tabvar + RETURN 1 +END +GO + +-- DELETE table OUTPUT ... INTO table variable INSIDE FUNCTION +-- Should fail because deleting from non local object +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id_old INT); + DELETE babel_4859_t OUTPUT DELETED.id INTO @babel_4859_tabvar + RETURN 1 +END +GO + + + +-- OUTPUT TO CLIENT SHOUD BE BLOCKED INSIDE FUNCTIONS +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT); + INSERT INTO @babel_4859_tabvar OUTPUT INSERTED.id VALUES (4859), (9584), (2), (3) + RETURN 1 +END +GO + +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT); + UPDATE @babel_4859_tabvar SET id = 77 OUTPUT INSERTED.id, DELETED.id + RETURN 1 +END +GO + +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT); + DELETE @babel_4859_tabvar OUTPUT DELETED.id + RETURN 1 +END +GO + + +-- OUTPUT INTO NON LOCAL OBJECTS SHOULD NOT BE ALLOWED INSIDE FUNCTIONS +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT); + INSERT INTO @babel_4859_tabvar OUTPUT INSERTED.id INTO babel_4859_t2 VALUES (4859), (9584), (2), (3) + RETURN 1 +END +GO + +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT); + UPDATE @babel_4859_tabvar SET id = 77 OUTPUT INSERTED.id INTO babel_4859_t2 + RETURN 1 +END +GO + +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT); + DELETE @babel_4859_tabvar OUTPUT DELETED.id INTO babel_4859_t2 + RETURN 1 +END +GO + +-- OUTPUT INTO LOCAL OBJECTS SHOULD BE ALLOWED INSIDE FUNCTIONS +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT); + DECLARE @babel_4859_tabvar_2 TABLE (id INT); + INSERT INTO @babel_4859_tabvar OUTPUT INSERTED.id INTO @babel_4859_tabvar_2 VALUES (4859), (9584), (2), (3) + RETURN 1 +END +GO +DROP FUNCTION babel_4859_f1 +GO + +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT); + DECLARE @babel_4859_tabvar_2 TABLE (id INT); + UPDATE @babel_4859_tabvar SET id = 77 OUTPUT INSERTED.id INTO @babel_4859_tabvar_2 + RETURN 1 +END +GO +DROP FUNCTION babel_4859_f1 +GO + +CREATE FUNCTION babel_4859_f1() +RETURNS INT +AS +BEGIN + DECLARE @babel_4859_tabvar TABLE (id INT); + DECLARE @babel_4859_tabvar_2 TABLE (id INT); + DELETE @babel_4859_tabvar OUTPUT DELETED.id INTO @babel_4859_tabvar_2 + RETURN 1 +END +GO +DROP FUNCTION babel_4859_f1 +GO + +DROP TABLE babel_4859_t, babel_4859_t2 +GO \ No newline at end of file diff --git a/test/JDBC/input/patindex-AI-collations.sql b/test/JDBC/input/patindex-AI-collations.sql new file mode 100644 index 00000000000..20099dc8579 --- /dev/null +++ b/test/JDBC/input/patindex-AI-collations.sql @@ -0,0 +1,515 @@ +-- BASIC TESTS + +-- [] wildcard single character to match or not match +SELECT PATINDEX('%[A-Z]%', 'a' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('%[A-Z]%', 'b' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('%[A-Z]%', 'z' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('[^A-Z]', 'z' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('[^A-Z]', 'A' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('[^A-Z]', 'b' COLLATE Latin1_General_CI_AI) +GO + +-- _ wildcard one single character to match +SELECT PATINDEX('_', 'b' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('%[A-Z]_[^A-Y]%', 'aBž' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('%aZď_[^A-Y]%', 'hqyÁzdjz' COLLATE Latin1_General_CI_AI) +GO + +-- _ wildcard one single character to match +SELECT PATINDEX('_', 'ě' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('%[A-Z]_[^A-Y]%', 'âBz' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('%aZď_[^A-Y]%', 'hqyâzdjż' COLLATE Latin1_General_CI_AI) +GO + +-- Basic Accent Insensitivity +DECLARE @testString NVARCHAR(100) = 'Café jalapeño'; +SELECT PATINDEX('%café%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 1 +SELECT PATINDEX('%jalapeno%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 6 +GO + +-- Mixed Case and Accent Sensitivity +DECLARE @testString NVARCHAR(100) = 'Résumé'; +SELECT PATINDEX('%résumé%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 1 +SELECT PATINDEX('%RESUME%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 1 +GO + +-- not found +DECLARE @testString NVARCHAR(100) = 'Example string'; +SELECT PATINDEX('%notfound%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 0 +GO + +-- pattern with special character +DECLARE @testString NVARCHAR(100) = 'Price: $100.00'; +SELECT PATINDEX('%$100%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 8 +SELECT PATINDEX('%100.00%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 9 +GO + +-- multiple occurrence +DECLARE @testString NVARCHAR(100) = 'Patterñ with pattern and another pattern'; +SELECT PATINDEX('%pattern%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 1 +GO +DECLARE @testString NVARCHAR(100) = 'patterPattèrn with pâttérn and another pattêrn'; +SELECT PATINDEX('%pattern%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 7 +GO + +-- empty null string +DECLARE @testString NVARCHAR(100) = ''; +DECLARE @nullString NVARCHAR(100) = NULL; +SELECT PATINDEX('%anything%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 0 +SELECT PATINDEX('%anything%', @nullString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: NULL +GO + +-- multiple wild cards +DECLARE @testString NVARCHAR(100) = 'Patteřn matching wiťh _ and % wildćards'; +-- `%` matches any sequence of characters +SELECT PATINDEX('%with %wildcards%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 18 +-- `_` matches exactly one character +SELECT PATINDEX('%with _ and %wildcards%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 18 +GO + + +-- Wildcard Combination in Patterns +DECLARE @testString NVARCHAR(100) = 'Example of pattérn matching wìth speciál cases'; +-- `%` and `_` used together +SELECT PATINDEX('%pattêrn%_wíth%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 11 + +-- Single `_` used in the middle +SELECT PATINDEX('%pattern _mátching%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 11 +GO + +-- consecutive wildcards +DECLARE @testString NVARCHAR(100) = 'Dàtá with multiplé %% wildcařds'; +-- Multiple `%` wildcards +SELECT PATINDEX('%multíple % wildcaṛds%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 9 +GO + +-- Leading and Trailing Wildcards +DECLARE @testString NVARCHAR(100) = 'Example ştriñAEg for tésting patterns'; +-- Wildcards at both ends +SELECT PATINDEX('%strińÆg for%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 9 +-- Wildcard in the middle +SELECT PATINDEX('%strińÆg%for%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 9 +GO + +-- Complex Pattern with Special Characters +DECLARE @testString NVARCHAR(100) = 'Price: $100.00 and $200.00'; +-- Pattern with special characters and wildcards +SELECT PATINDEX('%$100.00%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 8 +SELECT PATINDEX('%$%.00%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 8 (matches $100.00) +GO + +-- Wildcards with Mixed Case +DECLARE @testString NVARCHAR(100) = 'Case Insensitive Pattern Matching'; +-- Case-insensitive wildcard match +SELECT PATINDEX('%pattern matćhing%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 19 +GO + +-- Long String with Wildcard +DECLARE @testString NVARCHAR(MAX) = REPLICATE('Long text with many characters to téšt the páttAern matching functionality. ', 10); +-- Long string with wildcard pattern +SELECT PATINDEX('%teśt %the% pattÆrn%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: Position in the long text +GO + +-- Overlapping Patterns +DECLARE @testString NVARCHAR(100) = '123123123'; +-- Pattern where `%123%` is overlapping +SELECT PATINDEX('%123123%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 1 +GO + +-- Escaping Wildcards +DECLARE @testString NVARCHAR(100) = 'Special characters: % and _'; +-- Escaping `%` and `_` using a pattern that should match literally +SELECT PATINDEX('%[%]%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 19 (matching `%`) +SELECT PATINDEX('%[_]%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 30 (matching `_`) +GO + +-- Wildcard with Special Characters +DECLARE @testString NVARCHAR(100) = 'File name: dața_*.txt'; +-- Wildcard with special characters +SELECT PATINDEX('%dáta_%.ťxt%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 11 +GO + +-- Patterns with Trailing Wildcard and Special Characters +DECLARE @testString NVARCHAR(100) = 'Numbér: 12345-6789 and 98765-4321'; +SELECT PATINDEX('%12345-%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 10 +GO + + +-- Multiple wildcards and special characters +DECLARE @testString NVARCHAR(100) = '123-456_789*012'; +SELECT PATINDEX('%-456_789*%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 4 +GO + +-- Case and accent insensitivity with complex pattern +DECLARE @testString NVARCHAR(100) = 'Accénted words: café, résumé, jalapeño'; +SELECT PATINDEX('%café%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 18 +SELECT PATINDEX('%resume%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 25 +GO + +DECLARE @testString NVARCHAR(100) = 'Null and empty string patterns'; + +-- Null pattern +DECLARE @nullPattern NVARCHAR(100) = NULL; +SELECT PATINDEX(@nullPattern, @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 0 +-- Empty pattern +DECLARE @emptyPattern NVARCHAR(100) = ''; +SELECT PATINDEX(@emptyPattern, @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 1 +GO + +-- Nested wildcards +DECLARE @testString NVARCHAR(100) = 'Pattern example: a1b2c3d4e5'; +SELECT PATINDEX('%a1%b2%c3%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 1 (matches "a1b2c3") +SELECT PATINDEX('%a1_b2%c3_%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 1 (matches "a1b2c3") +GO + +-- Long pattern with multiple wildcards +DECLARE @testString NVARCHAR(100) = REPLICATE('X', 50) + 'ý' + REPLICATE('X', 50) + 'Ź' + REPLICATE('X', 50); +SELECT PATINDEX('%X%Y%Ż%', @testString COLLATE Latin1_General_CI_AI) AS Position; -- Expected: 51 (matches "Y" and "Z") +GO + + +-- Pattern with digit ranges +DECLARE @testString NVARCHAR(100) = 'Order numbers: 123, 456, 789'; +SELECT PATINDEX('%[1-3][0-9][0-9]%', @testString COLLATE Latin1_General_CI_AI) -- Expected: Match Found +GO + + +-- Pattern with letter ranges +DECLARE @testString NVARCHAR(100) = 'Alphabet sequence: âbC, ďEf, GħI'; +SELECT PATINDEX('%[A-C][A-C][A-C]%', @testString COLLATE Latin1_General_CI_AI) +GO + +-- Pattern with alphanumeric ranges +DECLARE @testString NVARCHAR(100) = 'Code rańges: Á1B2, C3D4, E5F6'; +SELECT PATINDEX('%[A-C][1-4][A-C][1-4]%', @testString COLLATE Latin1_General_CI_AI) +GO + +-- Pattern with special characters and ranges +DECLARE @testString NVARCHAR(100) = 'Special chárs: !@#, $%^, &*()'; +SELECT PATINDEX('%[!@#][$%^&][*()]%', @testString COLLATE Latin1_General_CI_AI) +GO + +SELECT PATINDEX('%àbćd%', ' ' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('%abcd%', 'xyz ' COLLATE Latin1_General_CI_AI) +GO + +SELECT PATINDEX(N'%[A-AE]%', N'Æ' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX(N'%[AE-E]%', N'Æ' COLLATE Latin1_General_CI_AI) +GO + +-- BASIC TESTS + +-- [] wildcard single character to match or not match +SELECT PATINDEX('%[A-Z]%', 'á' COLLATE Latin1_General_CS_AI) +SELECT PATINDEX('%[A-Z]%', 'b' COLLATE Latin1_General_CS_AI) +SELECT PATINDEX('%[A-Z]%', 'z' COLLATE Latin1_General_CS_AI) +SELECT PATINDEX('[^A-Z]', 'z' COLLATE Latin1_General_CS_AI) +SELECT PATINDEX('[^A-Z]', 'A' COLLATE Latin1_General_CS_AI) +SELECT PATINDEX('[^A-Z]', 'b' COLLATE Latin1_General_CS_AI) +GO + +-- _ wildcard one single character to match +SELECT PATINDEX('_', 'b' COLLATE Latin1_General_CS_AI) +SELECT PATINDEX('%[A-Ž]_[^À-Y]%', 'aBz' COLLATE Latin1_General_CS_AI) +SELECT PATINDEX('%áZď_[^Á-Y]%', 'hqyaždjž' COLLATE Latin1_General_CS_AI) +GO + +-- _ wildcard one single character to match +SELECT PATINDEX('_', 'b' COLLATE Latin1_General_CS_AI) +SELECT PATINDEX('%[A-Z]_[^A-Y]%', 'áBż' COLLATE Latin1_General_CS_AI) +SELECT PATINDEX('%aZď_[^A-Y]%', 'hqyazdjz' COLLATE Latin1_General_CS_AI) +GO + +-- Basic Accent Insensitivity +DECLARE @testString NVARCHAR(100) = 'Café jalapeño'; +SELECT PATINDEX('%café%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 1 +SELECT PATINDEX('%jalapeno%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 6 +GO + +-- Mixed Case and Accent Sensitivity +DECLARE @testString NVARCHAR(100) = 'Résumé'; +SELECT PATINDEX('%résumé%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 0 +SELECT PATINDEX('%RESUME%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 0 +SELECT PATINDEX('%Resume%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 1 +GO + +-- not found +DECLARE @testString NVARCHAR(100) = 'Example string'; +SELECT PATINDEX('%notfound%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 0 +SELECT PATINDEX('%Example String%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 0 +GO + +-- pattern with special character +DECLARE @testString NVARCHAR(100) = 'Price: $100.00'; +SELECT PATINDEX('%$100%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 8 +SELECT PATINDEX('%100.00%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 9 +GO + +-- multiple occurrence +DECLARE @testString NVARCHAR(100) = 'Pattern with páttern and another pattern'; +SELECT PATINDEX('%pattern%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 14 +GO +DECLARE @testString NVARCHAR(100) = 'patterPattern with pattern and another pattern'; +SELECT PATINDEX('%pattérn%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 20 +GO + +-- empty null string +DECLARE @testString NVARCHAR(100) = ''; +DECLARE @nullString NVARCHAR(100) = NULL; +SELECT PATINDEX('%anything%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 0 +SELECT PATINDEX('%anything%', @nullString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: NULL +GO + +-- multiple wild cards +DECLARE @testString NVARCHAR(100) = 'Pattern matching wìth _ and % wildcards'; +-- `%` matches any sequence of characters +SELECT PATINDEX('%witħ %wildçards%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 18 +-- `_` matches exactly one character +SELECT PATINDEX('%with _ and %wildcards%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 18 +GO + + +-- Wildcard Combination in Patterns +DECLARE @testString NVARCHAR(100) = 'Example of pattern matching with special cases'; +-- `%` and `_` used together +SELECT PATINDEX('%pattern%_with%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 11 + +-- Single `_` used in the middle +SELECT PATINDEX('%pattern _matching%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 11 +GO + +-- consecutive wildcards +DECLARE @testString NVARCHAR(100) = 'Data with multiple %% wildcards'; +-- Multiple `%` wildcards +SELECT PATINDEX('%multiple % wildcards%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 9 +GO + +-- Leading and Trailing Wildcards +DECLARE @testString NVARCHAR(100) = 'Example string for testing patterns'; +-- Wildcards at both ends +SELECT PATINDEX('%string for%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 9 +-- Wildcard in the middle +SELECT PATINDEX('%string%for%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 9 +GO + +-- Complex Pattern with Special Characters +DECLARE @testString NVARCHAR(100) = 'Price: $100.00 and $200.00'; +-- Pattern with special characters and wildcards +SELECT PATINDEX('%$100.00%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 8 +SELECT PATINDEX('%$%.00%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 8 (matches $100.00) +GO + +-- Wildcards with Mixed Case +DECLARE @testString NVARCHAR(100) = 'Case Insensitive Pattern Matching'; +-- Case-insensitive wildcard match +SELECT PATINDEX('%pattern matching%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 19 +GO + +-- Long String with Wildcard +DECLARE @testString NVARCHAR(MAX) = REPLICATE('Long text with many characters to tést the pattern matching functionality. ', 10); +-- Long string with wildcard pattern +SELECT PATINDEX('%teşt %thé% pattern%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: Position in the long text +GO + +-- Overlapping Patterns +DECLARE @testString NVARCHAR(100) = '123123123'; +-- Pattern where `%123%` is overlapping +SELECT PATINDEX('%123123%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 1 +GO + +-- Escaping Wildcards +DECLARE @testString NVARCHAR(100) = 'Special characters: % and _'; +-- Escaping `%` and `_` using a pattern that should match literally +SELECT PATINDEX('%[%]%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 19 (matching `%`) +SELECT PATINDEX('%[_]%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 30 (matching `_`) +GO + +-- Wildcard with Special Characters +DECLARE @testString NVARCHAR(100) = 'File name: data_*.txt'; +-- Wildcard with special characters +SELECT PATINDEX('%data_%.txt%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 11 +GO + +-- Patterns with Trailing Wildcard and Special Characters +DECLARE @testString NVARCHAR(100) = 'Number: 12345-6789 and 98765-4321'; +SELECT PATINDEX('%12345-%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 10 +GO + + +-- Multiple wildcards and special characters +DECLARE @testString NVARCHAR(100) = '123-456_789*012'; +SELECT PATINDEX('%-456_789*%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 4 +GO + +-- Case and accent insensitivity with complex pattern +DECLARE @testString NVARCHAR(100) = 'Accénted words: café, résumé, jalapeño'; +SELECT PATINDEX('%café%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 18 +SELECT PATINDEX('%resume%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 25 +GO + +DECLARE @testString NVARCHAR(100) = 'Null and empty string patterns'; + +-- Null pattern +DECLARE @nullPattern NVARCHAR(100) = NULL; +SELECT PATINDEX(@nullPattern, @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 0 +-- Empty pattern +DECLARE @emptyPattern NVARCHAR(100) = ''; +SELECT PATINDEX(@emptyPattern, @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 1 +GO + +-- Nested wildcards +DECLARE @testString NVARCHAR(100) = 'Pattern example: a1b2c3d4e5'; +SELECT PATINDEX('%a1%b2%c3%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 1 (matches "a1b2c3") +SELECT PATINDEX('%a1_b2%c3_%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 1 (matches "a1b2c3") +GO + +-- Long pattern with multiple wildcards +DECLARE @testString NVARCHAR(100) = REPLICATE('X', 50) + 'Ý' + REPLICATE('X', 50) + 'Z' + REPLICATE('X', 50); +SELECT PATINDEX('%X%Y%Z%', @testString COLLATE Latin1_General_CS_AI) AS Position; -- Expected: 51 (matches "Y" and "Z") +GO + + +-- Pattern with digit ranges +DECLARE @testString NVARCHAR(100) = 'Order numbers: 123, 456, 789'; +SELECT PATINDEX('%[1-3][0-9][0-9]%', @testString COLLATE Latin1_General_CS_AI) -- Expected: Match Found +GO + + +-- Pattern with letter ranges +DECLARE @testString NVARCHAR(100) = 'Alphabet sequence: ABĆ, DEF, GHI'; +SELECT PATINDEX('%[A-C][A-C][A-C]%', @testString COLLATE Latin1_General_CS_AI) +GO + +-- Pattern with alphanumeric ranges +DECLARE @testString NVARCHAR(100) = 'Code ranges: A1B2, C3D4, E5F6'; +SELECT PATINDEX('%[A-C][1-4][A-C][1-4]%', @testString COLLATE Latin1_General_CS_AI) +GO + +-- Pattern with special characters and ranges +DECLARE @testString NVARCHAR(100) = 'Special chars: !@#, $%^, &*()'; +SELECT PATINDEX('%[!@#][$%^&][*()]%', @testString COLLATE Latin1_General_CS_AI) +GO + +SELECT PATINDEX('%abćd%', ' ' COLLATE Latin1_General_CS_AI) +SELECT PATINDEX('%abcd%', 'xyz ' COLLATE Latin1_General_CS_AI) +GO + + +SELECT PATINDEX(N'%[a-ae]%', N'Æ' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX(N'%[A-AE]%', N'Æ' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX(N'%[ae-e]%', N'Æ' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX(N'%[AE-E]%', N'Æ' COLLATE Latin1_General_CI_AI) +GO + +SELECT PATINDEX(N'%[-AE]%', N'Æ' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX(N'%%', N'Æ' COLLATE Latin1_General_CI_AI) +GO + +SELECT PATINDEX('[a-', '[a-' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX('[a-]', '-' COLLATE Latin1_General_CI_AI) +GO + +CREATE TABLE #TestStrings ( + Id INT PRIMARY KEY, + TestText NVARCHAR(100) +); +GO + +INSERT INTO #TestStrings (Id, TestText) VALUES +(1, N'Çalışkan'), +(2, N'kalem'), +(3, N'KÜTÜPHANE'), +(4, N'Örnek'), +(5, N'çalışkan'), +(6, N'kalem'), +(7, N'öRnek'); +GO + +SELECT Id, TestText, + PATINDEX(N'%çalış%', TestText COLLATE Turkish_CI_AI) AS Position +FROM #TestStrings; +GO + +SELECT Id, TestText, + PATINDEX(N'%çalış%' COLLATE Turkish_CI_AI, TestText) AS Position +FROM #TestStrings; + +DROP TABLE #TestStrings +GO + +CREATE TABLE #TestStrings ( + Id INT PRIMARY KEY, + TestText NVARCHAR(100) COLLATE Turkish_CI_AI +); +GO + +INSERT INTO #TestStrings (Id, TestText) VALUES +(1, N'Çalışkan'), +(2, N'kalem'), +(3, N'KÜTÜPHANE'), +(4, N'Örnek'), +(5, N'çalışkan'), +(6, N'kalem'), +(7, N'öRnek'); +GO + +SELECT Id, TestText, + PATINDEX(N'%çalış%', TestText) AS Position +FROM #TestStrings; +GO + + +-- Computed columns +CREATE TABLE babel_5118_with_computed_col (pattern NVARCHAR(100), src NVARCHAR(100), patindex AS PATINDEX(pattern, src COLLATE Latin1_General_CS_AI)) +GO + +INSERT INTO babel_5118_with_computed_col (pattern, src) +VALUES + ('%[A-C][A-C][A-C]%', 'Alphabet sequence: ABĆ, DEF, GHI'), + ('%pattern%_with%', 'Example of pattern matching with special cases'), + ('_','b'); +GO + +-- Check constraints +ALTER TABLE babel_5118_with_computed_col ADD CONSTRAINT chkRowCount CHECK (PATINDEX(pattern, src COLLATE Latin1_General_CS_AI) >= 1); +GO + +INSERT INTO babel_5118_with_computed_col (pattern, src) VALUES ('_a','b'); +GO + +INSERT INTO babel_5118_with_computed_col (pattern, src) VALUES ('_','b'); +GO + +CREATE VIEW babel_5118_VIEW AS SELECT pattern, src, PATINDEX(pattern, src COLLATE Latin1_General_CS_AI) AS PATINDEX FROM babel_5118_with_computed_col ORDER BY pattern +GO + +SELECT * FROM babel_5118_VIEW +GO + +CREATE PROCEDURE babel_5118_with_proc +AS +SELECT pattern, src, PATINDEX(pattern, src COLLATE Latin1_General_CS_AI) AS PATINDEX FROM babel_5118_with_computed_col ORDER BY pattern +GO + +EXEC babel_5118_with_proc +GO + +DROP VIEW babel_5118_VIEW +GO + +DROP PROCEDURE babel_5118_with_proc +GO + +DROP TABLE babel_5118_with_computed_col +GO + +-- CONCAT INSIDE PATINDEX +SELECT PATINDEX(N'%[A-C]%_%[^A-Y]%Z%', CONCAT(REPEAT('b', 50), REPEAT('A', 50), REPEAT('Z', 50), REPEAT('Z', 50)) COLLATE Latin1_General_CI_AI) +GO + +-- Surrogate pair charcters +SELECT PATINDEX(N'%😀%', N'😀' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX(N'%Z%', N'ABC😀ZABC' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX(N'😀%', N'😀A' COLLATE Latin1_General_CI_AI) +SELECT PATINDEX(N'%D😀%', N'ABCD😀ABCD' COLLATE Latin1_General_CI_AI) +GO diff --git a/test/JDBC/input/psql_logical_babelfish_db.mix b/test/JDBC/input/psql_logical_babelfish_db.mix index 3d2035ad728..20e02e9b8ab 100644 --- a/test/JDBC/input/psql_logical_babelfish_db.mix +++ b/test/JDBC/input/psql_logical_babelfish_db.mix @@ -1,6 +1,7 @@ +-- sla 55000 -- psql -- check whether we can query system views before setting the GUC. Should return zero rows -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases'; +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go -- GUC should be NULL as it is not set yet @@ -16,7 +17,7 @@ show psql_logical_babelfish_db_name; go -- query system views. Should return metadata of master database -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases'; +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go -- set the GUC to an invalid database @@ -24,12 +25,12 @@ set psql_logical_babelfish_db_name = 'invalid_db' go -- should return zero rows as the database set does not exist -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases'; +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go -- tsql -- should return data of master as the current database is master -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go create database logical_database_db1 @@ -41,14 +42,14 @@ select set_config('psql_logical_babelfish_db_name', 'logical_database_db1', fals go -- should return data of master as the current database is master -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go use logical_database_db1 go -- should return data of logical_database_db1 as the current database is logical_database_db1 -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go create login logical_database_l1 with password = '12345678' @@ -58,14 +59,14 @@ alter server role sysadmin add member logical_database_l1 go -- psql user=logical_database_l1 password=12345678 -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases'; +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go -- any user can set the GUC set psql_logical_babelfish_db_name = 'logical_database_db1' go -select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases'; +select * from information_schema_tsql.columns where "TABLE_NAME"='sysdatabases' order by "COLUMN_NAME"; go -- psql diff --git a/test/JDBC/input/restrict_drop_user_role.mix b/test/JDBC/input/restrict_drop_user_role.mix new file mode 100644 index 00000000000..6bac8151435 --- /dev/null +++ b/test/JDBC/input/restrict_drop_user_role.mix @@ -0,0 +1,203 @@ +-- tsql +create login no_priv_login1 with password = '12345678' +go + +create role dont_drop_role +go + +create login no_priv_login2 with password = '12345678' +go + +create user no_priv_user2 for login no_priv_login2 +go + +create login no_priv_login3 with password = '12345678' +go + +create user no_priv_user3 for login no_priv_login3 +go + +create role no_priv_role3; +go + +create database restrict_user_db1 +go + +use restrict_user_db1 +go + +create role dont_drop_role +go + +create user no_priv_user1 for login no_priv_login1 +go + +use master +go + +-- case-1 - when current user is guest +-- permission denied +-- tsql user=no_priv_login1 password=12345678 +select current_user,db_name() +go + +drop role dont_drop_role +go + +drop user no_priv_user2 +go + +-- tsql +select current_user,db_name() +go + +create user no_priv_user1 for login no_priv_login1 +go + +-- case-2 - when current user has no privilege +-- permission denied +-- tsql user=no_priv_login1 password=12345678 +use master +go + +select current_user +go + +drop role dont_drop_role +go + +drop user no_priv_user2 +go + +-- case-3 - when current login has privilege +-- tsql + +-- 3.1 - when login is database owner +Alter authorization on database::restrict_user_db1 to no_priv_login2 +go + +-- allowed +-- tsql user=no_priv_login2 password=12345678 database=restrict_user_db1 +select current_user +go + +drop role dont_drop_role +go + +drop user no_priv_user1 +go + +-- error +-- try to drop non existing role/user +drop role fake_role +go + +drop user fake_user; +go + +drop user db +go + +drop role db_own +go + +drop user dbo_u1 +go + +drop role db_owner_r1 +go + +-- should deny +-- try to drop dbo user, db_owner role +drop role db_owner +go + +drop user dbo +go + + +create role dont_drop_role +go + +create user no_priv_user1 for login no_priv_login1 +go + +-- 3.2 - when login is sysadmin +-- allowed +-- tsql +drop user no_priv_user1 +go + +drop user no_priv_user2 +go + +drop role dont_drop_role +go + +-- 3.3 - when drop user/role has IF EXISTS clause +-- Should not throw error for the case where IF EXISTS clause is included +drop role if exists fake_role; +go + +drop user if exists fake_user; +go + +-- both of the following statements should be executed successfully since user/role exists +drop user if exists no_priv_user3; +go + +drop user if exists no_priv_role3; +go + +select count(*) from sys.database_principals where name like '%no_priv_%3'; +go + +-- 3.4 - Try dropping role created from PG role +-- psql +create role master_pguser1; +go + +-- tsql +drop user pguser1; +go + +drop role pguser1; +go + +-- it will still try to drop it, but permission denied will be generated since +-- bbf_role_admin won't have privilege to drop non-babelfish roles +drop user if exists pguser1; +go + +drop role if exists pguser1; +go + +-- psql +drop role master_pguser1; +go + +-- Need to terminate active session before cleaning up the login +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'no_priv_login1' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +go + + +-- tsql +drop login no_priv_login1 +go + +-- psql +-- Need to terminate active session before cleaning up the login +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'no_priv_login2' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +go + +-- tsql +drop login no_priv_login2 +go + +drop login no_priv_login3 +go + +drop database restrict_user_db1 +go \ No newline at end of file diff --git a/test/JDBC/input/restricted_procedures-vu-cleanup.mix b/test/JDBC/input/restricted_procedures-vu-cleanup.mix new file mode 100644 index 00000000000..98d7284510e --- /dev/null +++ b/test/JDBC/input/restricted_procedures-vu-cleanup.mix @@ -0,0 +1,87 @@ +REVOKE EXECUTE ON babel_4390_prepare_p1 TO guest; +GO + +REVOKE EXECUTE ON babel_4390_prepare_p3 TO guest; +GO + +REVOKE EXECUTE ON babel_4390_prepare_p4 TO guest; +GO + +REVOKE EXECUTE ON babel_4390_prepare_p5 TO guest; +GO + +REVOKE EXECUTE ON babel_4390_prepare_p6 TO guest; +GO + +REVOKE EXECUTE ON babel_4390_prepare_p7 TO guest; +GO + +REVOKE EXECUTE ON babel_4390_prepare_p8 TO guest; +GO + +REVOKE EXECUTE ON babel_4390_prepare_p9 TO guest; +GO + +DROP PROCEDURE IF EXISTS babel_4390_prepare_p1; +GO + +DROP PROCEDURE IF EXISTS babel_4390_prepare_p3; +GO + +DROP PROCEDURE IF EXISTS babel_4390_prepare_p4; +GO + +DROP PROCEDURE IF EXISTS babel_4390_prepare_p5; +GO + +DROP PROCEDURE IF EXISTS babel_4390_prepare_p6; +GO + +DROP PROCEDURE IF EXISTS babel_4390_prepare_p7; +GO + +DROP PROCEDURE IF EXISTS babel_4390_prepare_p8; +GO + +DROP PROCEDURE IF EXISTS babel_4390_prepare_p9; +GO + +-- tsql user=babel_4390_user_l1 password=abc +DROP PROCEDURE IF EXISTS babel_4390_test_schema_s1.xp_qv; +GO + +DROP PROCEDURE IF EXISTS babel_4390_test_schema_s1.sp_addlinkedsrvlogin; +GO + +-- tsql +DROP SCHEMA IF EXISTS babel_4390_test_schema_s1; +GO + +DROP USER IF EXISTS babel_4390_user_u1; +GO + +-- psql +-- Need to terminate active session before cleaning up the login +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'babel_4390_user_l1' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +GO + +-- Wait to sync with another session +SELECT pg_sleep(1); +GO + +-- Need to terminate active session before cleaning up the login +SELECT pg_terminate_backend(pid) FROM pg_stat_get_activity(NULL) +WHERE sys.suser_name(usesysid) = 'babel_4390_user_l2' AND backend_type = 'client backend' AND usesysid IS NOT NULL; +GO + +-- Wait to sync with another session +SELECT pg_sleep(1); +GO + +-- tsql +DROP LOGIN babel_4390_user_l1; +GO + +DROP LOGIN babel_4390_user_l2; +GO diff --git a/test/JDBC/input/restricted_procedures-vu-prepare.mix b/test/JDBC/input/restricted_procedures-vu-prepare.mix new file mode 100644 index 00000000000..2064f0cd1bf --- /dev/null +++ b/test/JDBC/input/restricted_procedures-vu-prepare.mix @@ -0,0 +1,97 @@ +CREATE LOGIN babel_4390_user_l1 WITH PASSWORD = '12345678'; +GO + +CREATE USER babel_4390_user_u1 FOR LOGIN babel_4390_user_l1; +GO + +CREATE SCHEMA babel_4390_test_schema_s1 AUTHORIZATION babel_4390_user_u1; +GO + +CREATE LOGIN babel_4390_user_l2 WITH PASSWORD = '12345678'; +GO + +-- tsql user=babel_4390_user_l1 password=12345678 +CREATE PROCEDURE babel_4390_test_schema_s1.xp_qv AS +BEGIN + SELECT 1; +END +GO + +CREATE PROCEDURE babel_4390_test_schema_s1.sp_addlinkedsrvlogin AS +BEGIN + SELECT 1; +END +GO + +-- tsql +CREATE PROCEDURE babel_4390_prepare_p1 AS +BEGIN + EXEC('DROP PROCEDURE dbo.xp_qv'); +END +GO + +CREATE PROCEDURE babel_4390_prepare_p3 AS +BEGIN + EXEC('DROP PROCEDURE dbo.xp_instance_regread(sys.nvarchar, sys.sysname, sys.nvarchar, int)'); +END +GO + +CREATE PROCEDURE babel_4390_prepare_p4 AS +BEGIN + EXEC('DROP PROCEDURE dbo.xp_instance_regread(sys.nvarchar, sys.sysname, sys.nvarchar, sys.nvarchar)'); +END +GO + +CREATE PROCEDURE babel_4390_prepare_p5 AS +BEGIN + EXEC('DROP PROCEDURE dbo.sp_addlinkedsrvlogin'); +END +GO + +CREATE PROCEDURE babel_4390_prepare_p6 AS +BEGIN + EXEC('DROP PROCEDURE dbo.sp_droplinkedsrvlogin'); +END +GO + +CREATE PROCEDURE babel_4390_prepare_p7 AS +BEGIN + EXEC('DROP PROCEDURE dbo.sp_dropserver'); +END +GO + +CREATE PROCEDURE babel_4390_prepare_p8 AS +BEGIN + EXEC('DROP PROCEDURE dbo.sp_enum_oledb_providers'); +END +GO + +CREATE PROCEDURE babel_4390_prepare_p9 AS +BEGIN + EXEC('DROP PROCEDURE dbo.sp_testlinkedserver'); +END +GO + +GRANT EXECUTE ON babel_4390_prepare_p1 TO guest; +GO + +GRANT EXECUTE ON babel_4390_prepare_p3 TO guest; +GO + +GRANT EXECUTE ON babel_4390_prepare_p4 TO guest; +GO + +GRANT EXECUTE ON babel_4390_prepare_p5 TO guest; +GO + +GRANT EXECUTE ON babel_4390_prepare_p6 TO guest; +GO + +GRANT EXECUTE ON babel_4390_prepare_p7 TO guest; +GO + +GRANT EXECUTE ON babel_4390_prepare_p8 TO guest; +GO + +GRANT EXECUTE ON babel_4390_prepare_p9 TO guest; +GO diff --git a/test/JDBC/input/restricted_procedures-vu-verify.mix b/test/JDBC/input/restricted_procedures-vu-verify.mix new file mode 100644 index 00000000000..2a83de57918 --- /dev/null +++ b/test/JDBC/input/restricted_procedures-vu-verify.mix @@ -0,0 +1,49 @@ +-- tsql +-- reset the login password +ALTER LOGIN babel_4390_user_l1 WITH PASSWORD = 'abc'; +GO + +ALTER LOGIN babel_4390_user_l2 WITH PASSWORD = 'abc'; +GO + +-- tsql user=babel_4390_user_l2 password=abc +-- should throw error +EXEC dbo.babel_4390_prepare_p1; +GO + +EXEC dbo.babel_4390_prepare_p3; +GO + +EXEC dbo.babel_4390_prepare_p4; +GO + +BEGIN TRANSACTION; +EXEC dbo.babel_4390_prepare_p1; +ROLLBACK; +GO + +DROP PROCEDURE dbo.xp_qv; +GO + +EXEC dbo.babel_4390_prepare_p5; +GO + +EXEC dbo.babel_4390_prepare_p6; +GO + +EXEC dbo.babel_4390_prepare_p7; +GO + +EXEC dbo.babel_4390_prepare_p8; +GO + +EXEC dbo.babel_4390_prepare_p9; +GO + +-- psql user=babel_4390_user_l2 password=abc +-- should throw error +DROP PROCEDURE master_dbo.xp_qv; +GO + +DROP PROCEDURE master_dbo.sp_addlinkedsrvlogin; +GO diff --git a/test/JDBC/input/restricting_function_overloading-vu-cleanup.sql b/test/JDBC/input/restricting_function_overloading-vu-cleanup.sql new file mode 100644 index 00000000000..93d72fac12f --- /dev/null +++ b/test/JDBC/input/restricting_function_overloading-vu-cleanup.sql @@ -0,0 +1,59 @@ +DROP FUNCTION IF EXISTS OverloadedFunction; +GO + +DROP FUNCTION IF EXISTS OverloadedFunction_2; +GO + +DROP FUNCTION IF EXISTS OverloadedFunction_3; +GO + +DROP FUNCTION IF EXISTS restrict_func_overloading_s1.overloaded_function; +GO + +DROP FUNCTION IF EXISTS restrict_func_overloading_s1.overloaded_object; +GO + +DROP FUNCTION IF EXISTS restrict_func_overloading_s2.overloaded_function; +GO + +DROP FUNCTION IF EXISTS dbo.overloaded_function; +GO + +DROP FUNCTION IF EXISTS dbo.to_date; +GO + +DROP FUNCTION IF EXISTS dbo.sysdatetime; +GO + +DROP FUNCTION IF EXISTS dbo.overloaded_function_f1; +GO + +DROP PROCEDURE IF EXISTS OverloadedObject; +GO + +DROP PROCEDURE IF EXISTS OverloadedFunction_1; +GO + +DROP PROCEDURE IF EXISTS OverloadedProcedure; +GO + +DROP PROCEDURE IF EXISTS restrict_func_overloading_s1.overloaded_proc; +GO + +DROP PROCEDURE IF EXISTS restrict_func_overloading_s2.overloaded_proc; +GO + +DROP PROCEDURE IF EXISTS dbo.overloaded_proc; +GO + +DROP PROCEDURE IF EXISTS dbo.sp_tables; +GO + +DROP TABLE IF EXISTS OverloadedObject; +GO + +DROP SCHEMA IF EXISTS restrict_func_overloading_s1; +GO + +DROP SCHEMA IF EXISTS restrict_func_overloading_s2; +GO \ No newline at end of file diff --git a/test/JDBC/input/restricting_function_overloading-vu-prepare.sql b/test/JDBC/input/restricting_function_overloading-vu-prepare.sql new file mode 100644 index 00000000000..0c3e326d300 --- /dev/null +++ b/test/JDBC/input/restricting_function_overloading-vu-prepare.sql @@ -0,0 +1,6 @@ +CREATE SCHEMA restrict_func_overloading_s1; +GO + +CREATE SCHEMA restrict_func_overloading_s2; +GO + diff --git a/test/JDBC/input/restricting_function_overloading.mix b/test/JDBC/input/restricting_function_overloading-vu-verify.mix similarity index 52% rename from test/JDBC/input/restricting_function_overloading.mix rename to test/JDBC/input/restricting_function_overloading-vu-verify.mix index cf57849f5a6..f9ffdef195b 100644 --- a/test/JDBC/input/restricting_function_overloading.mix +++ b/test/JDBC/input/restricting_function_overloading-vu-verify.mix @@ -9,9 +9,6 @@ GO CREATE PROCEDURE OverloadedFunction AS BEGIN SELECT 1 END GO -DROP FUNCTION OverloadedFunction; -GO - -- Overloaded function with same number of argument and same argument type CREATE PROCEDURE OverloadedFunction_1 @num1 INT AS BEGIN SELECT @num1 + 1 END GO @@ -22,9 +19,6 @@ GO CREATE FUNCTION OverloadedFunction_1(@num1 INT) RETURNS INT AS BEGIN RETURN @num1 + 2 END GO -DROP PROCEDURE OverloadedFunction_1; -GO - -- Overloaded procedures CREATE PROCEDURE OverloadedProcedure AS BEGIN SELECT 1 END GO @@ -32,9 +26,6 @@ GO CREATE PROCEDURE OverloadedProcedure @num1 INT AS BEGIN SELECT @num1 + 1 END GO -DROP PROCEDURE OverloadedProcedure; -GO - -- Objects with same name table, function and procedure CREATE TABLE OverloadedObject(a int); GO @@ -45,12 +36,6 @@ GO CREATE FUNCTION OverloadedObject(@num1 INT) RETURNS INT AS BEGIN RETURN @num1 + 1 END GO -DROP TABLE OverloadedObject; -GO - -DROP PROCEDURE OverloadedObject; -GO - -- Overloaded function with different number of arguments CREATE FUNCTION OverloadedFunction_2(@num1 INT) RETURNS INT AS BEGIN RETURN @num1 + 1 END GO @@ -61,9 +46,6 @@ GO CREATE PROCEDURE OverloadedFunction_2 AS BEGIN SELECT 1 END GO -DROP FUNCTION OverloadedFunction_2; -GO - -- Overloaded function with same number of arguments but different types CREATE FUNCTION OverloadedFunction_3(@num1 INT, @num2 INT) RETURNS INT AS BEGIN RETURN @num1 + @num2 END GO @@ -71,9 +53,6 @@ GO CREATE FUNCTION OverloadedFunction_3(@num1 INT, @num2 FLOAT) RETURNS INT AS BEGIN RETURN @num1 + @num2 END GO -DROP FUNCTION OverloadedFunction_3; -GO - -- psql -- Not restricting function overloading via PG port -- create Overloaded function with same number of arguments @@ -134,6 +113,23 @@ GO DROP FUNCTION OverloadedFunction(float, float); GO +SET search_path TO non_existent_schema, "$user", public; +GO + +CREATE OR REPLACE FUNCTION OverloadedFunction_f1() +RETURNS INT +AS +$$ +BEGIN +RETURN 1; +END; +$$ +LANGUAGE plpgsql; +GO + +SET search_path TO "$user", public; +GO + -- Overloaded procedures via PG port CREATE OR REPLACE PROCEDURE OverloadedProcedure(IN a FLOAT, IN b FLOAT, OUT c FLOAT) LANGUAGE plpgsql @@ -159,4 +155,84 @@ DROP PROCEDURE OverloadedProcedure(integer, integer); GO DROP PROCEDURE OverloadedProcedure(float, float); +GO + +-- tsql +-- Case 1: Function/Procedure Overloading in different schemas +CREATE FUNCTION restrict_func_overloading_s1.overloaded_function() RETURNS INT AS BEGIN RETURN 1; END; +GO + +CREATE FUNCTION restrict_func_overloading_s2.overloaded_function() RETURNS INT AS BEGIN RETURN 2; END; +GO + +SELECT restrict_func_overloading_s1.overloaded_function(); +GO + +SELECT restrict_func_overloading_s2.overloaded_function(); +GO + +CREATE PROCEDURE restrict_func_overloading_s1.overloaded_proc AS BEGIN SELECT 'restrict_func_overloading_s1'; END; +GO + +CREATE PROCEDURE restrict_func_overloading_s2.overloaded_proc AS BEGIN SELECT 'restrict_func_overloading_s2'; END; +GO + +EXEC restrict_func_overloading_s1.overloaded_proc; +GO + +EXEC restrict_func_overloading_s2.overloaded_proc; +GO + +-- Case 2: Function/Procedure Overloading in the same schema is not allowed +-- should throw error +CREATE FUNCTION restrict_func_overloading_s1.overloaded_function(@a INT) RETURNS INT AS BEGIN RETURN @a; END; +GO + +-- Case 3: Function/Procedure Creation Without specifying schema defaults to current schema i.e. dbo +CREATE FUNCTION overloaded_function() RETURNS INT AS BEGIN RETURN 4; END; +GO + +CREATE PROCEDURE overloaded_proc AS BEGIN SELECT 'overloaded proc'; END; +GO + +-- should return 4 +SELECT dbo.overloaded_function(); +GO + +EXEC dbo.overloaded_proc; +GO + +-- Case 4: Same object name during Function/Procedure creation is not allowed +CREATE FUNCTION restrict_func_overloading_s1.overloaded_object() RETURNS INT AS BEGIN RETURN 6; END; +GO + +-- should throw error since same name object already exist in the schema +CREATE PROCEDURE restrict_func_overloading_s1.overloaded_object AS BEGIN SELECT 'same object name'; END; +GO + +-- Case 5: Function/Procedure creation with name similar to sys or pg_catalog objects +-- creates function in default schema i.e. dbo +CREATE FUNCTION to_date() RETURNS INT AS BEGIN RETURN 1; END; +GO + +SELECT to_date(); +GO + +SELECT pg_catalog.to_date('20170103','YYYYMMDD'); +GO + +-- Case 6: When current default schema in the search path is invalid +SELECT CURRENT_SETTING('search_path'); +GO + +-- Making a non existent schema as current default schema +SELECT SET_CONFIG('search_path', 'master_non_existent_schema, master_dbo, "$user", sys, pg_catalog', false); +GO + +-- should create the function in next valid schema in the search path i.e. dbo +CREATE FUNCTION overloaded_function_f1() RETURNS INT AS BEGIN RETURN 1; END +GO + +-- Reset search path +SELECT SET_CONFIG('search_path', 'master_dbo, "$user", sys, pg_catalog', false); GO \ No newline at end of file diff --git a/test/JDBC/input/space-vu-cleanup.sql b/test/JDBC/input/space-vu-cleanup.sql new file mode 100644 index 00000000000..d6e4646bfd9 --- /dev/null +++ b/test/JDBC/input/space-vu-cleanup.sql @@ -0,0 +1,50 @@ +DROP FUNCTION babel_4811_vu_prepare_f1 +GO + +DROP FUNCTION babel_4811_vu_prepare_f2 +GO + +DROP FUNCTION babel_4811_vu_prepare_f3 +GO + +DROP PROCEDURE babel_4811_vu_prepare_p1 +GO + +DROP PROCEDURE babel_4811_vu_prepare_p2 +GO + +DROP VIEW babel_4811_vu_prepare_v1 +GO + +DROP VIEW babel_4811_vu_prepare_v2 +GO + +DROP VIEW babel_4811_vu_prepare_v3 +GO + +DROP VIEW babel_4811_vu_prepare_v4 +GO + +DROP VIEW babel_4811_vu_prepare_v5 +GO + +DROP VIEW babel_4811_vu_prepare_v6 +GO + +DROP VIEW babel_4811_vu_prepare_v7 +GO + +DROP VIEW babel_4811_vu_prepare_v8 +GO + +DROP VIEW babel_4811_vu_prepare_v9 +GO + +DROP TABLE babel_4811_vu_prepare_t1 +GO + +DROP TABLE babel_4811_vu_prepare_t2 +GO + +DROP TABLE babel_4811_vu_prepare_t3 +GO diff --git a/test/JDBC/input/space-vu-prepare.sql b/test/JDBC/input/space-vu-prepare.sql new file mode 100644 index 00000000000..f5abae77b39 --- /dev/null +++ b/test/JDBC/input/space-vu-prepare.sql @@ -0,0 +1,85 @@ +CREATE TABLE babel_4811_vu_prepare_t1(number int) +GO +INSERT INTO babel_4811_vu_prepare_t1 VALUES(5) +GO + +CREATE TABLE babel_4811_vu_prepare_t2(number int) +GO +INSERT INTO babel_4811_vu_prepare_t2 VALUES(-10) +GO + +CREATE TABLE babel_4811_vu_prepare_t3(number int) +GO +INSERT INTO babel_4811_vu_prepare_t3 VALUES(0) +GO + +CREATE FUNCTION babel_4811_vu_prepare_f1(@number int) +returns int +BEGIN + RETURN DATALENGTH(SPACE(@number)) +END +GO + +CREATE FUNCTION babel_4811_vu_prepare_f2(@number int) +returns varchar(20) +BEGIN + RETURN '|' + SPACE(@number) + '|' +END +GO + +CREATE FUNCTION babel_4811_vu_prepare_f3() +returns table +AS + RETURN (select '|' + SPACE(number) + '|' as result from babel_4811_vu_prepare_t1) +GO + +CREATE PROCEDURE babel_4811_vu_prepare_p1 (@number AS INT) +AS +BEGIN +SELECT DATALENGTH(SPACE(@number)) +END; +GO + +CREATE PROCEDURE babel_4811_vu_prepare_p2 (@number AS INT) +AS +BEGIN +SELECT '|' + SPACE(@number) + '|' AS result +END; +GO + +CREATE VIEW babel_4811_vu_prepare_v1 AS +SELECT DATALENGTH(SPACE(10)) as result +GO + + +CREATE VIEW babel_4811_vu_prepare_v2 AS +SELECT DATALENGTH(SPACE(0)) as result +GO + +CREATE VIEW babel_4811_vu_prepare_v3 AS +SELECT DATALENGTH(SPACE(-10)) as result +GO + +CREATE VIEW babel_4811_vu_prepare_v4 AS + SELECT DATALENGTH(SPACE(number)) as result FROM babel_4811_vu_prepare_t1 +GO + +CREATE VIEW babel_4811_vu_prepare_v5 AS + SELECT DATALENGTH(SPACE(number)) as result FROM babel_4811_vu_prepare_t2 +GO + +CREATE VIEW babel_4811_vu_prepare_v6 AS + SELECT DATALENGTH(SPACE(number)) as result FROM babel_4811_vu_prepare_t3 +GO + +CREATE VIEW babel_4811_vu_prepare_v7 AS +SELECT '|' + SPACE(10) + '|' AS result +GO + +CREATE VIEW babel_4811_vu_prepare_v8 AS +SELECT '|' + SPACE(0) + '|' AS result +GO + +CREATE VIEW babel_4811_vu_prepare_v9 AS +SELECT '|' + SPACE(-10) + '|' AS result +GO diff --git a/test/JDBC/input/space-vu-verify.sql b/test/JDBC/input/space-vu-verify.sql new file mode 100644 index 00000000000..b7541bcb89f --- /dev/null +++ b/test/JDBC/input/space-vu-verify.sql @@ -0,0 +1,108 @@ +-- test SPACE function +SELECT SPACE(NULL); +GO + +SELECT SPACE(2); +GO + +SELECT LEN(SPACE(5)); +GO + +SELECT DATALENGTH(SPACE(5)); +GO + +SELECT SPACE(-10); +GO + +SELECT SPACE(0); +GO + +SELECT LEN(SPACE(-10)); +GO + +SELECT DATALENGTH(SPACE(-10)); +GO + +SELECT LEN(SPACE(0)); +GO + +SELECT DATALENGTH(SPACE(0)); +GO + +-- INT_MAX +SELECT datalength(SPACE(2147483647)) +GO + +-- INT_MAX/2 +SELECT datalength(SPACE(1073741823)) +GO + +-- INT_MIN +SELECT datalength(SPACE(-2147483648)) +GO + +SELECT dbo.babel_4811_vu_prepare_f1(5); +GO + +SELECT dbo.babel_4811_vu_prepare_f1(-10); +GO + +SELECT dbo.babel_4811_vu_prepare_f1(0); +GO + +SELECT dbo.babel_4811_vu_prepare_f2(5); +GO + +SELECT dbo.babel_4811_vu_prepare_f2(-10); +GO + +SELECT dbo.babel_4811_vu_prepare_f2(0); +GO + +SELECT * from babel_4811_vu_prepare_f3(); +GO + +EXEC babel_4811_vu_prepare_p1 @number = 5; +GO + +EXEC babel_4811_vu_prepare_p1 @number = -10; +GO + +EXEC babel_4811_vu_prepare_p1 @number = 0; +GO + +EXEC babel_4811_vu_prepare_p2 @number = 5; +GO + +EXEC babel_4811_vu_prepare_p2 @number = -10; +GO + +EXEC babel_4811_vu_prepare_p2 @number = 0; +GO + +SELECT * from babel_4811_vu_prepare_v1; +GO + +SELECT * from babel_4811_vu_prepare_v2; +GO + +SELECT * from babel_4811_vu_prepare_v3; +GO + +SELECT * from babel_4811_vu_prepare_v4; +GO + +SELECT * from babel_4811_vu_prepare_v5; +GO + +SELECT * from babel_4811_vu_prepare_v6; +GO + +SELECT * from babel_4811_vu_prepare_v7; +GO + +SELECT * from babel_4811_vu_prepare_v8; +GO + +SELECT * from babel_4811_vu_prepare_v9; +GO diff --git a/test/JDBC/input/sql_variant/babel_datatype_sqlvariant-vu-prepare.sql b/test/JDBC/input/sql_variant/babel_datatype_sqlvariant-vu-prepare.sql index 83423e512a7..59751947059 100644 --- a/test/JDBC/input/sql_variant/babel_datatype_sqlvariant-vu-prepare.sql +++ b/test/JDBC/input/sql_variant/babel_datatype_sqlvariant-vu-prepare.sql @@ -541,4 +541,4 @@ insert into babel_4036_t2(a, c, e) values(3, cast(-0.123456789012345678901234567 go insert into babel_4036_t2(a, c, e) values(4, cast(-99999999999999999999999999999999999999 as decimal(38,0)), 'abc'); -go +go \ No newline at end of file diff --git a/test/JDBC/input/sql_variant/babel_datatype_sqlvariant-vu-verify.sql b/test/JDBC/input/sql_variant/babel_datatype_sqlvariant-vu-verify.sql index c19f1287e38..f090d426237 100644 --- a/test/JDBC/input/sql_variant/babel_datatype_sqlvariant-vu-verify.sql +++ b/test/JDBC/input/sql_variant/babel_datatype_sqlvariant-vu-verify.sql @@ -239,4 +239,4 @@ select * from babel_4036_t1 order by a; go select * from babel_4036_t2 order by a; -go +go \ No newline at end of file diff --git a/test/JDBC/input/storedProcedures/Test-sp_rename-vu-cleanup.sql b/test/JDBC/input/storedProcedures/Test-sp_rename-vu-cleanup.sql index 795e51e371b..6b0c9cd260e 100644 --- a/test/JDBC/input/storedProcedures/Test-sp_rename-vu-cleanup.sql +++ b/test/JDBC/input/storedProcedures/Test-sp_rename-vu-cleanup.sql @@ -66,4 +66,7 @@ DROP TYPE sp_rename_vu_schema1.sp_rename_vu_tabletype1_schema1_new; GO DROP SCHEMA sp_rename_vu_schema1; -GO \ No newline at end of file +GO + +DROP VIEW babelfish_split_identifier_view; +GO diff --git a/test/JDBC/input/storedProcedures/Test-sp_rename-vu-prepare.sql b/test/JDBC/input/storedProcedures/Test-sp_rename-vu-prepare.sql index 91590694301..09d689fc9ab 100644 --- a/test/JDBC/input/storedProcedures/Test-sp_rename-vu-prepare.sql +++ b/test/JDBC/input/storedProcedures/Test-sp_rename-vu-prepare.sql @@ -98,4 +98,14 @@ CREATE TYPE sp_rename_vu_alias1 FROM VARCHAR(11) NOT NULL; GO CREATE TYPE sp_rename_vu_schema1.sp_rename_vu_alias1 FROM VARCHAR(11) NOT NULL; -GO \ No newline at end of file +GO + +-- Dependency test for function babelfish_split_identifier +-- Create a view which depends upon babelfish_split_identifier function only +-- if the function exists. +IF OBJECT_ID('sys.babelfish_split_identifier') IS NOT NULL +BEGIN + EXEC sp_executesql N' + CREATE VIEW babelfish_split_identifier_view AS SELECT * FROM sys.babelfish_split_identifier(''ABC.DEF.GHI'')'; +END +GO diff --git a/test/JDBC/input/storedProcedures/Test-sp_rename-vu-verify.sql b/test/JDBC/input/storedProcedures/Test-sp_rename-vu-verify.sql index 8541c8ff649..44c2fc27001 100644 --- a/test/JDBC/input/storedProcedures/Test-sp_rename-vu-verify.sql +++ b/test/JDBC/input/storedProcedures/Test-sp_rename-vu-verify.sql @@ -403,3 +403,13 @@ GO -- Statistics EXEC sp_rename 'sp_rename_vu_stat1', 'sp_rename_vu_stat2', 'STATISTICS'; GO + +IF OBJECT_ID('babelfish_split_identifier_view') IS NULL +BEGIN + EXEC sp_executesql N' + CREATE VIEW babelfish_split_identifier_view AS SELECT * FROM sys.babelfish_split_identifier(''ABC.DEF.GHI'')'; +END +GO + +SELECT * FROM babelfish_split_identifier_view; +GO diff --git a/test/JDBC/input/sys-server_principals-vu-prepare.mix b/test/JDBC/input/sys-server_principals-vu-prepare.mix index d4cc8b37efc..87a99ff4181 100644 --- a/test/JDBC/input/sys-server_principals-vu-prepare.mix +++ b/test/JDBC/input/sys-server_principals-vu-prepare.mix @@ -3,4 +3,7 @@ CREATE LOGIN sys_server_principals_vu_login_without_sa with password = '123' GO CREATE LOGIN sys_server_principals_vu_login_with_sa with password = '123' +GO + +CREATE LOGIN [public] WITH PASSWORD = 'test'; GO \ No newline at end of file diff --git a/test/JDBC/input/sys-server_principals-vu-verify.mix b/test/JDBC/input/sys-server_principals-vu-verify.mix index ad5fd70e39f..2b0e8224aa0 100644 --- a/test/JDBC/input/sys-server_principals-vu-verify.mix +++ b/test/JDBC/input/sys-server_principals-vu-verify.mix @@ -15,6 +15,11 @@ FROM sys.server_principals WHERE name = 'sysadmin'; GO +SELECT name, type, type_desc, default_database_name, default_language_name, credential_id, owning_principal_id, is_fixed_role +FROM sys.server_principals +WHERE name = 'public'; +GO + -- server_principals view should not show internal role bbf_role_admin SELECT name, type, type_desc, default_database_name, default_language_name, credential_id, owning_principal_id, is_fixed_role FROM sys.server_principals diff --git a/test/JDBC/input/temp_tables/temp_table.sql b/test/JDBC/input/temp_tables/temp_table.sql new file mode 100644 index 00000000000..50603b2bc45 --- /dev/null +++ b/test/JDBC/input/temp_tables/temp_table.sql @@ -0,0 +1,48 @@ +-- BABEL-4912 test ALTER TABLE for temp tables +CREATE TABLE #t1 (a INT IDENTITY PRIMARY KEY NOT NULL, b INT) +GO + +INSERT INTO #t1 (b) values (1) +GO + +SELECT * FROM #t1 +GO + +ALTER TABLE #t1 DROP COLUMN b +GO + +SELECT * FROM #t1 +GO + +ALTER TABLE #t1 ADD b varchar(20) +GO + +SELECT * FROM #t1 +GO + +ALTER TABLE #t1 ADD c AS a + 1 +GO + +SELECT * FROM #t1 +GO + +ALTER TABLE #t1 DROP COLUMN a +GO + +SELECT * FROM #t1 +GO + +ALTER TABLE #t1 DROP COLUMN b +GO + +SELECT * FROM #t1 +GO + +ALTER TABLE #t1 DROP COLUMN c +GO + +SELECT * FROM #t1 +GO + +DROP TABLE #t1 +GO diff --git a/test/JDBC/input/temp_tables/temp_table_rollback-vu-verify.sql b/test/JDBC/input/temp_tables/temp_table_rollback-vu-verify.sql index ba99ebd2f3f..d8bc7e02c5c 100644 --- a/test/JDBC/input/temp_tables/temp_table_rollback-vu-verify.sql +++ b/test/JDBC/input/temp_tables/temp_table_rollback-vu-verify.sql @@ -79,7 +79,7 @@ COMMIT GO ---------------------------------------------------------- --- ALTER TABLE (should fail due to BABEL-4912) +-- ALTER TABLE (BABEL-4912) ---------------------------------------------------------- CREATE TABLE #temp_table_rollback_t1 (a int, b int) GO @@ -95,12 +95,12 @@ ROLLBACK GO BEGIN TRAN -ALTER TABLE #temp_table_rollback_t1 DROP COLUMN b +ALTER TABLE #temp_table_rollback_t1 ALTER COLUMN b VARCHAR COMMIT GO BEGIN TRAN -ALTER TABLE #temp_table_rollback_t1 ALTER COLUMN b VARCHAR +ALTER TABLE #temp_table_rollback_t1 DROP COLUMN b COMMIT GO diff --git a/test/JDBC/input/test_search_path.sql b/test/JDBC/input/test_search_path.sql new file mode 100644 index 00000000000..fed3ae0501c --- /dev/null +++ b/test/JDBC/input/test_search_path.sql @@ -0,0 +1,152 @@ +CREATE TABLE babelfish_migration_mode_table (id_num INT IDENTITY(1,1), mig_mode VARCHAR(10)) +GO +INSERT INTO babelfish_migration_mode_table SELECT current_setting('babelfishpg_tsql.migration_mode') +GO + +-- test multi-db mode +SELECT set_config('role', 'jdbc_user', false); +GO +SELECT set_config('babelfishpg_tsql.migration_mode', 'multi-db', false); +GO + +-- check if correct schema is present in search path +CREATE DATABASE ["BABEL_5111.db"] +GO + +CREATE DATABASE ["龙漫远; 龍漫遠.¢£€¥"] +GO + +use ["BABEL_5111.db"] +GO + +CREATE TABLE t1(a int) +GO + +SELECT current_setting('search_path') +GO + +CREATE SCHEMA ["BABEL_5111.scm"] +GO + +CREATE TABLE ["BABEL_5111.scm"].t1(a int) +GO + +CREATE VIEW ["BABEL_5111.scm"].v1 AS SELECT 1 +GO + +CREATE PROCEDURE ["BABEL_5111.scm"].p1 AS SELECT 1 +GO + +CREATE TRIGGER ["BABEL_5111.scm"].BABEL_5111_trgger1 on ["BABEL_5111.scm"].t1 AFTER INSERT AS BEGIN END +GO + +ALTER TABLE ["BABEL_5111.scm"].t1 ENABLE TRIGGER BABEL_5111_trgger1 +GO + +USE ["龙漫远; 龍漫遠.¢£€¥"] +GO + +CREATE TABLE t1(a int) +GO + +SELECT current_setting('search_path') +GO + +CREATE SCHEMA ["BABEL_5111.😃😄😉😊"] +GO + +CREATE TABLE ["BABEL_5111.😃😄😉😊"].t1(a int) +GO + +CREATE VIEW ["BABEL_5111.😃😄😉😊"].v1 AS SELECT 1 +GO + +CREATE PROCEDURE ["BABEL_5111.😃😄😉😊"].p1 AS SELECT 1 +GO + +CREATE TRIGGER ["BABEL_5111.😃😄😉😊"].BABEL_5111_trgger1 on ["BABEL_5111.😃😄😉😊"].t1 AFTER INSERT AS BEGIN END +GO + +ALTER TABLE ["BABEL_5111.😃😄😉😊"].t1 ENABLE TRIGGER BABEL_5111_trgger1 +GO + +USE master +GO + +EXEC ["BABEL_5111.db"].["BABEL_5111.scm"].p1 +GO + +SELECT * from ["BABEL_5111.db"].["BABEL_5111.scm"].t1 +GO + +SELECT * from ["BABEL_5111.db"].["BABEL_5111.scm"].v1 +GO + +EXEC ["龙漫远; 龍漫遠.¢£€¥"].["BABEL_5111.😃😄😉😊"].p1 +GO + +SELECT * from ["龙漫远; 龍漫遠.¢£€¥"].["BABEL_5111.😃😄😉😊"].t1 +GO + +SELECT * from ["龙漫远; 龍漫遠.¢£€¥"].["BABEL_5111.😃😄😉😊"].v1 +GO + +use ["BABEL_5111.db"] +GO + +DROP PROCEDURE ["BABEL_5111.scm"].p1 +GO + +DROP TRIGGER ["BABEL_5111.scm"].BABEL_5111_trgger1 +GO + +DROP VIEW ["BABEL_5111.scm"].v1 +GO + +DROP TABLE ["BABEL_5111.scm"].t1 +GO + +DROP SCHEMA ["BABEL_5111.scm"] +GO + +DROP TABLE t1 +GO + +USE ["龙漫远; 龍漫遠.¢£€¥"] +GO + +DROP PROCEDURE ["BABEL_5111.😃😄😉😊"].p1 +GO + +DROP TRIGGER ["BABEL_5111.😃😄😉😊"].BABEL_5111_trgger1 +GO + +DROP VIEW ["BABEL_5111.😃😄😉😊"].v1 +GO + +DROP TABLE ["BABEL_5111.😃😄😉😊"].t1 +GO + +DROP SCHEMA ["BABEL_5111.😃😄😉😊"] +GO + +USE master +GO + +DROP DATABASE ["BABEL_5111.db"] +GO + +DROP DATABASE ["龙漫远; 龍漫遠.¢£€¥"] +GO + +SELECT set_config('role', 'jdbc_user', false); +GO + +-- Reset migration mode to default +DECLARE @mig_mode VARCHAR(10) +SET @mig_mode = (SELECT mig_mode FROM babelfish_migration_mode_table WHERE id_num = 1) +SELECT CASE WHEN (SELECT set_config('babelfishpg_tsql.migration_mode', @mig_mode, false)) IS NOT NULL THEN 1 ELSE 0 END +GO + +Drop Table IF EXISTS babelfish_migration_mode_table +GO \ No newline at end of file diff --git a/test/JDBC/input/views/sys-columns-dep-vu-prepare.sql b/test/JDBC/input/views/sys-columns-dep-vu-prepare.sql index 2c26bacb227..eaa416eea8a 100644 --- a/test/JDBC/input/views/sys-columns-dep-vu-prepare.sql +++ b/test/JDBC/input/views/sys-columns-dep-vu-prepare.sql @@ -2,11 +2,11 @@ create table sys_columns_dep_vu_prepare_t1(a int, b float, c bigint, d numeric, go create procedure sys_columns_dep_vu_prepare_p1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create view sys_columns_dep_vu_prepare_v1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create function sys_columns_dep_vu_prepare_f1() diff --git a/test/JDBC/input/views/sys-data_spaces-before-16-4-vu-cleanup.sql b/test/JDBC/input/views/sys-data_spaces-before-16-4-vu-cleanup.sql new file mode 100644 index 00000000000..2b96605952c --- /dev/null +++ b/test/JDBC/input/views/sys-data_spaces-before-16-4-vu-cleanup.sql @@ -0,0 +1,8 @@ +DROP VIEW sys_data_spaces_vu_prepare_view +GO + +DROP PROC sys_data_spaces_vu_prepare_proc +GO + +DROP FUNCTION sys_data_spaces_vu_prepare_func +GO \ No newline at end of file diff --git a/test/JDBC/input/views/sys-data_spaces-before-16-4-vu-prepare.sql b/test/JDBC/input/views/sys-data_spaces-before-16-4-vu-prepare.sql new file mode 100644 index 00000000000..18b7495218e --- /dev/null +++ b/test/JDBC/input/views/sys-data_spaces-before-16-4-vu-prepare.sql @@ -0,0 +1,15 @@ +CREATE VIEW sys_data_spaces_vu_prepare_view AS +SELECT * FROM sys.data_spaces where type_desc = 'ROWS_FILEGROUP' +GO + +CREATE PROC sys_data_spaces_vu_prepare_proc AS +SELECT * FROM sys.data_spaces where type_desc = 'ROWS_FILEGROUP' +GO + +CREATE FUNCTION dbo.sys_data_spaces_vu_prepare_func() +RETURNS INT +AS +BEGIN +RETURN (SELECT count(*) FROM sys.data_spaces where type_desc = 'ROWS_FILEGROUP') +END +GO \ No newline at end of file diff --git a/test/JDBC/input/views/sys-data_spaces-before-16-4-vu-verify.sql b/test/JDBC/input/views/sys-data_spaces-before-16-4-vu-verify.sql new file mode 100644 index 00000000000..0d79e76dbae --- /dev/null +++ b/test/JDBC/input/views/sys-data_spaces-before-16-4-vu-verify.sql @@ -0,0 +1,11 @@ +SELECT * FROM sys.data_spaces +GO + +SELECT * FROM sys_data_spaces_vu_prepare_view +GO + +EXEC sys_data_spaces_vu_prepare_proc +GO + +SELECT dbo.sys_data_spaces_vu_prepare_func() +GO \ No newline at end of file diff --git a/test/JDBC/input/views/sys-data_spaces-vu-cleanup.sql b/test/JDBC/input/views/sys-data_spaces-vu-cleanup.sql new file mode 100644 index 00000000000..2b96605952c --- /dev/null +++ b/test/JDBC/input/views/sys-data_spaces-vu-cleanup.sql @@ -0,0 +1,8 @@ +DROP VIEW sys_data_spaces_vu_prepare_view +GO + +DROP PROC sys_data_spaces_vu_prepare_proc +GO + +DROP FUNCTION sys_data_spaces_vu_prepare_func +GO \ No newline at end of file diff --git a/test/JDBC/input/views/sys-data_spaces-vu-prepare.sql b/test/JDBC/input/views/sys-data_spaces-vu-prepare.sql new file mode 100644 index 00000000000..18b7495218e --- /dev/null +++ b/test/JDBC/input/views/sys-data_spaces-vu-prepare.sql @@ -0,0 +1,15 @@ +CREATE VIEW sys_data_spaces_vu_prepare_view AS +SELECT * FROM sys.data_spaces where type_desc = 'ROWS_FILEGROUP' +GO + +CREATE PROC sys_data_spaces_vu_prepare_proc AS +SELECT * FROM sys.data_spaces where type_desc = 'ROWS_FILEGROUP' +GO + +CREATE FUNCTION dbo.sys_data_spaces_vu_prepare_func() +RETURNS INT +AS +BEGIN +RETURN (SELECT count(*) FROM sys.data_spaces where type_desc = 'ROWS_FILEGROUP') +END +GO \ No newline at end of file diff --git a/test/JDBC/input/views/sys-data_spaces-vu-verify.sql b/test/JDBC/input/views/sys-data_spaces-vu-verify.sql index 8814bd91b6d..0d79e76dbae 100644 --- a/test/JDBC/input/views/sys-data_spaces-vu-verify.sql +++ b/test/JDBC/input/views/sys-data_spaces-vu-verify.sql @@ -1,2 +1,11 @@ -SELECT * FROM sys.data_spaces; +SELECT * FROM sys.data_spaces GO + +SELECT * FROM sys_data_spaces_vu_prepare_view +GO + +EXEC sys_data_spaces_vu_prepare_proc +GO + +SELECT dbo.sys_data_spaces_vu_prepare_func() +GO \ No newline at end of file diff --git a/test/JDBC/input/views/sys-events-vu-verify.sql b/test/JDBC/input/views/sys-events-vu-verify.sql index 1927b4785a3..18cbe181db1 100644 --- a/test/JDBC/input/views/sys-events-vu-verify.sql +++ b/test/JDBC/input/views/sys-events-vu-verify.sql @@ -12,6 +12,10 @@ JOIN sys.events e ON e.object_id = ao.object_id WHERE name = 'sys_events_vu_prepare_trig3' GO +select o.name, case when o.object_id = e.object_id and o.object_id = object_id(o.name) then 'equal' else 'not equal' end +from sys.objects o join sys.events e on o.object_id = e.object_id where o.name = 'sys_events_vu_prepare_trig3'; +go + USE master GO diff --git a/test/JDBC/input/views/sys-filegroups-before-16-4-vu-cleanup.sql b/test/JDBC/input/views/sys-filegroups-before-16-4-vu-cleanup.sql new file mode 100644 index 00000000000..c89368eb839 --- /dev/null +++ b/test/JDBC/input/views/sys-filegroups-before-16-4-vu-cleanup.sql @@ -0,0 +1,11 @@ +USE master +GO + +DROP VIEW sys_filegroups_vu_prepare_view +GO + +DROP PROC sys_filegroups_vu_prepare_proc +GO + +DROP FUNCTION sys_filegroups_vu_prepare_func +GO \ No newline at end of file diff --git a/test/JDBC/input/views/sys-filegroups-before-16-4-vu-prepare.sql b/test/JDBC/input/views/sys-filegroups-before-16-4-vu-prepare.sql new file mode 100644 index 00000000000..a9f6f97f6f5 --- /dev/null +++ b/test/JDBC/input/views/sys-filegroups-before-16-4-vu-prepare.sql @@ -0,0 +1,18 @@ +USE master +GO + +CREATE VIEW sys_filegroups_vu_prepare_view AS +SELECT * FROM sys.filegroups +GO + +CREATE PROC sys_filegroups_vu_prepare_proc AS +SELECT * FROM sys.filegroups +GO + +CREATE FUNCTION dbo.sys_filegroups_vu_prepare_func() +RETURNS INT +AS +BEGIN +RETURN (SELECT COUNT(*) FROM sys.filegroups) +END +GO \ No newline at end of file diff --git a/test/JDBC/input/views/sys-filegroups-before-16-4-vu-verify.sql b/test/JDBC/input/views/sys-filegroups-before-16-4-vu-verify.sql new file mode 100644 index 00000000000..115020483bf --- /dev/null +++ b/test/JDBC/input/views/sys-filegroups-before-16-4-vu-verify.sql @@ -0,0 +1,14 @@ +USE master +GO + +SELECT * FROM sys.filegroups +GO + +SELECT * FROM sys_filegroups_vu_prepare_view +GO + +EXEC sys_filegroups_vu_prepare_proc +GO + +SELECT dbo.sys_filegroups_vu_prepare_func() +GO diff --git a/test/JDBC/input/views/sys-objects-vu-verify.sql b/test/JDBC/input/views/sys-objects-vu-verify.sql index 04b97369c2d..6e58ddf8960 100644 --- a/test/JDBC/input/views/sys-objects-vu-verify.sql +++ b/test/JDBC/input/views/sys-objects-vu-verify.sql @@ -27,6 +27,10 @@ GO USE master GO +select case when object_id([name]) = object_id then 'equal' else 'not equal' end +from sys_objects_vu_prepare_db1.sys.objects where [name] = 'sys_objects_vu_prepare_trig1' +go + -- Verify cross db reference, it should show the same rows as displayed by the cross db query above. select name from sys_objects_vu_prepare_db1.sys.objects order by name; GO diff --git a/test/JDBC/input/views/sys-server_principals.sql b/test/JDBC/input/views/sys-server_principals.sql index d7e225909af..8cdeafa2671 100644 --- a/test/JDBC/input/views/sys-server_principals.sql +++ b/test/JDBC/input/views/sys-server_principals.sql @@ -11,9 +11,17 @@ FROM sys.server_principals WHERE name = 'sysadmin'; GO +SELECT name, type, type_desc, default_database_name, default_language_name, credential_id, owning_principal_id, is_fixed_role +FROM sys.server_principals +WHERE name = 'public'; +GO + CREATE LOGIN serv_principal_test WITH PASSWORD = 'test'; GO +CREATE LOGIN [public] WITH PASSWORD = 'test'; +GO + SELECT name, type, type_desc, default_database_name, default_language_name FROM sys.server_principals WHERE name in ('jdbc_user', 'serv_principal_test') order by name; diff --git a/test/JDBC/input/views/sys-triggers.sql b/test/JDBC/input/views/sys-triggers.sql index 12a13258611..b2d08805483 100644 --- a/test/JDBC/input/views/sys-triggers.sql +++ b/test/JDBC/input/views/sys-triggers.sql @@ -35,6 +35,10 @@ SELECT 1 END GO +select case when object_id([name]) = object_id then 'equal' else 'not equal' end +from sys.triggers where [name] = 'trig2' +go + -- test instead of insert trigger SELECT name, diff --git a/test/JDBC/input/views/sys_all_objects-vu-verify.sql b/test/JDBC/input/views/sys_all_objects-vu-verify.sql index e924788f780..0e8c0fe2127 100644 --- a/test/JDBC/input/views/sys_all_objects-vu-verify.sql +++ b/test/JDBC/input/views/sys_all_objects-vu-verify.sql @@ -1,2 +1,6 @@ SELECT name, type, type_desc from sys.all_objects where name like 'sys_all_objects_vu_prepare_1%' order by name; GO + +select case when object_id([name]) = object_id then 'equal' else 'not equal' end +from sys.all_objects where [name] = 'sys_all_objects_vu_prepare_1_3' +go \ No newline at end of file diff --git a/test/JDBC/input/views/sys_sequences-vu-cleanup.sql b/test/JDBC/input/views/sys_sequences-vu-cleanup.sql new file mode 100644 index 00000000000..71b195cbe47 --- /dev/null +++ b/test/JDBC/input/views/sys_sequences-vu-cleanup.sql @@ -0,0 +1,8 @@ +DROP VIEW sys_sequences_test_view +GO + +DROP PROC sys_sequences_test_proc +GO + +DROP FUNCTION sys_sequences_test_func +GO diff --git a/test/JDBC/input/views/sys_sequences-vu-prepare.sql b/test/JDBC/input/views/sys_sequences-vu-prepare.sql new file mode 100644 index 00000000000..3982f339b88 --- /dev/null +++ b/test/JDBC/input/views/sys_sequences-vu-prepare.sql @@ -0,0 +1,17 @@ +CREATE VIEW sys_sequences_test_view +AS + SELECT * FROM sys.sequences; +GO + +CREATE PROC sys_sequences_test_proc +AS + SELECT * FROM sys.sequences +GO + +CREATE FUNCTION sys_sequences_test_func() +RETURNS INT +AS +BEGIN + RETURN (SELECT COUNT(*) FROM sys.sequences) +END +GO diff --git a/test/JDBC/input/views/sys_sequences-vu-verify.sql b/test/JDBC/input/views/sys_sequences-vu-verify.sql new file mode 100644 index 00000000000..fa1caac331e --- /dev/null +++ b/test/JDBC/input/views/sys_sequences-vu-verify.sql @@ -0,0 +1,20 @@ +SELECT * FROM sys.sequences +GO + +SELECT * FROM sys_sequences_test_view +GO + +EXEC sys_sequences_test_proc +GO + +SELECT dbo.sys_sequences_test_func() +GO + +SELECT +SCHEMA_NAME(seq.schema_id) AS [Schema], +seq.name AS [Name] +FROM +sys.sequences AS seq +ORDER BY +[Schema] ASC,[Name] ASC +GO diff --git a/test/JDBC/jdbc_schedule b/test/JDBC/jdbc_schedule index a7a3538c570..d16a802fd27 100644 --- a/test/JDBC/jdbc_schedule +++ b/test/JDBC/jdbc_schedule @@ -16,10 +16,6 @@ all ignore#!#insertbulk ignore#!#BABEL-SQLvariant -# TDS fault injection framework is meant for internal testing only. So, ignore tds_faultinjection tests in stable branch -ignore#!#tds_faultinjection -ignore#!#babel_tds_fault_injection - # Ignore upgrade tests in normal JDBC run. These are tests that cannot be run in non-upgrade contexts due # to changing the behavior between pre- and post-commit. ignore#!#BABEL-2934-vu-prepare @@ -214,8 +210,6 @@ ignore#!#BABEL-730-before-15_6-or-16_1-vu-prepare ignore#!#BABEL-730-before-15_6-or-16_1-vu-verify ignore#!#BABEL-730-before-15_6-or-16_1-vu-cleanup -# These tests are meant for upgrade scenario prior to (potential) 15_7 or 16_3 release - ignore#!#BABEL-404-before-15_7-or-16_3-vu-prepare ignore#!#BABEL-404-before-15_7-or-16_3-vu-verify ignore#!#BABEL-404-before-15_7-or-16_3-vu-cleanup @@ -262,6 +256,44 @@ ignore#!#BABEL-621-after-14_12-before-15-vu-prepare ignore#!#BABEL-621-after-14_12-before-15-vu-verify ignore#!#BABEL-621-after-14_12-before-15-vu-cleanup +# These tests are meant for upgrade scenario prior to 15_8 or 16_4 release +ignore#!#sys-host_name-before-15_8-or-16_4-vu-prepare +ignore#!#sys-host_name-before-15_8-or-16_4-vu-verify +ignore#!#sys-host_name-before-15_8-or-16_4-vu-cleanup +ignore#!#left-before-15_8-or-16_4-vu-prepare +ignore#!#left-before-15_8-or-16_4-vu-verify +ignore#!#left-before-15_8-or-16_4-vu-cleanup +ignore#!#right-before-15_8-or-16_4-vu-prepare +ignore#!#right-before-15_8-or-16_4-vu-verify +ignore#!#right-before-15_8-or-16_4-vu-cleanup +ignore#!#ltrim-before-15_8-or-16_4-vu-prepare +ignore#!#ltrim-before-15_8-or-16_4-vu-verify +ignore#!#ltrim-before-15_8-or-16_4-vu-cleanup +ignore#!#rtrim-before-15_8-or-16_4-vu-prepare +ignore#!#rtrim-before-15_8-or-16_4-vu-verify +ignore#!#rtrim-before-15_8-or-16_4-vu-cleanup +ignore#!#trim-before-15_8-or-16_4-vu-prepare +ignore#!#trim-before-15_8-or-16_4-vu-verify +ignore#!#trim-before-15_8-or-16_4-vu-cleanup +ignore#!#upper_lower-before-15_8-or-16_4-vu-prepare +ignore#!#upper_lower-before-15_8-or-16_4-vu-verify +ignore#!#upper_lower-before-15_8-or-16_4-vu-cleanup +ignore#!#sys-data_spaces-before-16-4-vu-prepare +ignore#!#sys-data_spaces-before-16-4-vu-verify +ignore#!#sys-data_spaces-before-16-4-vu-cleanup +ignore#!#sys-filegroups-before-16-4-vu-prepare +ignore#!#sys-filegroups-before-16-4-vu-verify +ignore#!#sys-filegroups-before-16-4-vu-cleanup +ignore#!#translate-before-15_8-or-16_4-vu-prepare +ignore#!#translate-before-15_8-or-16_4-vu-verify +ignore#!#translate-before-15_8-or-16_4-vu-cleanup +ignore#!#substring-before-15_8-or-16_4-vu-prepare +ignore#!#substring-before-15_8-or-16_4-vu-verify +ignore#!#substring-before-15_8-or-16_4-vu-cleanup +ignore#!#stuff-before-15_8-or-16_4-vu-prepare +ignore#!#stuff-before-15_8-or-16_4-vu-verify +ignore#!#stuff-before-15_8-or-16_4-vu-cleanup + # These tests are running in multidb mode in upgrade and singledb mode in JDBC ignore#!#BABEL-4279-vu-prepare ignore#!#BABEL-4279-vu-verify @@ -308,3 +340,32 @@ ignore#!#babel_4328_datetimeoffset-before-16_3-vu-cleanup ignore#!#BABEL-3513_before_15_8_or_16_4-vu-prepare ignore#!#BABEL-3513_before_15_8_or_16_4-vu-verify + +ignore#!#catalogs_dbo_sys_schema-upgrade-vu-prepare +ignore#!#catalogs_dbo_sys_schema-upgrade-vu-verify +ignore#!#catalogs_dbo_sys_schema-upgrade-vu-cleanup + +# These tests are meant for upgrade scenario prior to 15_8 or 16_4 release +ignore#!#reverse-before-15_8-or-16_4-vu-prepare +ignore#!#reverse-before-15_8-or-16_4-vu-verify +ignore#!#reverse-before-15_8-or-16_4-vu-cleanup +ignore#!#ISC-Tables-before_16_4_or_15_8_or_14_13-vu-prepare +ignore#!#ISC-Tables-before_16_4_or_15_8_or_14_13-vu-verify +ignore#!#ISC-Tables-before_16_4_or_15_8_or_14_13-vu-cleanup +ignore#!#babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-prepare +ignore#!#babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-verify +ignore#!#babelfish_function_ext-before_16_4_or_15_8_or_14_13-vu-cleanup +ignore#!#replicate-before-15_8-or-16_4-vu-prepare +ignore#!#replicate-before-15_8-or-16_4-vu-verify +ignore#!#replicate-before-15_8-or-16_4-vu-cleanup +ignore#!#replace-before-15_8-or-16_4-vu-prepare +ignore#!#replace-before-15_8-or-16_4-vu-verify +ignore#!#replace-before-15_8-or-16_4-vu-cleanup +ignore#!#replace-before-14_3-vu-prepare +ignore#!#replace-before-14_3-vu-verify +ignore#!#replace-before-14_3-vu-cleanup +ignore#!#BABEL_4330-before-15_8-or-16_4-vu-prepare +ignore#!#BABEL_4330-before-15_8-or-16_4-vu-verify +ignore#!#alter-procedure-before-15_8-or-16_4-vu-prepare +ignore#!#alter-procedure-before-15_8-or-16_4-vu-verify +ignore#!#alter-procedure-before-15_8-or-16_4-vu-cleanup diff --git a/test/JDBC/parallel_query_jdbc_schedule b/test/JDBC/parallel_query_jdbc_schedule index 2cfaf5a4773..e69ffe06152 100644 --- a/test/JDBC/parallel_query_jdbc_schedule +++ b/test/JDBC/parallel_query_jdbc_schedule @@ -20,6 +20,7 @@ ignore#!#Test_sp_rename_database-vu-cleanup ignore#!#Test_sp_renamedb-vu-prepare ignore#!#Test_sp_renamedb-vu-verify ignore#!#Test_sp_renamedb-vu-cleanup +ignore#!#verify_mapping_for_remove_accents # Taking too much time to complete. (TIME-OUT FAILURES) ignore#!#BABEL-SP_TABLE_PRIVILIGES-vu-verify diff --git a/test/JDBC/sql_expected/sys-server_principals.out b/test/JDBC/sql_expected/sys-server_principals.out index 908c5165e4f..02305328087 100644 --- a/test/JDBC/sql_expected/sys-server_principals.out +++ b/test/JDBC/sql_expected/sys-server_principals.out @@ -26,9 +26,26 @@ sysadmin#!#R#!#SERVER_ROLE#!##!#English#!##!#1#!#1 ~~END~~ +SELECT name, type, type_desc, default_database_name, default_language_name, credential_id, owning_principal_id, is_fixed_role +FROM sys.server_principals +WHERE name = 'public'; +GO +~~START~~ +varchar#!#char#!#nvarchar#!#varchar#!#varchar#!#int#!#int#!#bit +public#!#R#!#SERVER_ROLE#!##!##!##!#1#!#0 +~~END~~ + + CREATE LOGIN serv_principal_test WITH PASSWORD = 'test'; GO +CREATE LOGIN [public] WITH PASSWORD = 'test'; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: role name "public" is reserved)~~ + + SELECT name, type, type_desc, default_database_name, default_language_name FROM sys.server_principals WHERE name in ('jdbc_user', 'serv_principal_test') order by name; diff --git a/test/JDBC/upgrade/13_4/preparation/sys-columns-dep-vu-prepare.sql b/test/JDBC/upgrade/13_4/preparation/sys-columns-dep-vu-prepare.sql index 2c26bacb227..eaa416eea8a 100644 --- a/test/JDBC/upgrade/13_4/preparation/sys-columns-dep-vu-prepare.sql +++ b/test/JDBC/upgrade/13_4/preparation/sys-columns-dep-vu-prepare.sql @@ -2,11 +2,11 @@ create table sys_columns_dep_vu_prepare_t1(a int, b float, c bigint, d numeric, go create procedure sys_columns_dep_vu_prepare_p1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create view sys_columns_dep_vu_prepare_v1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create function sys_columns_dep_vu_prepare_f1() diff --git a/test/JDBC/upgrade/13_4/schedule b/test/JDBC/upgrade/13_4/schedule index 8acaa726c8c..20f54cc4596 100644 --- a/test/JDBC/upgrade/13_4/schedule +++ b/test/JDBC/upgrade/13_4/schedule @@ -26,6 +26,7 @@ BABEL-1683 BABEL-1963 BABEL-1994-CHAR BABEL-1994-VARCHAR +restricted_procedures BABEL-2086 BABEL-2170 BABEL-2203 @@ -96,6 +97,7 @@ BABEL-SP_SPROC_COLUMNS BABEL-SP_STORED_PROCEDURES BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -230,6 +232,20 @@ drop_index-before-15_6-or-16_2 permission_restrictions_from_pg BABEL-730-before-15_6-or-16_1 babel-4517 +upper_lower-before-15_8-or-16_4 BABEL-4641-before-16_3-or-15_7-or-14_12 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 BABEL-4863-before-16_3-or-15_7-or-14_12 BABEL-4869 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/13_5/preparation/sys-columns-dep-vu-prepare.sql b/test/JDBC/upgrade/13_5/preparation/sys-columns-dep-vu-prepare.sql index 2c26bacb227..eaa416eea8a 100644 --- a/test/JDBC/upgrade/13_5/preparation/sys-columns-dep-vu-prepare.sql +++ b/test/JDBC/upgrade/13_5/preparation/sys-columns-dep-vu-prepare.sql @@ -2,11 +2,11 @@ create table sys_columns_dep_vu_prepare_t1(a int, b float, c bigint, d numeric, go create procedure sys_columns_dep_vu_prepare_p1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create view sys_columns_dep_vu_prepare_v1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create function sys_columns_dep_vu_prepare_f1() diff --git a/test/JDBC/upgrade/13_5/schedule b/test/JDBC/upgrade/13_5/schedule index 7b8895248ec..5460572e070 100644 --- a/test/JDBC/upgrade/13_5/schedule +++ b/test/JDBC/upgrade/13_5/schedule @@ -22,6 +22,7 @@ BABEL-1466 BABEL-1475 BABEL-1493 BABEL-1510 +restricted_procedures BABEL-1625 BABEL-1683 BABEL-1715 @@ -104,6 +105,7 @@ BABEL-SP_SPROC_COLUMNS BABEL-SP_STORED_PROCEDURES BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -144,7 +146,6 @@ sys-database_files sys-database_filestream_options sys-database_recovery_status sys-databases -sys-data_spaces sys-datefirst sys-dm_exec_connections sys-dm_exec_connections-dep @@ -283,6 +284,20 @@ drop_index-before-15_6-or-16_2 permission_restrictions_from_pg BABEL-730-before-15_6-or-16_1 babel-4517 +upper_lower-before-15_8-or-16_4 BABEL-4641-before-16_3-or-15_7-or-14_12 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 BABEL-4863-before-16_3-or-15_7-or-14_12 BABEL-4869 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/13_6/preparation/sys-columns-dep-vu-prepare.sql b/test/JDBC/upgrade/13_6/preparation/sys-columns-dep-vu-prepare.sql index 2c26bacb227..eaa416eea8a 100644 --- a/test/JDBC/upgrade/13_6/preparation/sys-columns-dep-vu-prepare.sql +++ b/test/JDBC/upgrade/13_6/preparation/sys-columns-dep-vu-prepare.sql @@ -2,11 +2,11 @@ create table sys_columns_dep_vu_prepare_t1(a int, b float, c bigint, d numeric, go create procedure sys_columns_dep_vu_prepare_p1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create view sys_columns_dep_vu_prepare_v1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create function sys_columns_dep_vu_prepare_f1() diff --git a/test/JDBC/upgrade/13_6/schedule b/test/JDBC/upgrade/13_6/schedule index 2d977bd2b77..b79d99ff43a 100644 --- a/test/JDBC/upgrade/13_6/schedule +++ b/test/JDBC/upgrade/13_6/schedule @@ -25,6 +25,7 @@ BABEL-1475 BABEL-1493 BABEL-1510 BABEL-1566 +restricted_procedures BABEL-1625 BABEL-1654 BABEL-1683 @@ -136,6 +137,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -161,7 +163,7 @@ insteadof_nested_trigger_with_dml insteadoftriggers_with_transaction ISC-Columns ISC-Table_Constraints -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 is_srvrolemember msdb-dbo-fn_syspolicy_is_automation_enabled msdb-dbo-syspolicy_system_health_state @@ -194,7 +196,6 @@ sys-database_filestream_options sys_database_principals_dep_for_13_x sys-database_recovery_status sys-databases -sys-data_spaces sys-datefirst sys-dm_exec_connections sys-dm_exec_connections-dep @@ -338,7 +339,21 @@ permission_restrictions_from_pg BABEL-730-before-15_6-or-16_1 GRANT_SCHEMA-before-15_7-16_3 babel-4517 +upper_lower-before-15_8-or-16_4 BABEL-4641-before-16_3-or-15_7-or-14_12 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 BABEL-4863-before-16_3-or-15_7-or-14_12 babel_726-before-14_12-or-15_7-or-16_3 BABEL-4869 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/13_7/preparation/sys-columns-dep-vu-prepare.sql b/test/JDBC/upgrade/13_7/preparation/sys-columns-dep-vu-prepare.sql index 2c26bacb227..eaa416eea8a 100644 --- a/test/JDBC/upgrade/13_7/preparation/sys-columns-dep-vu-prepare.sql +++ b/test/JDBC/upgrade/13_7/preparation/sys-columns-dep-vu-prepare.sql @@ -2,11 +2,11 @@ create table sys_columns_dep_vu_prepare_t1(a int, b float, c bigint, d numeric, go create procedure sys_columns_dep_vu_prepare_p1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create view sys_columns_dep_vu_prepare_v1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create function sys_columns_dep_vu_prepare_f1() diff --git a/test/JDBC/upgrade/13_7/schedule b/test/JDBC/upgrade/13_7/schedule index e1112d86290..b630dd9e4df 100644 --- a/test/JDBC/upgrade/13_7/schedule +++ b/test/JDBC/upgrade/13_7/schedule @@ -29,6 +29,7 @@ BABEL-1683 BABEL-1715 BABEL-1756 BABEL-1756-dep +restricted_procedures BABEL-1963 BABEL-1994-CHAR BABEL-1994-VARCHAR @@ -132,6 +133,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -157,7 +159,7 @@ insteadof_nested_trigger_with_dml insteadoftriggers_with_transaction ISC-Columns ISC-Table_Constraints -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 is_srvrolemember msdb-dbo-fn_syspolicy_is_automation_enabled msdb-dbo-syspolicy_system_health_state @@ -188,7 +190,6 @@ sys-database_files sys-database_filestream_options sys_database_principals_dep_for_13_x sys-database_recovery_status -sys-data_spaces sys-datefirst sys-dm_exec_connections sys-dm_exec_connections-dep @@ -332,6 +333,20 @@ drop_index-before-15_6-or-16_2 permission_restrictions_from_pg BABEL-730-before-15_6-or-16_1 babel-4517 +upper_lower-before-15_8-or-16_4 BABEL-4641-before-16_3-or-15_7-or-14_12 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 BABEL-4863-before-16_3-or-15_7-or-14_12 BABEL-4869 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/13_8/preparation/sys-columns-dep-vu-prepare.sql b/test/JDBC/upgrade/13_8/preparation/sys-columns-dep-vu-prepare.sql index 2c26bacb227..eaa416eea8a 100644 --- a/test/JDBC/upgrade/13_8/preparation/sys-columns-dep-vu-prepare.sql +++ b/test/JDBC/upgrade/13_8/preparation/sys-columns-dep-vu-prepare.sql @@ -2,11 +2,11 @@ create table sys_columns_dep_vu_prepare_t1(a int, b float, c bigint, d numeric, go create procedure sys_columns_dep_vu_prepare_p1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create view sys_columns_dep_vu_prepare_v1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create function sys_columns_dep_vu_prepare_f1() diff --git a/test/JDBC/upgrade/13_8/schedule b/test/JDBC/upgrade/13_8/schedule index e1112d86290..cf8cba0e6d2 100644 --- a/test/JDBC/upgrade/13_8/schedule +++ b/test/JDBC/upgrade/13_8/schedule @@ -30,6 +30,7 @@ BABEL-1715 BABEL-1756 BABEL-1756-dep BABEL-1963 +restricted_procedures BABEL-1994-CHAR BABEL-1994-VARCHAR BABEL-2086 @@ -132,6 +133,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -157,7 +159,7 @@ insteadof_nested_trigger_with_dml insteadoftriggers_with_transaction ISC-Columns ISC-Table_Constraints -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 is_srvrolemember msdb-dbo-fn_syspolicy_is_automation_enabled msdb-dbo-syspolicy_system_health_state @@ -188,7 +190,6 @@ sys-database_files sys-database_filestream_options sys_database_principals_dep_for_13_x sys-database_recovery_status -sys-data_spaces sys-datefirst sys-dm_exec_connections sys-dm_exec_connections-dep @@ -332,6 +333,20 @@ drop_index-before-15_6-or-16_2 permission_restrictions_from_pg BABEL-730-before-15_6-or-16_1 babel-4517 +upper_lower-before-15_8-or-16_4 BABEL-4641-before-16_3-or-15_7-or-14_12 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 BABEL-4863-before-16_3-or-15_7-or-14_12 BABEL-4869 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/13_9/preparation/sys-columns-dep-vu-prepare.sql b/test/JDBC/upgrade/13_9/preparation/sys-columns-dep-vu-prepare.sql index 2c26bacb227..eaa416eea8a 100644 --- a/test/JDBC/upgrade/13_9/preparation/sys-columns-dep-vu-prepare.sql +++ b/test/JDBC/upgrade/13_9/preparation/sys-columns-dep-vu-prepare.sql @@ -2,11 +2,11 @@ create table sys_columns_dep_vu_prepare_t1(a int, b float, c bigint, d numeric, go create procedure sys_columns_dep_vu_prepare_p1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create view sys_columns_dep_vu_prepare_v1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by column_id; go create function sys_columns_dep_vu_prepare_f1() diff --git a/test/JDBC/upgrade/13_9/schedule b/test/JDBC/upgrade/13_9/schedule index d555529890f..097a78c2650 100644 --- a/test/JDBC/upgrade/13_9/schedule +++ b/test/JDBC/upgrade/13_9/schedule @@ -29,6 +29,7 @@ BABEL-1625 BABEL-1654 BABEL-1683 BABEL-1715 +restricted_procedures BABEL-1963 BABEL-1994-CHAR BABEL-1994-VARCHAR @@ -133,6 +134,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -158,7 +160,7 @@ insteadof_nested_trigger_with_dml insteadoftriggers_with_transaction ISC-Columns ISC-Table_Constraints -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 is_srvrolemember msdb-dbo-fn_syspolicy_is_automation_enabled msdb-dbo-syspolicy_system_health_state @@ -190,7 +192,6 @@ sys-database_files sys-database_filestream_options sys_database_principals_dep_for_13_x sys-database_recovery_status -sys-data_spaces sys-datefirst sys-dm_exec_connections sys-dm_exec_connections-dep @@ -336,7 +337,21 @@ permission_restrictions_from_pg BABEL-730-before-15_6-or-16_1 babel-4517 GRANT_SCHEMA-before-15_7-16_3 +upper_lower-before-15_8-or-16_4 BABEL-4641-before-16_3-or-15_7-or-14_12 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 BABEL-4863-before-16_3-or-15_7-or-14_12 babel_726-before-14_12-or-15_7-or-16_3 BABEL-4869 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/14_10/schedule b/test/JDBC/upgrade/14_10/schedule index 453947e9344..4b489d86056 100644 --- a/test/JDBC/upgrade/14_10/schedule +++ b/test/JDBC/upgrade/14_10/schedule @@ -35,6 +35,7 @@ TestTinyInt TestUDD-before-15_7-or-16_3 TestUniqueIdentifier TestVarChar +restricted_procedures TestXML sys-assembly_types sys-database_mirroring @@ -59,7 +60,7 @@ column_domain_usage constraint_column_usage select-strip-parens-before-15_5 sp_describe_first_result_set -sys-host_name +sys-host_name-before-15_8-or-16_4 SYSTEM_USER indexproperty sys-all_parameters @@ -206,7 +207,7 @@ BABEL-ROLE-MEMBER tdscollation BABEL-EXTENDEDPROPERTY-before-15_4 BABEL-EXECUTE_AS_CALLER -sys-filegroups +sys-filegroups-before-16-4 sys-filetables sys-fulltext_indexes sys-hash_indexes @@ -253,6 +254,7 @@ BABEL-1438 BABEL-SP_DATATYPE_INFO BABEL-SPCOLUMNS BABEL-SP_TABLES +SP_TABLES-dep BABEL-SP_SPECIAL_COLUMNS BABEL-SP_TABLE_PRIVILIGES BABEL-SP_FKEYS @@ -285,7 +287,7 @@ sys-change_tracking_tables sys-check_constraints sys-columns sys-computed_columns -sys-data_spaces +sys-data_spaces-before-16-4 sys-database_files sys-database_filestream_options sys-database_recovery_status @@ -368,7 +370,7 @@ BABEL-3640 sys-sysindexes sys-system_objects ISC-Views -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 ISC-Columns #ISC-Check-Constraints ISC-Table_Constraints @@ -410,7 +412,7 @@ babel_int4_varbinary_div babel_varbinary_int4_div sys-sql_expression_dependencies smalldatetimefromparts-dep -BABEL_4330 +BABEL_4330-before-15_8-or-16_4 BABEL-4231 BABEL-4384 default_params @@ -435,10 +437,25 @@ babel-4517 BABEL-4815 BABEL_3571-before-15-5 BABEL_4817 +upper_lower-before-15_8-or-16_4 BABEL-4641-before-16_3-or-15_7-or-14_12 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +replace-before-15_8-or-16_4 BABEL-4863-before-16_3-or-15_7-or-14_12 babel_726-before-14_12-or-15_7-or-16_3 BABEL-4869 babel_4328_datetime-before-16_3 babel_4328_datetime2-before-16_3 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 babel_4328_datetimeoffset-before-16_3 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/14_11/schedule b/test/JDBC/upgrade/14_11/schedule index ac68684ffc7..e22e72a3ac7 100644 --- a/test/JDBC/upgrade/14_11/schedule +++ b/test/JDBC/upgrade/14_11/schedule @@ -40,6 +40,7 @@ sys-assembly_types sys-database_mirroring sys-databases sys-numbered_procedures +restricted_procedures BABEL-3121 sys-events sys-suser_sid @@ -59,7 +60,7 @@ column_domain_usage constraint_column_usage select-strip-parens-before-15_5 sp_describe_first_result_set -sys-host_name +sys-host_name-before-15_8-or-16_4 SYSTEM_USER indexproperty sys-all_parameters @@ -207,7 +208,7 @@ BABEL-ROLE-MEMBER tdscollation BABEL-EXTENDEDPROPERTY-before-15_4 BABEL-EXECUTE_AS_CALLER -sys-filegroups +sys-filegroups-before-16-4 sys-filetables sys-fulltext_indexes sys-hash_indexes @@ -253,6 +254,7 @@ BABEL-APPLOCK BABEL-1438 BABEL-SP_DATATYPE_INFO BABEL-SPCOLUMNS +SP_TABLES-dep BABEL-SP_TABLES BABEL-SP_SPECIAL_COLUMNS BABEL-SP_TABLE_PRIVILIGES @@ -286,7 +288,7 @@ sys-change_tracking_tables sys-check_constraints sys-columns sys-computed_columns -sys-data_spaces +sys-data_spaces-before-16-4 sys-database_files sys-database_filestream_options sys-database_recovery_status @@ -369,7 +371,7 @@ BABEL-3640 sys-sysindexes sys-system_objects ISC-Views -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 ISC-Columns #ISC-Check-Constraints ISC-Table_Constraints @@ -411,7 +413,7 @@ babel_int4_varbinary_div babel_varbinary_int4_div sys-sql_expression_dependencies smalldatetimefromparts-dep -BABEL_4330 +BABEL_4330-before-15_8-or-16_4 BABEL-4231 BABEL-4384 default_params @@ -434,9 +436,24 @@ babel-3254 BABEL-4815 BABEL_3571-before-15-5 BABEL_4817 +upper_lower-before-15_8-or-16_4 BABEL-4641-before-16_3-or-15_7-or-14_12 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +replace-before-15_8-or-16_4 BABEL-4863-before-16_3-or-15_7-or-14_12 BABEL-4869 babel_4328_datetime-before-16_3 babel_4328_datetime2-before-16_3 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 babel_4328_datetimeoffset-before-16_3 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/14_12/schedule b/test/JDBC/upgrade/14_12/schedule index 99b0a68ce14..8fe4db6253b 100644 --- a/test/JDBC/upgrade/14_12/schedule +++ b/test/JDBC/upgrade/14_12/schedule @@ -41,6 +41,7 @@ sys-database_mirroring sys-databases sys-numbered_procedures BABEL-3121 +restricted_procedures sys-events sys-suser_sid sys-trigger_events @@ -59,7 +60,7 @@ column_domain_usage constraint_column_usage select-strip-parens-before-15_5 sp_describe_first_result_set -sys-host_name +sys-host_name-before-15_8-or-16_4 SYSTEM_USER indexproperty sys-all_parameters @@ -205,7 +206,7 @@ BABEL-ROLE-MEMBER tdscollation BABEL-EXTENDEDPROPERTY-before-15_4 BABEL-EXECUTE_AS_CALLER -sys-filegroups +sys-filegroups-before-16-4 sys-filetables sys-fulltext_indexes sys-hash_indexes @@ -251,6 +252,7 @@ BABEL-APPLOCK BABEL-1438 BABEL-SP_DATATYPE_INFO BABEL-SPCOLUMNS +SP_TABLES-dep BABEL-SP_TABLES BABEL-SP_SPECIAL_COLUMNS BABEL-SP_TABLE_PRIVILIGES @@ -284,7 +286,7 @@ sys-change_tracking_tables sys-check_constraints sys-columns sys-computed_columns -sys-data_spaces +sys-data_spaces-before-16-4 sys-database_files sys-database_filestream_options sys-database_recovery_status @@ -367,7 +369,7 @@ BABEL-3640 sys-sysindexes sys-system_objects ISC-Views -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 ISC-Columns #ISC-Check-Constraints ISC-Table_Constraints @@ -409,7 +411,7 @@ babel_int4_varbinary_div babel_varbinary_int4_div sys-sql_expression_dependencies smalldatetimefromparts-dep -BABEL_4330 +BABEL_4330-before-15_8-or-16_4 BABEL-4231 BABEL-4384 default_params @@ -429,7 +431,14 @@ BABEL-730-before-15_6-or-16_1 BABEL-492-before-15_6 babel-4517 babel-3254 +upper_lower-before-15_8-or-16_4 BABEL-4641 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +replace-before-15_8-or-16_4 BABEL-4863 babel_test_int4_numeric_oper_before_16_3 babel_test_int8_numeric_oper_before_16_3 @@ -439,5 +448,13 @@ BABEL-4869 babel_4328_datetime babel_4328_datetime2 babel_4328_datetimeoffset +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 babel_726 BABEL-3401 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/14_13/schedule b/test/JDBC/upgrade/14_13/schedule index 99b0a68ce14..8b5cafac512 100644 --- a/test/JDBC/upgrade/14_13/schedule +++ b/test/JDBC/upgrade/14_13/schedule @@ -44,6 +44,7 @@ BABEL-3121 sys-events sys-suser_sid sys-trigger_events +restricted_procedures BABEL-2688 BABEL-328 BABEL-3166 @@ -59,7 +60,7 @@ column_domain_usage constraint_column_usage select-strip-parens-before-15_5 sp_describe_first_result_set -sys-host_name +sys-host_name-before-15_8-or-16_4 SYSTEM_USER indexproperty sys-all_parameters @@ -205,7 +206,7 @@ BABEL-ROLE-MEMBER tdscollation BABEL-EXTENDEDPROPERTY-before-15_4 BABEL-EXECUTE_AS_CALLER -sys-filegroups +sys-filegroups-before-16-4 sys-filetables sys-fulltext_indexes sys-hash_indexes @@ -251,6 +252,7 @@ BABEL-APPLOCK BABEL-1438 BABEL-SP_DATATYPE_INFO BABEL-SPCOLUMNS +SP_TABLES-dep BABEL-SP_TABLES BABEL-SP_SPECIAL_COLUMNS BABEL-SP_TABLE_PRIVILIGES @@ -284,7 +286,7 @@ sys-change_tracking_tables sys-check_constraints sys-columns sys-computed_columns -sys-data_spaces +sys-data_spaces-before-16-4 sys-database_files sys-database_filestream_options sys-database_recovery_status @@ -409,7 +411,7 @@ babel_int4_varbinary_div babel_varbinary_int4_div sys-sql_expression_dependencies smalldatetimefromparts-dep -BABEL_4330 +BABEL_4330-before-15_8-or-16_4 BABEL-4231 BABEL-4384 default_params @@ -430,6 +432,12 @@ BABEL-492-before-15_6 babel-4517 babel-3254 BABEL-4641 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +replace-before-15_8-or-16_4 BABEL-4863 babel_test_int4_numeric_oper_before_16_3 babel_test_int8_numeric_oper_before_16_3 @@ -439,5 +447,14 @@ BABEL-4869 babel_4328_datetime babel_4328_datetime2 babel_4328_datetimeoffset +upper_lower-before-15_8-or-16_4 +substring-before-15_8-or-16_4 +translate-before-15_8-or-16_4 babel_726 BABEL-3401 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/14_14/schedule b/test/JDBC/upgrade/14_14/schedule new file mode 100644 index 00000000000..8b5cafac512 --- /dev/null +++ b/test/JDBC/upgrade/14_14/schedule @@ -0,0 +1,460 @@ +# Schedule File for JDBC Test Framework for local run +# 1. Lines starting with '#' will be treated as comments +# 2. To run a postgres command: cmd#!#postgresql#!# +# 3. To run a T-SQL command: cmd#!#sqlserver#!# +# 4. Keyword "all" is equivalent to running all test files in +# input folder +# 5. To add a test, add test name (without extension, -vu-prepare, -vu-verify and -vu-cleanup. For example if test file name is TestBigInt-vu-prepare.txt write TestBigInt) on a new line + +# This should be the first test to check there are no duplicated object_ids +BABEL-3613 + +babelfish_cast_floor +babel_try_parse +TestBigInt +TestBinary +TestBIT +TestChar +TestDatetime2 +TestDatetime +TestDate +TestDecimal +TestFloat +TestImage +TestInt +TestMoney +TestNumeric +TestReal +TestSmallDatetime +TestSmallInt +TestSmallMoney +TestSQLVariant +TestText +TestTime +TestTinyInt +TestUDD-before-15_7-or-16_3 +TestUniqueIdentifier +TestVarChar +TestXML +sys-assembly_types +sys-database_mirroring +sys-databases +sys-numbered_procedures +BABEL-3121 +sys-events +sys-suser_sid +sys-trigger_events +restricted_procedures +BABEL-2688 +BABEL-328 +BABEL-3166 +BABEL-3192 +BABEL-3221 +BABEL-3204 +BABEL-3234 +BABEL-3402 +cast_numeric_types_to_datetime +cast_numeric_types_to_smalldatetime +routines_definition +column_domain_usage +constraint_column_usage +select-strip-parens-before-15_5 +sp_describe_first_result_set +sys-host_name-before-15_8-or-16_4 +SYSTEM_USER +indexproperty +sys-all_parameters +msdb-dbo-syspolicy_configuration +sys-all_views +datepart +sys-server_principals +fulltextserviceproperty +is_srvrolemember +msdb-dbo-fn_syspolicy_is_automation_enabled +objectproperty +objectpropertyex +sys-column-property +sys-configurations +sys-datefirst +sys-lock_timeout +sys-max_connections +sys-original_login +sys-schema-name +sys-objects +sys-procedures +sys-sysdatabases +sys-sysobjects +sys-trigger_nestlevel +schema_resolution_proc +BABEL-404 +BABEL-493 +BABEL-621-after-14_12-before-15 +BABEL-775 +BABEL-1206 +BABEL-1251 +BABEL-1319 +BABEL-1444 +BABEL-1465 +BABEL-1466 +BABEL-1654 +BABEL-1715 +BABEL-2086 +BABEL-3314 +BABEL-TABLEOPTIONS +BABEL-2765 +BABEL-2819 +BABEL-2917 +BABEL-2955 +BABEL-3358 +BABEL-3747 +BABEL-3781 +temp-tables +table-variable +TestNotNull +Test-Identity +Test-Computed-Columns +BABEL-1189 +BABEL-1062 +BABEL-1243 +BABEL-1493 +BABEL-1963 +BABEL-2170 +BABEL-2203 +BABEL-2208 +BABEL-2257 +BABEL-2449 +BABEL-2535 +BABEL-2787-2 +BABEL-2787 +BABEL-2805 +BABEL-2812 +BABEL-2845 +BABEL-2884 +BABEL-2944 +BABEL-3116 +BABEL-3117 +BABEL-3118 +BABEL-3249 +BABEL-3486 +BABEL-3474 +BABEL-3614 +BABEL-3646 +BABEL-3748 +BABEL-383 +BABEL-405 +BABEL-4516 +BABEL-937 +forjson +forjson-subquery +forjson-datatypes +forxml +forxml-subquery +BABEL-PROCID +babel_trigger +insteadoftriggers_with_transaction +insteadof_nested_trigger_inside_proc +insteadof_nested_trigger_with_dml +nested_trigger_inside_proc +nested_trigger_with_dml +triggers_with_transaction +Test-sp_addrole +Test-sp_addrolemember +Test-sp_droprole +Test-sp_droprolemember +Test-sp_helpdbfixedrole +Test-sp_helpsrvrolemember +Test-sp_helpuser +Test-sp_set_session_context +Test-sp_set_session_context-dep +TestTableType +BABEL-CROSS-DB +BABEL-LOGIN +BABEL-USER +BABEL-ROLE +babelfish_sysdatabases +babelfish_namespace_ext +babelfish_authid_login_ext +babelfish_authid_user_ext +babelfish_inconsistent_metadata +babelfish_migration_mode +schema_resolution_func +BABEL-3147 +collation_tests_arabic +collation_tests_greek +collation_tests_mongolian +collation_tests_polish +collation_tests +babel_datetime +babel_char +BABEL-SQUARE +BABEL-728 +babel_function_string +BABEL-1566 +BABEL-3360 +BABEL-3380 +babel_isnumeric +HAS_DBACCESS +BABEL-1475 +BABEL-1510 +BABEL-3213 +BABEL-3010-before-15_6 +BABEL-3369 +BABEL-3370 +BABEL-RAND +BABEL-741 +BABEL-ROLE-MEMBER +tdscollation +BABEL-EXTENDEDPROPERTY-before-15_4 +BABEL-EXECUTE_AS_CALLER +sys-filegroups-before-16-4 +sys-filetables +sys-fulltext_indexes +sys-hash_indexes +sys-plan_guides +sp_tablecollations +sys-assemblies +BABEL-LOGIN-USER-EXT +bitwise_not-operator +BABEL-1683 +BABEL-1953 +schema_resolution_trigger +sys_all_objects-dep +sys-columns-dep +sys-databases-dep +sys-foreign_key_columns-dep +sys-foreign_keys-dep +sys-identity_columns-dep +sys-indexes-dep +sys-key_constraints-dep +sys-schemas-dep +sys-sp_tables_view-dep +sys-sysforeignkeys-dep +sys-tables-dep +sys-types-before-dep +sys-views-dep +sys-check_constraints-dep +sys-computed_columns-dep +sys-default_constraints-dep +sys-index_columns-dep +sys-sp_databases-dep +sys-syscolumns-dep +sys-dm_exec_connections-dep +sys-dm_exec_sessions-dep +sys-table_types-before-dep +sys-all_sql_modules-dep +sys-sql_modules-dep +sys-system_sql_modules-dep +sys-triggers-dep +sys-proc_param_helper-dep +sys-sp_pkeys +sys-sp_statistics +BABEL-APPLOCK +BABEL-1438 +BABEL-SP_DATATYPE_INFO +BABEL-SPCOLUMNS +SP_TABLES-dep +BABEL-SP_TABLES +BABEL-SP_SPECIAL_COLUMNS +BABEL-SP_TABLE_PRIVILIGES +BABEL-SP_FKEYS +BABEL-SP_STORED_PROCEDURES +BABEL-SP_SPROC_COLUMNS +BABEL-3000 +sys-sp_pkeys-dep +sys-sp_statistics-dep +BABEL-SPCOLUMNS-dep +BABEL-SP_COLUMNS_MANAGED-dep +BABEL-SP_SPECIAL_COLUMNS-dep +BABEL-SP_SPECIAL_COLUMNS_100-dep +BABEL-SP_FKEYS-dep +BABEL-SP_STORED_PROCEDURES-dep +BABEL-SP_SPROC_COLUMNS-dep +BABEL-SP_SPROC_COLUMNS_100-dep +BABEL-3000-dep +Test-sp_helprole-dep +Test-sp_helprolemember-dep +format +format-dep +msdb-dbo-syspolicy_system_health_state +dateadd_internal_df +sys-all_columns +sys-all_columns-dep +sys-all_sql_modules +sys-assembly_modules +sys-change_tracking_databases +sys-change_tracking_tables +sys-check_constraints +sys-columns +sys-computed_columns +sys-data_spaces-before-16-4 +sys-database_files +sys-database_filestream_options +sys-database_recovery_status +sys-default_constraints +sys-dm_exec_connections +sys-dm_exec_sessions +sys-dm_hadr_cluster +sys-dm_hadr_database_replica_states +sys-dm_os_host_info +sys-endpoints +sys-extended_properties +sys-filetable_system_defined_objects +sys-foreign_key_columns +sys-foreign_keys +sys-fulltext_catalogs +sys-fulltext_index_columns +sys-fulltext_languages +sys-fulltext_stoplists +sys-identity_columns +sys-index_columns +sys-indexes +sys-key_constraints +sys-master_files +sys-nestlevel-dep +sys-partitions +sys-partitions-dep +sys-registered_search_property_lists +sys-schemas +sys-selective_xml_index_paths +sys-sid_binary +sys-sp_databases +sys-sp_tables_view +sys-spatial_index_tessellations +sys-spatial_indexes +sys-stats +sys-synonyms +sys-syscharsets +sys-syscolumns +sys-sysforeignkeys +sys-syslanguages +sys-system_sql_modules +sys-sql_modules +sys-table_types +sys-tables +sys-triggers +sys-types +sys-views +sys-xml_indexes +sys-xml_schema_collections +sys_all_objects +sys_babelfish_configurations_view +BABEL-1249 +BABEL-1291 +BABEL-1994-CHAR +BABEL-1994-VARCHAR +BABEL-889 +babel_417 +babel_datatype_sqlvariant +babel_sqlvariant_cast_compare +BABEL-3347 +BABEL-3144 +sys-all_parameters-dep +BABEL-3556 +BABEL-3588 +BABEL-3268 +BABEL-3513_before_15_8_or_16_4 +BABEL_GRANT_CONNECT +BABEL-sp_helpdb +BABEL-2795 +babelfish_integrity_checker +get_tds_id +BABEL-PG-SYSTEM-FUNCTIONS +BABEL-3655 +BABEL-3702 +openjson +sys-table_types_internal +sys-table_types_internal-dep +BABEL-CHECK-CONSTRAINT +BABEL-3640 +sys-sysindexes +sys-system_objects +ISC-Views +ISC-Tables +ISC-Columns +#ISC-Check-Constraints +ISC-Table_Constraints +sys_server_principals_dep +sys_database_principals_dep +datediff_big +atn2 +app_name +str +ISC-sequences +jira-BABEL-3504-upgrade +case_insensitive_collation +sys-has_perms_by_name +sys-has_perms_by_name-dep +BABEL_OBJECT_ID +BABEL_SCHEMATA +isc-schemata-dep +AVG-Aggregate-common +AVG-Aggregate-Dep +bbf_view_def +BABEL-3802 +BABEL-3914 +BABEL_OBJECT_NAME +sys-systypes +BABEL_OBJECT_DEFINITION +Test-sp_rename +Test-sp_rename-dep +BABEL-3657 +BABEL-733 +BABEL-3938 +BABEL-NEXT-VALUE-FOR +BABEL-4098 +TestVariableDataLength +binary-index +BABEL-4078 +BABEL-3215 +orderby +babel_int4_varbinary_div +babel_varbinary_int4_div +sys-sql_expression_dependencies +smalldatetimefromparts-dep +BABEL_4330-before-15_8-or-16_4 +BABEL-4231 +BABEL-4384 +default_params +BABEL-3326 +cast_eliminate +order_by_offset_fetch_rows-before-15_6-or-16_2 +TestDatatypeAggSort +babel_index_nulls_order-before-15-5 +operator_binary_whitespace-before-15_6-or-16_2 +BABEL-2999 +drop_index-before-15_6-or-16_2 +BABEL-4606 +BABEL-4672 +sys-parsename-before-15_6-or-16_1 +permission_restrictions_from_pg +BABEL-730-before-15_6-or-16_1 +BABEL-492-before-15_6 +babel-4517 +babel-3254 +BABEL-4641 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +replace-before-15_8-or-16_4 +BABEL-4863 +babel_test_int4_numeric_oper_before_16_3 +babel_test_int8_numeric_oper_before_16_3 +babel_test_int2_numeric_oper_before_16_3 +newid_before_15_8_or_16_4 +BABEL-4869 +babel_4328_datetime +babel_4328_datetime2 +babel_4328_datetimeoffset +upper_lower-before-15_8-or-16_4 +substring-before-15_8-or-16_4 +translate-before-15_8-or-16_4 +babel_726 +BABEL-3401 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/14_3/schedule b/test/JDBC/upgrade/14_3/schedule index 1dbdc8a0b72..00a7a1f79bb 100644 --- a/test/JDBC/upgrade/14_3/schedule +++ b/test/JDBC/upgrade/14_3/schedule @@ -32,6 +32,7 @@ BABEL-1715 BABEL-1756 BABEL-1756-dep BABEL-1963 +restricted_procedures BABEL-1994-CHAR BABEL-1994-VARCHAR BABEL-2086 @@ -141,6 +142,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -166,7 +168,7 @@ insteadof_nested_trigger_inside_proc insteadof_nested_trigger_with_dml insteadoftriggers_with_transaction ISC-Table_Constraints -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 is_srvrolemember msdb-dbo-fn_syspolicy_is_automation_enabled msdb-dbo-syspolicy_system_health_state @@ -202,7 +204,7 @@ sys-database_files sys-database_filestream_options sys_database_principals_dep sys-database_recovery_status -sys-data_spaces +sys-data_spaces-before-16-4 sys-datefirst sys-dm_exec_connections sys-dm_exec_connections-dep @@ -339,7 +341,7 @@ timefromparts triggers_with_transaction BABEL-4046 table_constraint_wo_comma-before-15_6-or-16_2 -BABEL_4330 +BABEL_4330-before-15_8-or-16_4 BABEL-4410 AUTO_ANALYZE-before-15-5-or-14-10 cast_eliminate @@ -353,7 +355,14 @@ permission_restrictions_from_pg BABEL-730-before-15_6-or-16_1 GRANT_SCHEMA-before-15_7-16_3 babel-4517 +upper_lower-before-15_8-or-16_4 BABEL-4641-before-16_3-or-15_7-or-14_12 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +replace-before-15_8-or-16_4 BABEL-4863-before-16_3-or-15_7-or-14_12 babel_726-before-14_12-or-15_7-or-16_3 babel_test_int4_numeric_oper_before_16_3 @@ -362,4 +371,12 @@ babel_test_int2_numeric_oper_before_16_3 BABEL-4869 babel_4328_datetime-before-16_3 babel_4328_datetime2-before-16_3 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 babel_4328_datetimeoffset-before-16_3 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/14_5/schedule b/test/JDBC/upgrade/14_5/schedule index 315d9d0fd6a..615adb37ed4 100644 --- a/test/JDBC/upgrade/14_5/schedule +++ b/test/JDBC/upgrade/14_5/schedule @@ -32,6 +32,7 @@ BABEL-1756 BABEL-1756-dep BABEL-1963 BABEL-1994-CHAR +restricted_procedures BABEL-1994-VARCHAR BABEL-2086 BABEL-2170 @@ -137,6 +138,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -165,7 +167,7 @@ insteadof_nested_trigger_inside_proc insteadof_nested_trigger_with_dml insteadoftriggers_with_transaction ISC-Table_Constraints -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 is_srvrolemember msdb-dbo-fn_syspolicy_is_automation_enabled msdb-dbo-syspolicy_configuration @@ -208,7 +210,7 @@ sys_database_principals_dep sys-database_recovery_status sys-databases sys-databases-dep -sys-data_spaces +sys-data_spaces-before-16-4 sys-datefirst sys-dm_exec_connections sys-dm_exec_connections-dep @@ -220,7 +222,7 @@ sys-dm_os_host_info sys-endpoints sys-events sys-extended_properties -sys-filegroups +sys-filegroups-before-16-4 sys-filetables sys-filetable_system_defined_objects sys-foreign_key_columns @@ -235,7 +237,7 @@ sys-fulltext_stoplists sys-hash_indexes sys-has_perms_by_name sys-has_perms_by_name-dep -sys-host_name +sys-host_name-before-15_8-or-16_4 sys-identity_columns sys-identity_columns-dep sys-index_columns @@ -354,7 +356,7 @@ triggers_with_transaction BABEL-4046 table_constraint_wo_comma-before-15_6-or-16_2 getdate -BABEL_4330 +BABEL_4330-before-15_8-or-16_4 BABEL-4410 AUTO_ANALYZE-before-15-5-or-14-10 cast_eliminate @@ -368,10 +370,25 @@ permission_restrictions_from_pg BABEL-730-before-15_6-or-16_1 GRANT_SCHEMA-before-15_7-16_3 babel-4517 +upper_lower-before-15_8-or-16_4 BABEL-4641-before-16_3-or-15_7-or-14_12 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +replace-before-15_8-or-16_4 BABEL-4863-before-16_3-or-15_7-or-14_12 babel_726-before-14_12-or-15_7-or-16_3 BABEL-4869 babel_4328_datetime-before-16_3 babel_4328_datetime2-before-16_3 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 babel_4328_datetimeoffset-before-16_3 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/14_6/schedule b/test/JDBC/upgrade/14_6/schedule index ea70d5e495d..66b45d718c4 100644 --- a/test/JDBC/upgrade/14_6/schedule +++ b/test/JDBC/upgrade/14_6/schedule @@ -32,6 +32,7 @@ BABEL-1683 BABEL-1715 BABEL-1953 BABEL-1963 +restricted_procedures BABEL-1994-CHAR BABEL-1994-VARCHAR BABEL-2086 @@ -155,6 +156,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -192,7 +194,7 @@ insteadof_nested_trigger_inside_proc insteadof_nested_trigger_with_dml insteadoftriggers_with_transaction ISC-Table_Constraints -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 ISC-Views is_srvrolemember msdb-dbo-fn_syspolicy_is_automation_enabled @@ -239,7 +241,7 @@ sys_database_principals_dep sys-database_recovery_status sys-databases sys-databases-dep -sys-data_spaces +sys-data_spaces-before-16-4 sys-datefirst sys-default_constraints sys-default_constraints-dep @@ -253,7 +255,7 @@ sys-dm_os_host_info sys-endpoints sys-events sys-extended_properties -sys-filegroups +sys-filegroups-before-16-4 sys-filetables sys-filetable_system_defined_objects sys-foreign_key_columns @@ -268,7 +270,7 @@ sys-fulltext_stoplists sys-hash_indexes sys-has_perms_by_name sys-has_perms_by_name-dep -sys-host_name +sys-host_name-before-15_8-or-16_4 sys-identity_columns sys-identity_columns-dep sys-index_columns @@ -390,7 +392,7 @@ triggers_with_transaction BABEL-4046 table_constraint_wo_comma-before-15_6-or-16_2 getdate -BABEL_4330 +BABEL_4330-before-15_8-or-16_4 BABEL-4410 AUTO_ANALYZE-before-15-5-or-14-10 cast_eliminate @@ -405,10 +407,25 @@ BABEL-730-before-15_6-or-16_1 GRANT_SCHEMA-before-15_7-16_3 babel-4517 BABEL_3571-before-15-5 +upper_lower-before-15_8-or-16_4 BABEL-4641-before-16_3-or-15_7-or-14_12 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +replace-before-15_8-or-16_4 BABEL-4863-before-16_3-or-15_7-or-14_12 babel_726-before-14_12-or-15_7-or-16_3 BABEL-4869 babel_4328_datetime-before-16_3 babel_4328_datetime2-before-16_3 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 babel_4328_datetimeoffset-before-16_3 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/14_7/schedule b/test/JDBC/upgrade/14_7/schedule index d980fdb6e75..8e5df6c7c3f 100644 --- a/test/JDBC/upgrade/14_7/schedule +++ b/test/JDBC/upgrade/14_7/schedule @@ -34,6 +34,7 @@ BABEL-1683 BABEL-1715 BABEL-1953 BABEL-1963 +restricted_procedures BABEL-1994-CHAR BABEL-1994-VARCHAR BABEL-2086 @@ -168,6 +169,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -208,7 +210,7 @@ insteadof_nested_trigger_with_dml insteadoftriggers_with_transaction ISC-Columns ISC-Table_Constraints -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 is_srvrolemember msdb-dbo-fn_syspolicy_is_automation_enabled msdb-dbo-syspolicy_configuration @@ -256,7 +258,7 @@ sys_database_principals_dep sys-database_recovery_status sys-databases sys-databases-dep -sys-data_spaces +sys-data_spaces-before-16-4 sys-datefirst sys-default_constraints sys-default_constraints-dep @@ -270,7 +272,7 @@ sys-dm_os_host_info sys-endpoints sys-events sys-extended_properties -sys-filegroups +sys-filegroups-before-16-4 sys-filetables sys-filetable_system_defined_objects sys-foreign_key_columns @@ -285,7 +287,7 @@ sys-fulltext_stoplists sys-hash_indexes sys-has_perms_by_name sys-has_perms_by_name-dep -sys-host_name +sys-host_name-before-15_8-or-16_4 sys-identity_columns sys-identity_columns-dep sys-index_columns @@ -412,7 +414,7 @@ datetimeoffset-timezone-before-15_3 BABEL-4046 table_constraint_wo_comma-before-15_6-or-16_2 getdate -BABEL_4330 +BABEL_4330-before-15_8-or-16_4 AUTO_ANALYZE-before-15-5-or-14-10 cast_eliminate order_by_offset_fetch_rows-before-15_6-or-16_2 @@ -426,10 +428,25 @@ BABEL-730-before-15_6-or-16_1 babel-4517 BABEL-4815 BABEL_3571-before-15-5 +upper_lower-before-15_8-or-16_4 BABEL-4641-before-16_3-or-15_7-or-14_12 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +replace-before-15_8-or-16_4 BABEL-4863-before-16_3-or-15_7-or-14_12 babel_726-before-14_12-or-15_7-or-16_3 BABEL-4869 babel_4328_datetime-before-16_3 babel_4328_datetime2-before-16_3 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 babel_4328_datetimeoffset-before-16_3 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/14_8/schedule b/test/JDBC/upgrade/14_8/schedule index 85218a5c2eb..53c543d4b41 100644 --- a/test/JDBC/upgrade/14_8/schedule +++ b/test/JDBC/upgrade/14_8/schedule @@ -37,6 +37,7 @@ BABEL-1963 BABEL-1994-CHAR BABEL-1994-VARCHAR BABEL-2086 +restricted_procedures BABEL-2170 BABEL-2203 BABEL-2208 @@ -166,6 +167,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -206,7 +208,7 @@ insteadof_nested_trigger_with_dml insteadoftriggers_with_transaction ISC-Columns ISC-Table_Constraints -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 is_srvrolemember msdb-dbo-fn_syspolicy_is_automation_enabled msdb-dbo-syspolicy_configuration @@ -254,7 +256,7 @@ sys_database_principals_dep sys-database_recovery_status sys-databases sys-databases-dep -sys-data_spaces +sys-data_spaces-before-16-4 sys-datefirst sys-default_constraints sys-default_constraints-dep @@ -268,7 +270,7 @@ sys-dm_os_host_info sys-endpoints sys-events sys-extended_properties -sys-filegroups +sys-filegroups-before-16-4 sys-filetables sys-filetable_system_defined_objects sys-foreign_key_columns @@ -283,7 +285,7 @@ sys-fulltext_stoplists sys-hash_indexes sys-has_perms_by_name sys-has_perms_by_name-dep -sys-host_name +sys-host_name-before-15_8-or-16_4 sys-identity_columns sys-identity_columns-dep sys-index_columns @@ -410,7 +412,7 @@ datetimeoffset-timezone-before-15_3 BABEL-4046 table_constraint_wo_comma-before-15_6-or-16_2 getdate -BABEL_4330 +BABEL_4330-before-15_8-or-16_4 AUTO_ANALYZE-before-15-5-or-14-10 default_params cast_eliminate @@ -429,9 +431,24 @@ BABEL-4815 BABEL_3571-before-15-5 BABEL_4817 BABEL-4641-before-16_3-or-15_7-or-14_12 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +replace-before-15_8-or-16_4 BABEL-4863-before-16_3-or-15_7-or-14_12 +upper_lower-before-15_8-or-16_4 babel_726-before-14_12-or-15_7-or-16_3 BABEL-4869 babel_4328_datetime-before-16_3 babel_4328_datetime2-before-16_3 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 babel_4328_datetimeoffset-before-16_3 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/14_9/schedule b/test/JDBC/upgrade/14_9/schedule index 8c88c7ebcfb..d1f16ad4454 100644 --- a/test/JDBC/upgrade/14_9/schedule +++ b/test/JDBC/upgrade/14_9/schedule @@ -41,6 +41,7 @@ sys-database_mirroring sys-databases sys-numbered_procedures BABEL-3121 +restricted_procedures sys-events sys-suser_sid sys-trigger_events @@ -58,7 +59,7 @@ routines_definition column_domain_usage constraint_column_usage sp_describe_first_result_set -sys-host_name +sys-host_name-before-15_8-or-16_4 SYSTEM_USER indexproperty sys-all_parameters @@ -206,7 +207,7 @@ BABEL-ROLE-MEMBER tdscollation BABEL-EXTENDEDPROPERTY-before-15_4 BABEL-EXECUTE_AS_CALLER -sys-filegroups +sys-filegroups-before-16-4 sys-filetables sys-fulltext_indexes sys-hash_indexes @@ -252,6 +253,7 @@ BABEL-APPLOCK BABEL-1438 BABEL-SP_DATATYPE_INFO BABEL-SPCOLUMNS +SP_TABLES-dep BABEL-SP_TABLES BABEL-SP_SPECIAL_COLUMNS BABEL-SP_TABLE_PRIVILIGES @@ -285,7 +287,7 @@ sys-change_tracking_tables sys-check_constraints sys-columns sys-computed_columns -sys-data_spaces +sys-data_spaces-before-16-4 sys-database_files sys-database_filestream_options sys-database_recovery_status @@ -368,7 +370,7 @@ BABEL-3640 sys-sysindexes sys-system_objects ISC-Views -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 ISC-Columns #ISC-Check-Constraints ISC-Table_Constraints @@ -410,7 +412,7 @@ orderby BABEL-4046 table_constraint_wo_comma-before-15_6-or-16_2 getdate -BABEL_4330 +BABEL_4330-before-15_8-or-16_4 BABEL-4410 AUTO_ANALYZE-before-15-5-or-14-10 default_params @@ -431,10 +433,25 @@ babel-4517 BABEL-4815 BABEL_3571-before-15-5 BABEL_4817 +upper_lower-before-15_8-or-16_4 BABEL-4641-before-16_3-or-15_7-or-14_12 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +replace-before-15_8-or-16_4 BABEL-4863-before-16_3-or-15_7-or-14_12 babel_726-before-14_12-or-15_7-or-16_3 BABEL-4869 babel_4328_datetime-before-16_3 babel_4328_datetime2-before-16_3 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 babel_4328_datetimeoffset-before-16_3 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/15_1/schedule b/test/JDBC/upgrade/15_1/schedule index e088369ff0a..d4a71a01caa 100644 --- a/test/JDBC/upgrade/15_1/schedule +++ b/test/JDBC/upgrade/15_1/schedule @@ -38,6 +38,7 @@ BABEL-2086 BABEL-2170 BABEL-2203 BABEL-2208 +restricted_procedures BABEL-2257 BABEL-2449 BABEL-2535 @@ -154,6 +155,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -190,7 +192,7 @@ insteadof_nested_trigger_with_dml insteadoftriggers_with_transaction ISC-Columns ISC-Table_Constraints -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 is_srvrolemember msdb-dbo-fn_syspolicy_is_automation_enabled msdb-dbo-syspolicy_configuration @@ -236,7 +238,7 @@ sys_database_principals_dep sys-database_recovery_status sys-databases sys-databases-dep -sys-data_spaces +sys-data_spaces-before-16-4 sys-datefirst sys-default_constraints sys-default_constraints-dep @@ -250,7 +252,7 @@ sys-dm_os_host_info sys-endpoints sys-events sys-extended_properties -sys-filegroups +sys-filegroups-before-16-4 sys-filetables sys-filetable_system_defined_objects sys-foreign_key_columns @@ -265,7 +267,7 @@ sys-fulltext_stoplists sys-hash_indexes sys-has_perms_by_name sys-has_perms_by_name-dep -sys-host_name +sys-host_name-before-15_8-or-16_4 sys-identity_columns sys-identity_columns-dep sys-index_columns @@ -388,7 +390,7 @@ triggers_with_transaction BABEL-4046 table_constraint_wo_comma-before-15_6-or-16_2 getdate -BABEL_4330 +BABEL_4330-before-15_8-or-16_4 AUTO_ANALYZE-before-15-5-or-14-10 default_params cast_eliminate @@ -405,9 +407,24 @@ BABEL-730-before-15_6-or-16_1 babel-4517 BABEL-4815 BABEL_3571-before-15-5 +upper_lower-before-15_8-or-16_4 BABEL-4641-before-16_3-or-15_7-or-14_12 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +replace-before-15_8-or-16_4 BABEL-4863-before-16_3-or-15_7-or-14_12 BABEL-4869 babel_4328_datetime-before-16_3 babel_4328_datetime2-before-16_3 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 babel_4328_datetimeoffset-before-16_3 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/15_2/schedule b/test/JDBC/upgrade/15_2/schedule index 7e189b18453..b2ee35cc663 100644 --- a/test/JDBC/upgrade/15_2/schedule +++ b/test/JDBC/upgrade/15_2/schedule @@ -38,6 +38,7 @@ BABEL-1994-CHAR BABEL-1994-VARCHAR BABEL-2086 BABEL-2170 +restricted_procedures BABEL-2203 BABEL-2208 BABEL-2257 @@ -167,6 +168,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -209,7 +211,7 @@ ISC-Columns isc-schemata-dep ISC-sequences ISC-Table_Constraints -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 ISC-Views is_srvrolemember jira-BABEL-3504-upgrade @@ -261,7 +263,7 @@ sys_database_principals_dep sys-database_recovery_status sys-databases sys-databases-dep -sys-data_spaces +sys-data_spaces-before-16-4 sys-datefirst sys-default_constraints sys-default_constraints-dep @@ -275,7 +277,7 @@ sys-dm_os_host_info sys-endpoints sys-events sys-extended_properties -sys-filegroups +sys-filegroups-before-16-4 sys-filetables sys-filetable_system_defined_objects sys-foreign_key_columns @@ -290,7 +292,7 @@ sys-fulltext_stoplists sys-hash_indexes sys-has_perms_by_name sys-has_perms_by_name-dep -sys-host_name +sys-host_name-before-15_8-or-16_4 sys-identity_columns sys-identity_columns-dep sys-index_columns @@ -418,7 +420,7 @@ datetimeoffset-timezone-before-15_3 BABEL-4046 table_constraint_wo_comma-before-15_6-or-16_2 getdate -BABEL_4330 +BABEL_4330-before-15_8-or-16_4 BABEL-4410 AUTO_ANALYZE-before-15-5-or-14-10 default_params @@ -437,7 +439,14 @@ GRANT_SCHEMA-before-15_7-16_3 babel-4475 babel-4517 BABEL_3571-before-15-5 +upper_lower-before-15_8-or-16_4 BABEL-4641-before-16_3-or-15_7-or-14_12 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +replace-before-15_8-or-16_4 BABEL-4863-before-16_3-or-15_7-or-14_12 babel_test_int4_numeric_oper_before_16_3 babel_test_int8_numeric_oper_before_16_3 @@ -445,4 +454,12 @@ babel_test_int2_numeric_oper_before_16_3 BABEL-4869 babel_4328_datetime-before-16_3 babel_4328_datetime2-before-16_3 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 babel_4328_datetimeoffset-before-16_3 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/15_3/schedule b/test/JDBC/upgrade/15_3/schedule index df115b82ca2..5d159edde63 100644 --- a/test/JDBC/upgrade/15_3/schedule +++ b/test/JDBC/upgrade/15_3/schedule @@ -39,6 +39,7 @@ BABEL-1994-VARCHAR BABEL-2086 BABEL-2170 BABEL-2203 +restricted_procedures BABEL-2208 BABEL-2257 BABEL-2449 @@ -52,7 +53,7 @@ BABEL-2805 BABEL-2812 BABEL-2819 BABEL-2845 -BABEL-2877 +babelfish_function_ext-before_16_4_or_15_8_or_14_13 BABEL-2884 BABEL-2917 BABEL-2944 @@ -177,6 +178,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -220,7 +222,7 @@ ISC-Columns isc-schemata-dep ISC-sequences ISC-Table_Constraints -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 ISC-Views is_srvrolemember jira-BABEL-3504-upgrade @@ -275,7 +277,7 @@ sys_syslogins_dep sys-database_recovery_status sys-databases sys-databases-dep -sys-data_spaces +sys-data_spaces-before-16-4 sys-datefirst sys-default_constraints sys-default_constraints-dep @@ -289,7 +291,7 @@ sys-dm_os_host_info sys-endpoints sys-events sys-extended_properties -sys-filegroups +sys-filegroups-before-16-4 sys-filetables sys-filetable_system_defined_objects sys-foreign_key_columns @@ -304,7 +306,7 @@ sys-fulltext_stoplists sys-hash_indexes sys-has_perms_by_name sys-has_perms_by_name-dep -sys-host_name +sys-host_name-before-15_8-or-16_4 sys-identity_columns sys-identity_columns-dep sys-index_columns @@ -442,7 +444,7 @@ datetimeoffset-timezone BABEL-4046 table_constraint_wo_comma-before-15_6-or-16_2 getdate -BABEL_4330 +BABEL_4330-before-15_8-or-16_4 AUTO_ANALYZE-before-15-5-or-14-10 default_params cast_eliminate @@ -459,9 +461,24 @@ BABEL-730-before-15_6-or-16_1 babel-4517 BABEL-4815 BABEL_3571-before-15-5 +upper_lower-before-15_8-or-16_4 BABEL-4641-before-16_3-or-15_7-or-14_12 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +replace-before-15_8-or-16_4 BABEL-4863-before-16_3-or-15_7-or-14_12 BABEL-4869 babel_4328_datetime-before-16_3 babel_4328_datetime2-before-16_3 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 babel_4328_datetimeoffset-before-16_3 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/15_4/schedule b/test/JDBC/upgrade/15_4/schedule index a8dcd237720..bb8fe4d3a54 100644 --- a/test/JDBC/upgrade/15_4/schedule +++ b/test/JDBC/upgrade/15_4/schedule @@ -41,6 +41,7 @@ BABEL-2170 BABEL-2203 BABEL-2208 BABEL-2257 +restricted_procedures BABEL-2449 BABEL-2535 BABEL-2688 @@ -52,7 +53,7 @@ BABEL-2805 BABEL-2812 BABEL-2819 BABEL-2845 -BABEL-2877 +babelfish_function_ext-before_16_4_or_15_8_or_14_13 BABEL-2884 BABEL-2917 BABEL-2944 @@ -179,6 +180,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -223,7 +225,7 @@ ISC-Columns isc-schemata-dep ISC-sequences ISC-Table_Constraints -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 ISC-Views is_srvrolemember jira-BABEL-3504-upgrade @@ -279,7 +281,7 @@ sys_syslogins_dep sys-database_recovery_status sys-databases sys-databases-dep -sys-data_spaces +sys-data_spaces-before-16-4 sys-datefirst sys-default_constraints sys-default_constraints-dep @@ -295,7 +297,7 @@ sys-eomonth sys-events sys-extended_properties sys-sql_expression_dependencies -sys-filegroups +sys-filegroups-before-16-4 sys-filetables sys-filetable_system_defined_objects sys-foreign_key_columns @@ -310,7 +312,7 @@ sys-fulltext_stoplists sys-hash_indexes sys-has_perms_by_name sys-has_perms_by_name-dep -sys-host_name +sys-host_name-before-15_8-or-16_4 sys-identity_columns sys-identity_columns-dep sys-index_columns @@ -453,7 +455,7 @@ host_id linked_srv_4229 BABEL-4175 sp_who -BABEL_4330 +BABEL_4330-before-15_8-or-16_4 BABEL-4410 AUTO_ANALYZE-before-15-5-or-14-10 default_params @@ -471,9 +473,24 @@ BABEL-730-before-15_6-or-16_1 GRANT_SCHEMA-before-15_7-16_3 babel-4517 BABEL_3571-before-15-5 +upper_lower-before-15_8-or-16_4 BABEL-4641-before-16_3-or-15_7-or-14_12 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +replace-before-15_8-or-16_4 BABEL-4863-before-16_3-or-15_7-or-14_12 BABEL-4869 babel_4328_datetime-before-16_3 babel_4328_datetime2-before-16_3 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 babel_4328_datetimeoffset-before-16_3 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/15_5/schedule b/test/JDBC/upgrade/15_5/schedule index c2b37fcee31..df75c843ab6 100644 --- a/test/JDBC/upgrade/15_5/schedule +++ b/test/JDBC/upgrade/15_5/schedule @@ -40,6 +40,7 @@ BABEL-1994-VARCHAR BABEL-2086 BABEL-2170 BABEL-2203 +restricted_procedures BABEL-2208 BABEL-2257 BABEL-2449 @@ -52,7 +53,7 @@ BABEL-2795 BABEL-2805 BABEL-2819 BABEL-2845 -BABEL-2877 +babelfish_function_ext-before_16_4_or_15_8_or_14_13 BABEL-2884 BABEL-2917 BABEL-2944 @@ -183,6 +184,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -229,7 +231,7 @@ ISC-Columns isc-schemata-dep ISC-sequences ISC-Table_Constraints -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 ISC-Views is_srvrolemember jira-BABEL-3504-upgrade @@ -287,7 +289,7 @@ sys_syslogins_dep sys-database_recovery_status sys-databases sys-databases-dep -sys-data_spaces +sys-data_spaces-before-16-4 sys-datefirst sys-default_constraints sys-default_constraints-dep @@ -303,7 +305,7 @@ sys-eomonth sys-events sys-extended_properties sys-sql_expression_dependencies -sys-filegroups +sys-filegroups-before-16-4 sys-filetables sys-filetable_system_defined_objects sys-foreign_key_columns @@ -318,7 +320,7 @@ sys-fulltext_stoplists sys-hash_indexes sys-has_perms_by_name sys-has_perms_by_name-dep -sys-host_name +sys-host_name-before-15_8-or-16_4 sys-identity_columns sys-identity_columns-dep sys-index_columns @@ -469,7 +471,7 @@ host_id linked_srv_4229 BABEL-4175 sp_who -BABEL_4330 +BABEL_4330-before-15_8-or-16_4 kill BABEL-4217 Test_ISNULL @@ -502,9 +504,24 @@ BABEL-492-before-15_6 GRANT_SCHEMA-before-15_7-16_3 BABEL-4815 BABEL_3571-15_5-or-15_6-or-16_1-or-16_2 +upper_lower-before-15_8-or-16_4 BABEL-4641-before-16_3-or-15_7-or-14_12 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +replace-before-15_8-or-16_4 BABEL-4863-before-16_3-or-15_7-or-14_12 BABEL-4869 babel_4328_datetime-before-16_3 babel_4328_datetime2-before-16_3 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 babel_4328_datetimeoffset-before-16_3 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/15_6/schedule b/test/JDBC/upgrade/15_6/schedule index f61de8c960f..22e0e3d4309 100644 --- a/test/JDBC/upgrade/15_6/schedule +++ b/test/JDBC/upgrade/15_6/schedule @@ -41,6 +41,7 @@ BABEL-2086 BABEL-2170 BABEL-2203 BABEL-2208 +restricted_procedures BABEL-2257 BABEL-2449 BABEL-2535 @@ -53,7 +54,7 @@ BABEL-2805 BABEL-2812 BABEL-2819 BABEL-2845 -BABEL-2877 +babelfish_function_ext-before_16_4_or_15_8_or_14_13 BABEL-2884 BABEL-2917 BABEL-2944 @@ -186,6 +187,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -235,7 +237,7 @@ ISC-Columns isc-schemata-dep ISC-sequences ISC-Table_Constraints -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 ISC-Views is_srvrolemember jira-BABEL-3504-upgrade @@ -293,7 +295,7 @@ sys_syslogins_dep sys-database_recovery_status sys-databases sys-databases-dep -sys-data_spaces +sys-data_spaces-before-16-4 sys-datefirst sys-default_constraints sys-default_constraints-dep @@ -309,7 +311,7 @@ sys-eomonth sys-events sys-extended_properties sys-sql_expression_dependencies -sys-filegroups +sys-filegroups-before-16-4 sys-filetables sys-filetable_system_defined_objects sys-foreign_key_columns @@ -324,7 +326,7 @@ sys-fulltext_stoplists sys-hash_indexes sys-has_perms_by_name sys-has_perms_by_name-dep -sys-host_name +sys-host_name-before-15_8-or-16_4 sys-identity_columns sys-identity_columns-dep sys-index_columns @@ -480,7 +482,7 @@ drop_index linked_srv_4229 BABEL-4175 sp_who -BABEL_4330 +BABEL_4330-before-15_8-or-16_4 kill set_tran_isolvl BABEL-4217 @@ -510,6 +512,13 @@ BABEL-730 babel-4475 babel-4517 GRANT_SCHEMA-before-15_7-16_3 +upper_lower-before-15_8-or-16_4 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +replace-before-15_8-or-16_4 BABEL-4815 BABEL_3571-15_5-or-15_6-or-16_1-or-16_2 BABEL-4641-before-16_3-or-15_7-or-14_12 @@ -523,4 +532,12 @@ babel_test_int2_numeric_oper_before_16_3 BABEL-4869 babel_4328_datetime-before-16_3 babel_4328_datetime2-before-16_3 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 babel_4328_datetimeoffset-before-16_3 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/15_7/schedule b/test/JDBC/upgrade/15_7/schedule index fdc651c30ea..785b29bd306 100644 --- a/test/JDBC/upgrade/15_7/schedule +++ b/test/JDBC/upgrade/15_7/schedule @@ -39,6 +39,7 @@ BABEL-1994-CHAR BABEL-1994-VARCHAR BABEL-2086 BABEL-2170 +restricted_procedures BABEL-2203 BABEL-2208 BABEL-2257 @@ -53,7 +54,7 @@ BABEL-2805 BABEL-2812 BABEL-2819 BABEL-2845 -BABEL-2877 +babelfish_function_ext-before_16_4_or_15_8_or_14_13 BABEL-2884 BABEL-2917 BABEL-2944 @@ -123,6 +124,7 @@ BABEL-4214 BABEL-4516 babel_417 BABEL-493 +BABEL-4888 BABEL_539 BABEL-621 BABEL-728 @@ -149,6 +151,7 @@ babelfish_authid_user_ext babelfish_cast_floor babelfish_inconsistent_metadata babelfish_integrity_checker +check_for_inconsistent_metadata babelfish_migration_mode babelfish_namespace_ext babelfish_sysdatabases @@ -185,6 +188,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -234,7 +238,7 @@ ISC-Columns isc-schemata-dep ISC-sequences ISC-Table_Constraints -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 ISC-Views is_srvrolemember jira-BABEL-3504-upgrade @@ -268,7 +272,7 @@ sys_all_objects-dep sys-all_parameters sys-all_parameters-dep sys-all_sql_modules -sys-all_sql_modules-before-15_7-or-16_2-dep +sys-all_sql_modules-dep sys-all_views sys-assemblies sys-assembly_modules @@ -292,7 +296,7 @@ sys_syslogins_dep sys-database_recovery_status sys-databases sys-databases-dep -sys-data_spaces +sys-data_spaces-before-16-4 sys-datefirst sys-default_constraints sys-default_constraints-dep @@ -308,7 +312,7 @@ sys-eomonth sys-events sys-extended_properties sys-sql_expression_dependencies -sys-filegroups +sys-filegroups-before-16-4 sys-filetables sys-filetable_system_defined_objects sys-foreign_key_columns @@ -323,7 +327,7 @@ sys-fulltext_stoplists sys-hash_indexes sys-has_perms_by_name sys-has_perms_by_name-dep -sys-host_name +sys-host_name-before-15_8-or-16_4 sys-identity_columns sys-identity_columns-dep sys-index_columns @@ -365,7 +369,7 @@ sys-sp_statistics-dep sys-sp_tables_view sys-sp_tables_view-dep sys-sql_modules -sys-sql_modules-before-15_7-or-16_2-dep +sys-sql_modules-dep sys-stats sys-suser_sid sys-suser_sname @@ -479,7 +483,7 @@ drop_index linked_srv_4229 BABEL-4175 sp_who -BABEL_4330 +BABEL_4330-before-15_8-or-16_4 kill set_tran_isolvl BABEL-4217 @@ -508,17 +512,39 @@ sys_availability_replicas BABEL-730 babel-4475 babel-4517 -BABEL-4815 +alter-procedure-before-15_8-or-16_4 +babel_table_type +1_GRANT_SCHEMA +BABEL-4707 +BABEL_4817 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +replace-before-15_8-or-16_4 BABEL-4641 BABEL-4863 babel_test_int4_numeric_oper babel_test_int8_numeric_oper babel_test_int2_numeric_oper BABEL_3571 +login_token-dep test_like_for_AI +babel_726 BABEL-4869 +upper_lower-before-15_8-or-16_4 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 +BABEL-4815 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +BABEL-3401 babel_4328_datetime babel_4328_datetime2 babel_4328_datetimeoffset -BABEL-3401 -babel_726 +BABEL-3820 +replicate-before-15_8-or-16_4 +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/15_8/schedule b/test/JDBC/upgrade/15_8/schedule index aba4137c63f..602263ca069 100644 --- a/test/JDBC/upgrade/15_8/schedule +++ b/test/JDBC/upgrade/15_8/schedule @@ -40,6 +40,7 @@ BABEL-1994-VARCHAR BABEL-2086 BABEL-2170 BABEL-2203 +restricted_procedures BABEL-2208 BABEL-2257 BABEL-2449 @@ -53,7 +54,7 @@ BABEL-2805 BABEL-2812 BABEL-2819 BABEL-2845 -BABEL-2877 +babelfish_function_ext BABEL-2884 BABEL-2917 BABEL-2944 @@ -90,7 +91,7 @@ BABEL-3402 BABEL-3474 BABEL-3478 BABEL-3486 -BABEL-3513_before_15_8_or_16_4 +BABEL-3513 BABEL-3556 BABEL-3588 BABEL-3614 @@ -123,6 +124,7 @@ BABEL-4214 BABEL-4516 babel_417 BABEL-493 +BABEL-4888 BABEL_539 BABEL-621 BABEL-728 @@ -185,6 +187,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -245,7 +248,7 @@ msdb-dbo-syspolicy_configuration msdb-dbo-syspolicy_system_health_state nested_trigger_inside_proc nested_trigger_with_dml -newid_before_15_8_or_16_4 +newid objectpropertyex openjson openquery_upgrd_before_15_4 @@ -291,7 +294,7 @@ sys_syslogins_dep sys-database_recovery_status sys-databases sys-databases-dep -sys-data_spaces +sys-data_spaces-before-16-4 sys-datefirst sys-default_constraints sys-default_constraints-dep @@ -307,7 +310,7 @@ sys-eomonth sys-events sys-extended_properties sys-sql_expression_dependencies -sys-filegroups +sys-filegroups-before-16-4 sys-filetables sys-filetable_system_defined_objects sys-foreign_key_columns @@ -520,3 +523,18 @@ babel_4328_datetime2 babel_4328_datetimeoffset BABEL-3401 babel_726 +upper_lower +trim +ltrim +rtrim +left +right +translate +substring +reverse +stuff +replicate +space +replace +binary-datatype-operators + diff --git a/test/JDBC/upgrade/15_9/schedule b/test/JDBC/upgrade/15_9/schedule new file mode 100644 index 00000000000..602263ca069 --- /dev/null +++ b/test/JDBC/upgrade/15_9/schedule @@ -0,0 +1,540 @@ +# Schedule File for JDBC Test Framework for local run +# 1. Lines starting with '#' will be treated as comments +# 2. To run a postgres command: cmd#!#postgresql#!# +# 3. To run a T-SQL command: cmd#!#sqlserver#!# +# 4. Keyword "all" is equivalent to running all test files in input folder +# 5. To add a test, add test name (without extension, , and . For example if test file name is TestBigInt.txt write TestBigInt) on a new line + +# This should be the first test to check there are no duplicated object_ids +BABEL-3613 + +app_name +atn2 +ATTIMEZONE-dep +AVG-Aggregate-common +AVG-Aggregate-Dep +BABEL-1062 +BABEL-1189 +BABEL-1206 +BABEL-1243 +BABEL-1249 +BABEL-1251 +BABEL-1291 +BABEL-1319 +BABEL-1438 +BABEL-1444 +BABEL-1465 +BABEL-1466 +BABEL-1475 +BABEL-1493 +BABEL-1510 +BABEL-1566 +BABEL-1625 +BABEL-1654 +BABEL-1683 +BABEL-1715 +BABEL-1953 +BABEL-1963 +BABEL-1994-CHAR +BABEL-1994-VARCHAR +BABEL-2086 +BABEL-2170 +BABEL-2203 +restricted_procedures +BABEL-2208 +BABEL-2257 +BABEL-2449 +BABEL-2535 +BABEL-2688 +BABEL-2765 +BABEL-2787 +BABEL-2787-2 +BABEL-2795 +BABEL-2805 +BABEL-2812 +BABEL-2819 +BABEL-2845 +babelfish_function_ext +BABEL-2884 +BABEL-2917 +BABEL-2944 +BABEL-2955 +BABEL-3000 +BABEL-3000-dep +BABEL-3010 +BABEL-3116 +BABEL-3117 +BABEL-3118 +BABEL-3121 +BABEL-3144 +BABEL-3147 +BABEL-3166 +BABEL-3192 +BABEL-3204 +BABEL-3213 +BABEL-3215 +BABEL-3221 +BABEL-3234 +BABEL-3249 +BABEL-3268 +BABEL-328 +BABEL-3314 +BABEL-3326 +BABEL-3347 +BABEL-3358 +BABEL-3360 +BABEL-3369 +BABEL-3370 +BABEL-3380 +BABEL-3392 +BABEL-3402 +BABEL-3474 +BABEL-3478 +BABEL-3486 +BABEL-3513 +BABEL-3556 +BABEL-3588 +BABEL-3614 +BABEL-3640 +BABEL-3646 +BABEL-3655 +BABEL-3657 +BABEL-3696 +BABEL-3697 +BABEL-3702 +BABEL-3725 +BABEL-3747 +BABEL-3748 +BABEL-3781 +BABEL-3801 +BABEL-3802 +BABEL-3818 +BABEL-3828 +BABEL-383 +BABEL-3844 +BABEL-3914 +BABEL-3938 +BABEL-3952 +BABEL-3953-datetrunc +BABEL-404 +BABEL-405 +BABEL-4078 +BABEL-4098 +BABEL-4214 +BABEL-4516 +babel_417 +BABEL-493 +BABEL-4888 +BABEL_539 +BABEL-621 +BABEL-728 +BABEL-733 +BABEL-741 +BABEL-745 +BABEL-775 +BABEL-889 +BABEL-937 +BABEL-APPLOCK +babel_char +BABEL-CHECK-CONSTRAINT +babel_context_info +BABEL-CROSS-DB +babel_datatype_sqlvariant +babel_datetime +Babel_domain_mapping_test +BABEL-EXECUTE_AS_CALLER +BABEL-EXTENDEDPROPERTY +BABEL-EXTENDEDPROPERTY-v2 +babel_int4_varbinary_div +babelfish_authid_login_ext +babelfish_authid_user_ext +babelfish_cast_floor +babelfish_inconsistent_metadata +babelfish_integrity_checker +babelfish_migration_mode +babelfish_namespace_ext +babelfish_sysdatabases +babel_function_string +BABEL_GRANT_CONNECT +babel_isnumeric +BABEL_COL_NAME +BABEL-LOGIN +BABEL-LOGIN-USER-EXT +BABEL-NEXT-VALUE-FOR +BABEL_OBJECT_DEFINITION +BABEL_OBJECT_ID +BABEL_OBJECT_NAME +BABEL-PG-SYSTEM-FUNCTIONS +BABEL-PROCID +BABEL-RAND +BABEL-ROLE +BABEL-ROLE-MEMBER +BABEL_SCHEMATA +BABEL-SPCOLUMNS +BABEL-SPCOLUMNS-dep +BABEL-SP_COLUMNS_MANAGED-dep +BABEL-SP_DATATYPE_INFO +BABEL-SP_FKEYS +BABEL-SP_FKEYS-dep +BABEL-sp_helpdb +BABEL-SP_SPECIAL_COLUMNS +BABEL-SP_SPECIAL_COLUMNS_100-dep +BABEL-SP_SPECIAL_COLUMNS-dep +BABEL-SP_SPROC_COLUMNS +BABEL-SP_SPROC_COLUMNS_100-dep +BABEL-SP_SPROC_COLUMNS-dep +BABEL-SP_STORED_PROCEDURES +BABEL-SP_STORED_PROCEDURES-dep +BABEL-SP_TABLE_PRIVILIGES +BABEL-SP_TABLES +SP_TABLES-dep +babel_sqlvariant_cast_compare +BABEL-SQUARE +BABEL-TABLEOPTIONS +babel_trigger +babel_try_parse +BABEL-USER +babel_varbinary_int4_div +bbf_view_def +binary-index +bitwise_not-operator +case_insensitive_collation +cast_numeric_types_to_datetime +cast_numeric_types_to_smalldatetime +col_length +collation_tests +collation_tests_arabic +collation_tests_greek +collation_tests_mongolian +collation_tests_polish +column_domain_usage +constraint_column_usage +dateadd_internal_df +datediff_big +datediff +dateadd +datepart +datetime2fromparts-after-15-2 +forjson +forjson-datatypes +forjson-subquery +forjson-nesting +format +format-dep +forxml +forxml-subquery +fulltextserviceproperty +FULLTEXT_INDEX +fts-contains +get_tds_id +HAS_DBACCESS +identity_function +indexproperty +insteadof_nested_trigger_inside_proc +insteadof_nested_trigger_with_dml +insteadoftriggers_with_transaction +ISC-Columns +isc-schemata-dep +ISC-sequences +ISC-Table_Constraints +ISC-Tables +ISC-Views +is_srvrolemember +jira-BABEL-3504-upgrade +key_column_usage +linked_servers +msdb-dbo-fn_syspolicy_is_automation_enabled +msdb-dbo-syspolicy_configuration +msdb-dbo-syspolicy_system_health_state +nested_trigger_inside_proc +nested_trigger_with_dml +newid +objectpropertyex +openjson +openquery_upgrd_before_15_4 +orderby +routines_definition +rowcount +schema_resolution_func +schema_resolution_proc +schema_resolution_trigger +select-strip-parens +sp_describe_first_result_set +sp_tablecollations +smalldatetimefromparts-dep +str +switchoffset-dep +sys-all_columns +sys-all_columns-dep +sys_all_objects +sys_all_objects-dep +sys-all_parameters +sys-all_parameters-dep +sys-all_sql_modules +sys-all_views +sys-assemblies +sys-assembly_modules +sys-assembly_types +sys_babelfish_configurations_view +sys-change_tracking_databases +sys-change_tracking_tables +sys-check_constraints +sys-check_constraints-dep +sys-column-property +sys-columns +sys-columns-dep +sys-computed_columns +sys-computed_columns-dep +sys-configurations +sys-database_files +sys-database_filestream_options +sys-database_mirroring +sys_database_principals_dep +sys_syslogins_dep +sys-database_recovery_status +sys-databases +sys-databases-dep +sys-data_spaces-before-16-4 +sys-datefirst +sys-default_constraints +sys-default_constraints-dep +sys-dm_exec_connections +sys-dm_exec_connections-dep +sys-dm_exec_sessions +sys-dm_exec_sessions-dep +sys-dm_hadr_cluster +sys-dm_hadr_database_replica_states +sys-dm_os_host_info +sys-endpoints +sys-eomonth +sys-events +sys-extended_properties +sys-sql_expression_dependencies +sys-filegroups-before-16-4 +sys-filetables +sys-filetable_system_defined_objects +sys-foreign_key_columns +sys-foreign_key_columns-dep +sys-foreign_keys +sys-foreign_keys-dep +sys-fulltext_catalogs +sys-fulltext_index_columns +sys-fulltext_indexes +sys-fulltext_languages +sys-fulltext_stoplists +sys-hash_indexes +sys-has_perms_by_name +sys-has_perms_by_name-dep +sys-host_name +sys-identity_columns +sys-identity_columns-dep +sys-index_columns +sys-index_columns-dep +sys-indexes +sys-indexes-dep +sys-key_constraints +sys-key_constraints-dep +sys-lock_timeout +sys-master_files +sys-max_connections +sys-nestlevel-dep +sys-numbered_procedures +sys-objects +sys-original_login +sys-parsename +sys-partitions +sys-partitions-dep +sys-plan_guides +sys-procedures +sys-proc_param_helper-dep +sys-registered_search_property_lists +sys-schema-name +sys-schemas +sys-schemas-dep +sys-selective_xml_index_paths +sys-server_principals +sys_server_role_members +sys_server_principals_dep +sys-sid_binary +sys-spatial_indexes +sys-spatial_index_tessellations +sys-sp_databases +sys-sp_databases-dep +sys-sp_pkeys +sys-sp_pkeys-dep +sys-sp_statistics +sys-sp_statistics-dep +sys-sp_tables_view +sys-sp_tables_view-dep +sys-sql_modules +sys-stats +sys-suser_sid +sys-suser_sname +sys-synonyms +sys-syscharsets +sys-syscolumns +sys-syscolumns-dep +sys-sysdatabases +sys-sysforeignkeys +sys-sysforeignkeys-dep +sys-sysindexes +sys-syslanguages +sys-sysobjects +sys-system_objects +sys-system_sql_modules +sys-system_sql_modules-dep +sys-systypes +sys_sysusers_dep +sys-tables +sys-tables-dep +sys-table_types +sys-table_types-dep +sys-table_types_internal +sys-table_types_internal-dep +SYSTEM_USER +sys-trigger_events +sys-trigger_nestlevel +sys-triggers +sys-triggers-dep +sys-types +sys-types-dep +sys-userid +sys-views +sys-views-dep +sys-xml_indexes +sys-xml_schema_collections +table-variable +tdscollation +temp-tables +TestBigInt +TestBinary +TestBIT +TestChar +Test-Computed-Columns +TestDate +TestDatetime +TestDatetime2 +TestDatetime-numeric-dateaddfunction +TestDatetime-numeric-representation +TestDecimal +TestFloat +Test-Identity +TestImage +TestInt +TestMoney +TestNotNull +TestNumeric +TestReal +TestRowVersion +TestSmallDatetime +TestSmallInt +TestSmallMoney +TestSpatialPoint +Test-sp_addrole +Test-sp_addrolemember +Test-sp_babelfish_volatility +Test-sp_droprole +Test-sp_droprolemember +Test-sp_execute_postgresql +Test-sp_helpdbfixedrole +Test-sp_helprole-dep +Test-sp_helprolemember-dep +Test-sp_helpsrvrolemember +Test-sp_helpuser +Test-sp_rename +Test-sp_rename-dep +Test-sp_set_session_context +Test-sp_set_session_context-dep +TestSQLVariant +TestTableType +TestText +TestTime +TestTinyInt +TestUDD +TestUniqueIdentifier +Test_user_from_win_login +TestVarChar +TestVariableDataLength +test_windows_alter_login +test_windows_alter_user +test_windows_login +test_windows_sp_helpuser +TestXML +timefromparts +todatetimeoffset-dep +triggers_with_transaction +typeid-typename +typeid-typename-dep +print_null +unquoted_string +doublequoted_string +operator_whitespace +operator_atatvar +alter_authorization_change_db_owner +sp_changedbowner +float_exponent +datetimeoffset-timezone +BABEL-4046 +host_id +drop_index +linked_srv_4229 +BABEL-4175 +sp_who +BABEL_4330 +kill +set_tran_isolvl +BABEL-4217 +Test_ISNULL +BABEL-4270 +BABEL-4410 +BABEL-4231 +function_as_keywd +typeproperty-dep +sys_asymmetric_keys +sys_certificates +sys_database_permissions +#BABEL-4279 +BABEL-4484 +pivot +#AUTO_ANALYZE #uncomment this test when preparing for new minor version +cast_eliminate +TestDatatypeAggSort +babel_index_nulls_order +BABEL-2999 +BABEL-4606 +BABEL-4672 +BABEL-4529 +sys_availability_groups +sys_availability_replicas +BABEL-730 +babel-4475 +babel-4517 +BABEL-4815 +BABEL-4641 +BABEL-4863 +babel_test_int4_numeric_oper +babel_test_int8_numeric_oper +babel_test_int2_numeric_oper +BABEL_3571 +test_like_for_AI +BABEL-4869 +babel_4328_datetime +babel_4328_datetime2 +babel_4328_datetimeoffset +BABEL-3401 +babel_726 +upper_lower +trim +ltrim +rtrim +left +right +translate +substring +reverse +stuff +replicate +space +replace +binary-datatype-operators + diff --git a/test/JDBC/upgrade/16_1/schedule b/test/JDBC/upgrade/16_1/schedule index 3338f7394dd..83a4c9b353d 100644 --- a/test/JDBC/upgrade/16_1/schedule +++ b/test/JDBC/upgrade/16_1/schedule @@ -42,6 +42,7 @@ BABEL-2170 BABEL-2203 BABEL-2208 BABEL-2257 +restricted_procedures BABEL-2449 BABEL-2535 BABEL-2688 @@ -53,7 +54,7 @@ BABEL-2805 BABEL-2812 BABEL-2819 BABEL-2845 -BABEL-2877 +babelfish_function_ext-before_16_4_or_15_8_or_14_13 BABEL-2884 BABEL-2917 BABEL-2944 @@ -185,6 +186,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -234,7 +236,7 @@ ISC-Columns isc-schemata-dep ISC-sequences ISC-Table_Constraints -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 ISC-Views is_srvrolemember jira-BABEL-3504-upgrade @@ -292,7 +294,7 @@ sys_syslogins_dep sys-database_recovery_status sys-databases sys-databases-dep -sys-data_spaces +sys-data_spaces-before-16-4 sys-datefirst sys-default_constraints sys-default_constraints-dep @@ -308,7 +310,7 @@ sys-eomonth sys-events sys-extended_properties sys-sql_expression_dependencies -sys-filegroups +sys-filegroups-before-16-4 sys-filetables sys-filetable_system_defined_objects sys-foreign_key_columns @@ -323,7 +325,7 @@ sys-fulltext_stoplists sys-hash_indexes sys-has_perms_by_name sys-has_perms_by_name-dep -sys-host_name +sys-host_name-before-15_8-or-16_4 sys-identity_columns sys-identity_columns-dep sys-index_columns @@ -473,7 +475,7 @@ host_id linked_srv_4229 BABEL-4175 sp_who -BABEL_4330 +BABEL_4330-before-15_8-or-16_4 kill BABEL-4217 Test_ISNULL @@ -516,3 +518,19 @@ babel_4328_datetime-before-16_3 babel_4328_datetime2-before-16_3 babel_4328_datetimeoffset-before-16_3 babel_726-before-14_12-or-15_7-or-16_3 +BABEL-5071 +upper_lower-before-15_8-or-16_4 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +replace-before-15_8-or-16_4 +binary-datatype-operators + diff --git a/test/JDBC/upgrade/16_2/schedule b/test/JDBC/upgrade/16_2/schedule index 5102ae1bfaf..f0ea7bfc92f 100644 --- a/test/JDBC/upgrade/16_2/schedule +++ b/test/JDBC/upgrade/16_2/schedule @@ -46,6 +46,7 @@ BABEL-2449 BABEL-2535 BABEL-2688 BABEL-2765 +restricted_procedures BABEL-2787 BABEL-2787-2 BABEL-2795 @@ -53,7 +54,7 @@ BABEL-2805 BABEL-2812 BABEL-2819 BABEL-2845 -BABEL-2877 +babelfish_function_ext-before_16_4_or_15_8_or_14_13 BABEL-2884 BABEL-2917 BABEL-2944 @@ -186,6 +187,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -237,7 +239,7 @@ ISC-Columns isc-schemata-dep ISC-sequences ISC-Table_Constraints -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 ISC-Views is_srvrolemember jira-BABEL-3504-upgrade @@ -295,7 +297,7 @@ sys_syslogins_dep sys-database_recovery_status sys-databases sys-databases-dep -sys-data_spaces +sys-data_spaces-before-16-4 sys-datefirst sys-default_constraints sys-default_constraints-dep @@ -311,7 +313,7 @@ sys-eomonth sys-events sys-extended_properties sys-sql_expression_dependencies -sys-filegroups +sys-filegroups-before-16-4 sys-filetables sys-filetable_system_defined_objects sys-foreign_key_columns @@ -326,7 +328,7 @@ sys-fulltext_stoplists sys-hash_indexes sys-has_perms_by_name sys-has_perms_by_name-dep -sys-host_name +sys-host_name-before-15_8-or-16_4 sys-identity_columns sys-identity_columns-dep sys-index_columns @@ -484,7 +486,7 @@ drop_index linked_srv_4229 BABEL-4175 sp_who -BABEL_4330 +BABEL_4330-before-15_8-or-16_4 kill set_tran_isolvl BABEL-4217 @@ -531,3 +533,19 @@ BABEL-4869 babel_4328_datetime-before-16_3 babel_4328_datetime2-before-16_3 babel_4328_datetimeoffset-before-16_3 +BABEL-5071 +upper_lower-before-15_8-or-16_4 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +replace-before-15_8-or-16_4 +binary-datatype-operators + diff --git a/test/JDBC/upgrade/16_3/schedule b/test/JDBC/upgrade/16_3/schedule index caf0fda5ac6..0bc21e6c303 100644 --- a/test/JDBC/upgrade/16_3/schedule +++ b/test/JDBC/upgrade/16_3/schedule @@ -45,6 +45,7 @@ BABEL-2257 BABEL-2449 BABEL-2535 BABEL-2688 +restricted_procedures BABEL-2765 BABEL-2787 BABEL-2787-2 @@ -53,7 +54,7 @@ BABEL-2805 BABEL-2812 BABEL-2819 BABEL-2845 -BABEL-2877 +babelfish_function_ext-before_16_4_or_15_8_or_14_13 BABEL-2884 BABEL-2917 BABEL-2944 @@ -66,6 +67,7 @@ BABEL-3117 BABEL-3118 BABEL-3121 BABEL-3144 +BABEL-3147 BABEL-3166 BABEL-3192 BABEL-3204 @@ -114,6 +116,7 @@ BABEL-3914 BABEL-3938 BABEL-3952 BABEL-3953-datetrunc +BABEL-404 BABEL-405 BABEL-4078 BABEL-4098 @@ -122,6 +125,7 @@ BABEL-4516 babel_417 BABEL-493 BABEL_539 +BABEL-621 BABEL-728 BABEL-733 BABEL-741 @@ -146,6 +150,7 @@ babelfish_authid_user_ext babelfish_cast_floor babelfish_inconsistent_metadata babelfish_integrity_checker +check_for_inconsistent_metadata babelfish_migration_mode babelfish_namespace_ext babelfish_sysdatabases @@ -182,6 +187,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -222,6 +228,7 @@ fulltextserviceproperty FULLTEXT_INDEX fts-contains fts-contains-utils +BABEL-4785 get_tds_id HAS_DBACCESS identity_function @@ -233,7 +240,7 @@ ISC-Columns isc-schemata-dep ISC-sequences ISC-Table_Constraints -ISC-Tables +ISC-Tables-before_16_4_or_15_8_or_14_13 ISC-Views is_srvrolemember jira-BABEL-3504-upgrade @@ -244,6 +251,7 @@ msdb-dbo-syspolicy_configuration msdb-dbo-syspolicy_system_health_state nested_trigger_inside_proc nested_trigger_with_dml +newid_before_15_8_or_16_4 objectpropertyex openjson openquery_upgrd_before_15_4 @@ -290,7 +298,7 @@ sys_syslogins_dep sys-database_recovery_status sys-databases sys-databases-dep -sys-data_spaces +sys-data_spaces-before-16-4 sys-datefirst sys-default_constraints sys-default_constraints-dep @@ -306,7 +314,7 @@ sys-eomonth sys-events sys-extended_properties sys-sql_expression_dependencies -sys-filegroups +sys-filegroups-before-16-4 sys-filetables sys-filetable_system_defined_objects sys-foreign_key_columns @@ -321,7 +329,7 @@ sys-fulltext_stoplists sys-hash_indexes sys-has_perms_by_name sys-has_perms_by_name-dep -sys-host_name +sys-host_name-before-15_8-or-16_4 sys-identity_columns sys-identity_columns-dep sys-index_columns @@ -447,6 +455,7 @@ TestTableType TestText TestTime TestTinyInt +TestUDD TestUniqueIdentifier Test_user_from_win_login TestVarChar @@ -478,7 +487,7 @@ drop_index linked_srv_4229 BABEL-4175 sp_who -BABEL_4330 +BABEL_4330-before-15_8-or-16_4 kill set_tran_isolvl BABEL-4217 @@ -510,8 +519,36 @@ BABEL-730 babel-4475 babel-3254 babel-4517 -BABEL-4815 -Test_alter_db_rename -Test_sp_renamedb -Test_sp_rename_database +babel_table_type +alter-procedure-before-15_8-or-16_4 +1_GRANT_SCHEMA +BABEL-4707 +BABEL_4817 +BABEL-4641 +BABEL-4863 +babel_test_int4_numeric_oper +babel_test_int8_numeric_oper +babel_test_int2_numeric_oper +login_token-dep +test_like_for_AI BABEL-4869 +babel_4328_datetime +babel_4328_datetime2 +babel_4328_datetimeoffset +babel_726 +BABEL-3401 +upper_lower-before-15_8-or-16_4 +trim-before-15_8-or-16_4 +ltrim-before-15_8-or-16_4 +rtrim-before-15_8-or-16_4 +left-before-15_8-or-16_4 +right-before-15_8-or-16_4 +translate-before-15_8-or-16_4 +substring-before-15_8-or-16_4 +reverse-before-15_8-or-16_4 +stuff-before-15_8-or-16_4 +replicate-before-15_8-or-16_4 +space +replace-before-15_8-or-16_4 +binary-datatype-operators + diff --git a/test/JDBC/upgrade/16_4/schedule b/test/JDBC/upgrade/16_4/schedule new file mode 100644 index 00000000000..d8656e5acab --- /dev/null +++ b/test/JDBC/upgrade/16_4/schedule @@ -0,0 +1,565 @@ +# Schedule File for JDBC Test Framework for local run +# 1. Lines starting with '#' will be treated as comments +# 2. To run a postgres command: cmd#!#postgresql#!# +# 3. To run a T-SQL command: cmd#!#sqlserver#!# +# 4. Keyword "all" is equivalent to running all test files in input folder +# 5. To add a test, add test name (without extension, , and . For example if test file name is TestBigInt.txt write TestBigInt) on a new line + +# This should be the first test to check there are no duplicated object_ids +BABEL-3613 + +app_name +atn2 +ATTIMEZONE-dep +AVG-Aggregate-common +AVG-Aggregate-Dep +BABEL-1062 +BABEL-1189 +BABEL-1206 +BABEL-1243 +BABEL-1249 +BABEL-1251 +BABEL-1291 +BABEL-1319 +BABEL-1438 +BABEL-1444 +BABEL-1465 +BABEL-1466 +BABEL-1475 +BABEL-1493 +BABEL-1510 +BABEL-1566 +BABEL-1625 +BABEL-1654 +BABEL-1683 +BABEL-1715 +BABEL-1953 +BABEL-1963 +BABEL-1994-CHAR +BABEL-1994-VARCHAR +BABEL-2086 +BABEL-2170 +BABEL-2203 +BABEL-2208 +BABEL-2257 +BABEL-2449 +BABEL-2535 +BABEL-2688 +BABEL-2765 +BABEL-2787 +BABEL-2787-2 +BABEL-2795 +BABEL-2805 +BABEL-2812 +BABEL-2819 +BABEL-2845 +babelfish_function_ext +BABEL-2884 +BABEL-2917 +BABEL-2944 +BABEL-2955 +BABEL-3000 +BABEL-3000-dep +BABEL-3010 +BABEL-3116 +BABEL-3117 +BABEL-3118 +BABEL-3121 +BABEL-3144 +BABEL-3147 +BABEL-3166 +BABEL-3192 +BABEL-3204 +BABEL-3213 +BABEL-3215 +BABEL-3221 +BABEL-3234 +BABEL-3249 +BABEL-3268 +BABEL-328 +BABEL-3314 +BABEL-3326 +BABEL-3347 +BABEL-3358 +BABEL-3360 +BABEL-3369 +BABEL-3370 +BABEL-3380 +BABEL-3392 +BABEL-3402 +BABEL-3474 +BABEL-3478 +BABEL-3486 +BABEL-3513 +BABEL-3556 +BABEL-3588 +BABEL-3614 +BABEL-3640 +BABEL-3646 +BABEL-3655 +BABEL-3657 +BABEL-3696 +BABEL-3697 +BABEL-3702 +BABEL-3725 +BABEL-3747 +BABEL-3748 +BABEL-3781 +BABEL-3801 +BABEL-3802 +BABEL-3818 +BABEL-3828 +BABEL-383 +BABEL-3844 +BABEL-3914 +BABEL-3938 +BABEL-3952 +BABEL-3953-datetrunc +BABEL-404 +BABEL-405 +BABEL-4078 +BABEL-4098 +BABEL-4214 +BABEL-4516 +babel_417 +BABEL-493 +BABEL-4888 +BABEL_539 +BABEL-621 +BABEL-728 +BABEL-733 +BABEL-741 +BABEL-745 +BABEL-775 +BABEL-889 +BABEL-937 +BABEL-APPLOCK +babel_char +BABEL-CHECK-CONSTRAINT +babel_context_info +BABEL-CROSS-DB +babel_datatype_sqlvariant +babel_datetime +Babel_domain_mapping_test +BABEL-EXECUTE_AS_CALLER +BABEL-EXTENDEDPROPERTY +BABEL-EXTENDEDPROPERTY-v2 +babel_int4_varbinary_div +babelfish_authid_login_ext +babelfish_authid_user_ext +babelfish_cast_floor +babelfish_inconsistent_metadata +babelfish_integrity_checker +check_for_inconsistent_metadata +babelfish_migration_mode +babelfish_namespace_ext +babelfish_sysdatabases +babel_function_string +BABEL_GRANT_CONNECT +babel_isnumeric +BABEL_COL_NAME +BABEL-LOGIN +BABEL-LOGIN-USER-EXT +BABEL-NEXT-VALUE-FOR +BABEL_OBJECT_DEFINITION +BABEL_OBJECT_ID +BABEL_OBJECT_NAME +BABEL-PG-SYSTEM-FUNCTIONS +BABEL-PROCID +BABEL-RAND +BABEL-ROLE +BABEL-ROLE-MEMBER +BABEL_SCHEMATA +BABEL-SPCOLUMNS +BABEL-SPCOLUMNS-dep +BABEL-SP_COLUMNS_MANAGED-dep +BABEL-SP_DATATYPE_INFO +BABEL-SP_FKEYS +BABEL-SP_FKEYS-dep +BABEL-sp_helpdb +BABEL-SP_SPECIAL_COLUMNS +BABEL-SP_SPECIAL_COLUMNS_100-dep +BABEL-SP_SPECIAL_COLUMNS-dep +BABEL-SP_SPROC_COLUMNS +BABEL-SP_SPROC_COLUMNS_100-dep +BABEL-SP_SPROC_COLUMNS-dep +BABEL-SP_STORED_PROCEDURES +BABEL-SP_STORED_PROCEDURES-dep +BABEL-SP_TABLE_PRIVILIGES +BABEL-SP_TABLES +SP_TABLES-dep +babel_sqlvariant_cast_compare +BABEL-SQUARE +BABEL-TABLEOPTIONS +babel_trigger +babel_try_parse +BABEL-USER +babel_varbinary_int4_div +bbf_view_def +binary-index +bitwise_not-operator +case_insensitive_collation +cast_numeric_types_to_datetime +cast_numeric_types_to_smalldatetime +col_length +collation_tests +collation_tests_arabic +collation_tests_greek +collation_tests_mongolian +collation_tests_polish +column_domain_usage +constraint_column_usage +dateadd_internal_df +datediff_big +datediff +dateadd +datepart +datetime2fromparts-after-15-2 +forjson +forjson-datatypes +forjson-subquery +forjson-nesting +forjsonauto +format +format-dep +forxml +forxml-subquery +fulltextserviceproperty +FULLTEXT_INDEX +fts-contains +fts-contains-utils +BABEL-4785 +restricted_procedures +get_tds_id +HAS_DBACCESS +identity_function +indexproperty +insteadof_nested_trigger_inside_proc +insteadof_nested_trigger_with_dml +insteadoftriggers_with_transaction +ISC-Columns +isc-schemata-dep +ISC-sequences +ISC-Table_Constraints +ISC-Tables +ISC-Views +is_srvrolemember +jira-BABEL-3504-upgrade +key_column_usage +linked_servers +msdb-dbo-fn_syspolicy_is_automation_enabled +msdb-dbo-syspolicy_configuration +msdb-dbo-syspolicy_system_health_state +nested_trigger_inside_proc +nested_trigger_with_dml +newid +objectpropertyex +openjson +openquery_upgrd_before_15_4 +orderby +routines_definition +rowcount +schema_resolution_func +schema_resolution_proc +schema_resolution_trigger +select-strip-parens +sp_describe_first_result_set +sp_tablecollations +smalldatetimefromparts-dep +str +switchoffset-dep +sys-all_columns +sys-all_columns-dep +sys_all_objects +sys_all_objects-dep +sys-all_parameters +sys-all_parameters-dep +sys-all_sql_modules +sys-all_sql_modules-dep +sys-all_views +sys-assemblies +sys-assembly_modules +sys-assembly_types +sys_babelfish_configurations_view +sys-change_tracking_databases +sys-change_tracking_tables +sys-check_constraints +sys-check_constraints-dep +sys-column-property +sys-columns +sys-columns-dep +sys-computed_columns +sys-computed_columns-dep +sys-configurations +sys-database_files +sys-database_filestream_options +sys-database_mirroring +sys_database_principals_dep +sys_syslogins_dep +sys-database_recovery_status +sys-databases +sys-databases-dep +sys-data_spaces +sys-datefirst +sys-default_constraints +sys-default_constraints-dep +sys-dm_exec_connections +sys-dm_exec_connections-dep +sys-dm_exec_sessions +sys-dm_exec_sessions-dep +sys-dm_hadr_cluster +sys-dm_hadr_database_replica_states +sys-dm_os_host_info +sys-endpoints +sys-eomonth +sys-events +sys-extended_properties +sys-sql_expression_dependencies +sys-filegroups +sys-filetables +sys-filetable_system_defined_objects +sys-foreign_key_columns +sys-foreign_key_columns-dep +sys-foreign_keys +sys-foreign_keys-dep +sys-fulltext_catalogs +sys-fulltext_index_columns +sys-fulltext_indexes +sys-fulltext_languages +sys-fulltext_stoplists +sys-hash_indexes +sys-has_perms_by_name +sys-has_perms_by_name-dep +sys-host_name +sys-identity_columns +sys-identity_columns-dep +sys-index_columns +sys-index_columns-dep +sys-indexes +sys-indexes-dep +sys-key_constraints +sys-key_constraints-dep +sys-lock_timeout +sys-master_files +sys-max_connections +sys-nestlevel-dep +sys-numbered_procedures +sys-objects +sys-original_login +sys-parsename +sys-partitions +sys-partitions-dep +sys-plan_guides +sys-procedures +sys-proc_param_helper-dep +sys-registered_search_property_lists +sys-schema-name +sys-schemas +sys-schemas-dep +sys-selective_xml_index_paths +sys-server_principals +sys_server_role_members +sys_server_principals_dep +sys-sid_binary +sys-spatial_indexes +sys-spatial_index_tessellations +sys-sp_databases +sys-sp_databases-dep +sys-sp_pkeys +sys-sp_pkeys-dep +sys-sp_statistics +sys-sp_statistics-dep +sys-sp_tables_view +sys-sp_tables_view-dep +sys-sql_modules +sys-sql_modules-dep +sys-stats +sys-suser_sid +sys-suser_sname +sys-synonyms +sys-syscharsets +sys-syscolumns +sys-syscolumns-dep +sys-sysdatabases +sys-sysforeignkeys +sys-sysforeignkeys-dep +sys-sysindexes +sys-syslanguages +sys-sysobjects +sys-system_objects +sys-system_sql_modules +sys-system_sql_modules-dep +sys-systypes +sys_sysusers_dep +sys-tables +sys-tables-dep +sys-table_types +sys-table_types-dep +sys-table_types_internal +sys-table_types_internal-dep +SYSTEM_USER +sys-trigger_events +sys-trigger_nestlevel +sys-triggers +sys-triggers-dep +sys-types +sys-types-dep +sys-userid +sys-views +sys-views-dep +sys-xml_indexes +sys-xml_schema_collections +table-variable +tdscollation +temp-tables +TestBigInt +TestBinary +TestBIT +TestChar +Test-Computed-Columns +TestDate +TestDatetime +TestDatetime2 +TestDatetime-numeric-dateaddfunction +TestDatetime-numeric-representation +TestDecimal +TestFloat +Test-Identity +TestImage +TestInt +TestMoney +TestNotNull +TestNumeric +TestReal +TestRowVersion +TestSmallDatetime +TestSmallInt +TestSmallMoney +TestSpatialPoint +Test-spatial-functions +Test-sp_addrole +Test-sp_addrolemember +Test-sp_babelfish_volatility +Test-sp_droprole +Test-sp_droprolemember +Test-sp_execute_postgresql +Test-sp_helpdbfixedrole +Test-sp_helprole-dep +Test-sp_helprolemember-dep +Test-sp_helpsrvrolemember +Test-sp_helpuser +Test-sp_rename +Test-sp_rename-dep +Test-sp_set_session_context +Test-sp_set_session_context-dep +TestSQLVariant +TestTableType +TestText +TestTime +TestTinyInt +TestUDD +TestUniqueIdentifier +Test_user_from_win_login +TestVarChar +TestVariableDataLength +test_windows_alter_login +test_windows_alter_user +test_windows_login +test_windows_sp_helpuser +TestXML +timefromparts +todatetimeoffset-dep +triggers_with_transaction +order_by_offset_fetch_rows +typeid-typename +typeid-typename-dep +print_null +unquoted_string +doublequoted_string +operator_whitespace +operator_atatvar +operator_binary_whitespace +alter_authorization_change_db_owner +sp_changedbowner +float_exponent +datetimeoffset-timezone +BABEL-4046 +host_id +drop_index +linked_srv_4229 +BABEL-4175 +sp_who +BABEL_4330 +kill +set_tran_isolvl +with_recompile +alter_proc_recompile +catalogs_dbo_sys_schema-upgrade +BABEL-4217 +Test_ISNULL +BABEL-4270 +BABEL-4410 +BABEL-4231 +function_as_keywd +typeproperty-dep +sys_asymmetric_keys +sys_certificates +sys_database_permissions +#BABEL-4279 +BABEL-4484 +pivot +#AUTO_ANALYZE #uncomment this test when preparing for new minor version +cast_eliminate +TestDatatypeAggSort +babel_index_nulls_order +BABEL-2999 +BABEL-4606 +BABEL-4672 +permission_restrictions_from_pg +restricting_function_overloading +BABEL-4529 +sys_availability_groups +sys_availability_replicas +table_constraint_without_comma +BABEL-730 +babel-4475 +babel-3254 +babel-4517 +babel_table_type +alter-procedure +1_GRANT_SCHEMA +BABEL-4707 +BABEL_4817 +upper_lower +BABEL-4641 +trim +ltrim +rtrim +left +right +replace +BABEL-4863 +babel_test_int4_numeric_oper +babel_test_int8_numeric_oper +babel_test_int2_numeric_oper +login_token-dep +test_like_for_AI +BABEL-4869 +babel_4328_datetime +babel_4328_datetime2 +translate +substring +babel_4328_datetimeoffset +babel_726 +BABEL-3401 +BABEL-3820 +stuff +PARTITION +BABEL-5071 +string_agg +reverse +sys_sequences +replicate +space +binary-datatype-operators + diff --git a/test/JDBC/upgrade/latest/schedule b/test/JDBC/upgrade/latest/schedule index 72289b90539..d8656e5acab 100644 --- a/test/JDBC/upgrade/latest/schedule +++ b/test/JDBC/upgrade/latest/schedule @@ -53,7 +53,7 @@ BABEL-2805 BABEL-2812 BABEL-2819 BABEL-2845 -BABEL-2877 +babelfish_function_ext BABEL-2884 BABEL-2917 BABEL-2944 @@ -123,6 +123,7 @@ BABEL-4214 BABEL-4516 babel_417 BABEL-493 +BABEL-4888 BABEL_539 BABEL-621 BABEL-728 @@ -186,6 +187,7 @@ BABEL-SP_STORED_PROCEDURES BABEL-SP_STORED_PROCEDURES-dep BABEL-SP_TABLE_PRIVILIGES BABEL-SP_TABLES +SP_TABLES-dep babel_sqlvariant_cast_compare BABEL-SQUARE BABEL-TABLEOPTIONS @@ -227,6 +229,7 @@ FULLTEXT_INDEX fts-contains fts-contains-utils BABEL-4785 +restricted_procedures get_tds_id HAS_DBACCESS identity_function @@ -433,6 +436,7 @@ TestSmallDatetime TestSmallInt TestSmallMoney TestSpatialPoint +Test-spatial-functions Test-sp_addrole Test-sp_addrolemember Test-sp_babelfish_volatility @@ -490,6 +494,7 @@ kill set_tran_isolvl with_recompile alter_proc_recompile +catalogs_dbo_sys_schema-upgrade BABEL-4217 Test_ISNULL BABEL-4270 @@ -511,6 +516,7 @@ BABEL-2999 BABEL-4606 BABEL-4672 permission_restrictions_from_pg +restricting_function_overloading BABEL-4529 sys_availability_groups sys_availability_replicas @@ -524,7 +530,14 @@ alter-procedure 1_GRANT_SCHEMA BABEL-4707 BABEL_4817 +upper_lower BABEL-4641 +trim +ltrim +rtrim +left +right +replace BABEL-4863 babel_test_int4_numeric_oper babel_test_int8_numeric_oper @@ -534,6 +547,19 @@ test_like_for_AI BABEL-4869 babel_4328_datetime babel_4328_datetime2 +translate +substring babel_4328_datetimeoffset babel_726 BABEL-3401 +BABEL-3820 +stuff +PARTITION +BABEL-5071 +string_agg +reverse +sys_sequences +replicate +space +binary-datatype-operators + diff --git a/test/dotnet/ExpectedOutput/insertBulk.out b/test/dotnet/ExpectedOutput/insertBulk.out index e3853821be5..e5c85449eca 100644 --- a/test/dotnet/ExpectedOutput/insertBulk.out +++ b/test/dotnet/ExpectedOutput/insertBulk.out @@ -442,3 +442,18 @@ hello#!#jello 1 #Q#drop table sourceTable #Q#drop table destinationTable +#Q#CREATE TABLE sourceTable(c1 int, c2 CHAR(1024)) +#Q#INSERT INTO sourceTable SELECT generate_series(1, 1000, 1), 'Foo' +#Q#CREATE PARTITION FUNCTION IntPartitionFunction (int) AS RANGE RIGHT FOR VALUES (0, 500, 1000) +#Q#CREATE PARTITION SCHEME IntPartitionScheme AS PARTITION IntPartitionFunction ALL TO ([PRIMARY]) +#Q#CREATE TABLE partitionedTable(c1 int, c2 CHAR(1024)) ON IntPartitionScheme(c1) +#Q#Select count(*) from sourceTable +#D#int +1000 +#Q#select count(*) from partitionedTable +#D#int +0 +#Q#DROP TABLE partitionedTable +#Q#DROP PARTITION SCHEME IntPartitionScheme +#Q#DROP PARTITION FUNCTION IntPartitionFunction +#Q#DROP TABLE sourceTable diff --git a/test/dotnet/input/InsertBulk/insertBulk.txt b/test/dotnet/input/InsertBulk/insertBulk.txt index b185778e64e..ea066080e5d 100644 --- a/test/dotnet/input/InsertBulk/insertBulk.txt +++ b/test/dotnet/input/InsertBulk/insertBulk.txt @@ -347,4 +347,18 @@ insertbulk#!#sourceTable#!#destinationTable Select count(*) from sourceTable select count(*) from destinationTable drop table sourceTable -drop table destinationTable \ No newline at end of file +drop table destinationTable + +# partitioned table +CREATE TABLE sourceTable(c1 int, c2 CHAR(1024)) +INSERT INTO sourceTable SELECT generate_series(1, 1000, 1), 'Foo' +CREATE PARTITION FUNCTION IntPartitionFunction (int) AS RANGE RIGHT FOR VALUES (0, 500, 1000) +CREATE PARTITION SCHEME IntPartitionScheme AS PARTITION IntPartitionFunction ALL TO ([PRIMARY]) +CREATE TABLE partitionedTable(c1 int, c2 CHAR(1024)) ON IntPartitionScheme(c1) +insertbulk#!#sourceTable#!#partitionedTable +Select count(*) from sourceTable +select count(*) from partitionedTable +DROP TABLE partitionedTable +DROP PARTITION SCHEME IntPartitionScheme +DROP PARTITION FUNCTION IntPartitionFunction +DROP TABLE sourceTable \ No newline at end of file diff --git a/test/python/SMO_script.ps1 b/test/python/SMO_script.ps1 index eeee21283c4..568e4425d7a 100644 --- a/test/python/SMO_script.ps1 +++ b/test/python/SMO_script.ps1 @@ -22,9 +22,35 @@ $schm2 = "guest" +$Scripter = New-Object ('Microsoft.SqlServer.Management.Smo.Scripter') ($SmoServer) +$Scripter.Options.DriAll = $True; +$Scripter.Options.ScriptSchema = $True; +$Scripter.Options.ScriptData = $False; +$Scripter.Options.NoCollation = $True; + +# Scripting PartitionFunctions and PartitionSchemes. +# Unlike standard database objects, partition functions and schemes are scripted individually. +foreach ($partitionFunction in $db.PartitionFunctions) +{ + if (-not $partitionFunction.IsSystemObject) + { + $Scripter.Script($partitionFunction) + Write-Output "GO`n" + } +} + +foreach ($partitionScheme in $db.PartitionSchemes) +{ + if (-not $partitionScheme.IsSystemObject) + { + $Scripter.Script($partitionScheme) + Write-Output "GO`n" + } +} if($script_flag -eq $var_one) { + # Collecting standard database objects (tables, views, procedures, functions, etc.). $Objects = $db.Tables $Objects += $db.Views $Objects += $db.StoredProcedures @@ -33,15 +59,12 @@ if($script_flag -eq $var_one) $Objects += $db.UserDefinedTableTypes $Objects += $db.Tables.Indexes $Objects += $db.Tables.Triggers + + # Scripting standard database objects. foreach ($CurrentObject in $Objects) { if (-not $CurrentObject.IsSystemObject ) { - $Scripter = New-Object ('Microsoft.SqlServer.Management.Smo.Scripter') ($SmoServer) - $Scripter.Options.DriAll = $True; - $Scripter.Options.ScriptSchema = $True; - $Scripter.Options.ScriptData = $False; - $Scripter.Options.NoCollation = $True; $Scripter.Script($CurrentObject); Write-Output "GO`n" } @@ -50,6 +73,7 @@ if($script_flag -eq $var_one) } else { + # Collecting standard database objects (tables, views, procedures, functions, etc.). $Objects = $db.Tables $Objects += $db.Views $Objects += $db.StoredProcedures @@ -59,15 +83,12 @@ else $SubObjects += $db.Tables.Indexes $SubObjects += $db.Tables.Triggers $SubObjects += $db.Users + + # Scripting standard database objects. foreach ($CurrentObject in $Objects) { if ($CurrentObject.schema -ne $schm -and $CurrentObject.schema -ne $dtb -and $CurrentObject.schema -ne $null -and -not $CurrentObject.IsSystemObject ) { - $Scripter = New-Object ('Microsoft.SqlServer.Management.Smo.Scripter') ($SmoServer) - $Scripter.Options.DriAll = $True; - $Scripter.Options.ScriptSchema = $True; - $Scripter.Options.ScriptData = $False; - $Scripter.Options.NoCollation = $True; $Scripter.Script($CurrentObject); Write-Output "GO`n" } @@ -77,10 +98,6 @@ else if (-not $CurrentObject.IsSystemObject -and $CurrentObject.Name -ne $schm1 -and $CurrentObject.Name -ne $schm2) { $Scripter = New-Object ('Microsoft.SqlServer.Management.Smo.Scripter') ($SmoServer) - $Scripter.Options.DriAll = $True; - $Scripter.Options.ScriptSchema = $True; - $Scripter.Options.ScriptData = $False; - $Scripter.Options.NoCollation = $True; $Scripter.Script($CurrentObject); Write-Output "GO`n" } diff --git a/test/python/expected/pyodbc/ddl_all_objects.out b/test/python/expected/pyodbc/ddl_all_objects.out index 02374b9f034..9325e50729e 100644 --- a/test/python/expected/pyodbc/ddl_all_objects.out +++ b/test/python/expected/pyodbc/ddl_all_objects.out @@ -7,7 +7,7 @@ CREATE TABLE [dbo].[babel_1654_vu_prepare_t]( CONSTRAINT [babel_1654_vu_prepare_t_pkey] PRIMARY KEY NONCLUSTERED ( [id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO @@ -72,7 +72,7 @@ CREATE TABLE [dbo].[test_tsql_const]( CONSTRAINT [test_tsql_const_pkey] PRIMARY KEY NONCLUSTERED ( [c_int] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] ALTER TABLE [dbo].[test_tsql_const] WITH CHECK ADD CONSTRAINT [test_tsql_const_c_binary_check] CHECK (((c_binary > CAST(('0xfe') AS binary(8))))) @@ -142,17 +142,17 @@ GO ALTER TABLE [dbo].[babel_1654_vu_prepare_t] ADD CONSTRAINT [babel_1654_vu_prepare_t_pkey] PRIMARY KEY NONCLUSTERED ( [id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO ALTER TABLE [dbo].[test_tsql_const] ADD CONSTRAINT [test_tsql_const_pkey] PRIMARY KEY NONCLUSTERED ( [c_int] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO -SET ANSI_NULLS ON -SET QUOTED_IDENTIFIER ON +SET ANSI_NULLS OFF +SET QUOTED_IDENTIFIER OFF CREATE TRIGGER babel_1654_vu_prepare_trig_t on babel_1654_vu_prepare_t after update as select COLUMNS_UPDATED(); ALTER TABLE [dbo].[babel_1654_vu_prepare_t] ENABLE TRIGGER [babel_1654_vu_prepare_trig_t] diff --git a/test/python/expected/pyodbc/ddl_func_proc.out b/test/python/expected/pyodbc/ddl_func_proc.out index 404c58aa7c9..6cff060caa8 100644 --- a/test/python/expected/pyodbc/ddl_func_proc.out +++ b/test/python/expected/pyodbc/ddl_func_proc.out @@ -10,7 +10,7 @@ CREATE TABLE [dbo].[routines_customers]( CONSTRAINT [customers_pk] PRIMARY KEY NONCLUSTERED ( [customer_id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO @@ -218,6 +218,6 @@ GO ALTER TABLE [dbo].[routines_customers] ADD CONSTRAINT [customers_pk] PRIMARY KEY NONCLUSTERED ( [customer_id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO diff --git a/test/python/expected/pyodbc/ddl_partitions.out b/test/python/expected/pyodbc/ddl_partitions.out new file mode 100644 index 00000000000..738971cbec3 --- /dev/null +++ b/test/python/expected/pyodbc/ddl_partitions.out @@ -0,0 +1,489 @@ +CREATE PARTITION FUNCTION [BigIntPartitionFunction](bigint) AS RANGE RIGHT FOR VALUES (0, 100, 1000, 10000) +GO + +CREATE PARTITION FUNCTION [BinaryPartitionFunction](binary(8000)) AS RANGE RIGHT FOR VALUES (0x00000000, 0x04000000, 0x08000000, 0xC0000000) +GO + +CREATE PARTITION FUNCTION [CharPartitionFunction](char(8000)) AS RANGE RIGHT FOR VALUES (N'A ', N'D ', N'F ', N'K ', N'P ', N'U ', N'Z ') +GO + +CREATE PARTITION FUNCTION [DatePartitionFunction](date) AS RANGE RIGHT FOR VALUES (N'2022-01-01T00:00:00.000', N'2022-07-01T00:00:00.000', N'2023-01-01T00:00:00.000') +GO + +CREATE PARTITION FUNCTION [DateTime2PartitionFunction](datetime2(6)) AS RANGE RIGHT FOR VALUES (N'2019-01-01T00:00:00.000', N'2022-01-01T00:00:00.000', N'2022-07-01T00:00:00.000') +GO + +CREATE PARTITION FUNCTION [DateTimePartitionFunction](datetime) AS RANGE RIGHT FOR VALUES (N'2019-01-01T00:00:00.000', N'2022-01-01T00:00:00.000', N'2022-07-01T00:00:00.000') +GO + +CREATE PARTITION FUNCTION [DecimalPartitionFunction](decimal(38,38)) AS RANGE RIGHT FOR VALUES (0.00000, 100.00000, 200.00000, 300.00000) +GO + +CREATE PARTITION FUNCTION [IntPartitionFunction](int) AS RANGE RIGHT FOR VALUES (0, 500, 1000) +GO + +CREATE PARTITION FUNCTION [MoneyPartitionFunction](money) AS RANGE RIGHT FOR VALUES (2.5679, 3.5679, 4.9100) +GO + +CREATE PARTITION FUNCTION [NCharPartitionFunction](nchar(4000)) AS RANGE RIGHT FOR VALUES (N'A ', N'B ', N'F ', N'K ', N'P ', N'U ', N'Z ') +GO + +CREATE PARTITION FUNCTION [NumericPartitionFunction](numeric(38,38)) AS RANGE RIGHT FOR VALUES (0.00, 10.00, 20.00, 30.00) +GO + +CREATE PARTITION FUNCTION [NVarCharPartitionFunction](nvarchar(4000)) AS RANGE RIGHT FOR VALUES (N'Apple', N'Banana', N'Cherry', N'Date', N'Mango') +GO + +CREATE PARTITION FUNCTION [PARTITION_FUNCTION 유니코드스키마👻 ](int) AS RANGE RIGHT FOR VALUES (0, 500, 1000) +GO + +CREATE PARTITION FUNCTION [PARTITION_FUNCTION 😎$@ #123 🌍rder ](int) AS RANGE RIGHT FOR VALUES (0, 500, 1000) +GO + +CREATE PARTITION FUNCTION [PARTITION_FUNCTIONログインαιώνια](int) AS RANGE RIGHT FOR VALUES (0, 500, 1000) +GO + +CREATE PARTITION FUNCTION [PartitionFunctionHavingDifferentCollationInput](nvarchar(4000)) AS RANGE RIGHT FOR VALUES (N'châu phố', N'Jane Smith', N'John Doe', N'Müller GmbH') +GO + +CREATE PARTITION FUNCTION [PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz](bigint) AS RANGE RIGHT FOR VALUES (0, 100, 1000, 10000) +GO + +CREATE PARTITION FUNCTION [PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder](bigint) AS RANGE RIGHT FOR VALUES (0, 100, 1000, 10000) +GO + +CREATE PARTITION FUNCTION [SmallDateTimePartitionFunction](smalldatetime) AS RANGE RIGHT FOR VALUES (N'2019-01-01T00:00:00.000', N'2022-01-01T00:00:00.000', N'2022-07-01T00:00:00.000') +GO + +CREATE PARTITION FUNCTION [SmallIntPartitionFunction](smallint) AS RANGE RIGHT FOR VALUES (-32768, 0, 32767) +GO + +CREATE PARTITION FUNCTION [SmallMoneyPartitionFunction](smallmoney) AS RANGE RIGHT FOR VALUES (2.5679, 3.5679, 4.9100) +GO + +CREATE PARTITION FUNCTION [TinyIntPartitionFunction](tinyint) AS RANGE RIGHT FOR VALUES (0x00, 0x80, 0xFF) +GO + +CREATE PARTITION FUNCTION [UniqueIdentifierPartitionFunction](uniqueidentifier) AS RANGE RIGHT FOR VALUES (N'00000000-0000-0000-0000-000000000000', N'6f9619ff-8b86-d011-b42d-00c04fc964ff', N'ffffffff-ffff-ffff-ffff-ffffffffffff') +GO + +CREATE PARTITION FUNCTION [VarBinaryPartitionFunction](varbinary(8000)) AS RANGE RIGHT FOR VALUES (0x0000000000000000, 0x4000000000000000, 0x8000000000000000, 0xC000000000000000) +GO + +CREATE PARTITION FUNCTION [VarCharPartitionFunction](varchar(8000)) AS RANGE RIGHT FOR VALUES (N'Apple', N'Banana', N'Cherry', N'Date', N'Mango') +GO + +CREATE PARTITION SCHEME [BigIntPartitionScheme] AS PARTITION [BigIntPartitionFunction] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [BinaryPartitionScheme] AS PARTITION [BinaryPartitionFunction] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [CharPartitionScheme] AS PARTITION [CharPartitionFunction] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [DatePartitionScheme] AS PARTITION [DatePartitionFunction] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [DateTime2PartitionScheme] AS PARTITION [DateTime2PartitionFunction] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [DateTimePartitionScheme] AS PARTITION [DateTimePartitionFunction] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [DecimalPartitionScheme] AS PARTITION [DecimalPartitionFunction] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [IntPartitionScheme] AS PARTITION [IntPartitionFunction] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [MoneyPartitionScheme] AS PARTITION [MoneyPartitionFunction] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [NCharPartitionScheme] AS PARTITION [NCharPartitionFunction] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [NumericPartitionScheme] AS PARTITION [NumericPartitionFunction] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [NVarCharPartitionScheme] AS PARTITION [NVarCharPartitionFunction] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [PARTITION_SCHEME 유니코드스키마👻 ] AS PARTITION [PARTITION_FUNCTION 유니코드스키마👻 ] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [PARTITION_SCHEME 😎$@ #123 🌍rder ] AS PARTITION [PARTITION_FUNCTION 😎$@ #123 🌍rder ] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [PARTITION_SCHEMEログインαιώνια] AS PARTITION [PARTITION_FUNCTIONログインαιώνια] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [PartitionSchemeNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz] AS PARTITION [PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [PartitionSchemeNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder] AS PARTITION [PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [SmallDateTimePartitionScheme] AS PARTITION [SmallDateTimePartitionFunction] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [SmallIntPartitionScheme] AS PARTITION [SmallIntPartitionFunction] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [SmallMoneyPartitionScheme] AS PARTITION [SmallMoneyPartitionFunction] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [TinyIntPartitionScheme] AS PARTITION [TinyIntPartitionFunction] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [UniqueIdentifierPartitionScheme] AS PARTITION [UniqueIdentifierPartitionFunction] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [VarBinaryPartitionScheme] AS PARTITION [VarBinaryPartitionFunction] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +CREATE PARTITION SCHEME [VarCharPartitionScheme] AS PARTITION [VarCharPartitionFunction] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]) +GO + +GO + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [dbo].[partition_vu_prepare_bigint_table]( + [id] [bigint] NULL, + [value] [varchar](50) NULL +) ON [BigIntPartitionScheme]([id]) + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [dbo].[partition_vu_prepare_binary_table]( + [id] [binary](4) NULL, + [value] [varchar](50) NULL +) ON [BinaryPartitionScheme]([id]) + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [dbo].[partition_vu_prepare_char_table]( + [id] [char](5) NULL, + [value] [varchar](50) NULL +) ON [CharPartitionScheme]([id]) + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [dbo].[partition_vu_prepare_date_table]( + [id] [date] NULL, + [value] [varchar](50) NULL +) ON [DatePartitionScheme]([id]) + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [dbo].[partition_vu_prepare_datetime_table]( + [id] [datetime] NULL, + [value] [varchar](50) NULL +) ON [DateTimePartitionScheme]([id]) + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [dbo].[partition_vu_prepare_datetime2_table]( + [id] [datetime2](3) NULL, + [value] [varchar](50) NULL +) ON [DateTime2PartitionScheme]([id]) + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [dbo].[partition_vu_prepare_decimal_table]( + [id] [decimal](10, 5) NULL, + [value] [varchar](50) NULL +) ON [DecimalPartitionScheme]([id]) + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [dbo].[partition_vu_prepare_int_table]( + [id] [int] NULL, + [value] [varchar](50) NULL, + CONSTRAINT [partition_vu_prepare_int_table_id_key] UNIQUE NONCLUSTERED +( + [id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [IntPartitionScheme]([id]) +) ON [IntPartitionScheme]([id]) + +ALTER TABLE [dbo].[partition_vu_prepare_int_table] WITH CHECK ADD CONSTRAINT [check_value_not_null] CHECK (((value IS NOT NULL))) +ALTER TABLE [dbo].[partition_vu_prepare_int_table] CHECK CONSTRAINT [check_value_not_null] +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [dbo].[partition_vu_prepare_money_table]( + [id] [money] NULL, + [value] [varchar](50) NULL +) ON [MoneyPartitionScheme]([id]) + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [dbo].[partition_vu_prepare_nchar_table]( + [id] [nchar](5) NULL, + [value] [varchar](50) NULL +) ON [NCharPartitionScheme]([id]) + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [dbo].[partition_vu_prepare_numeric_table]( + [id] [numeric](5, 2) NULL, + [value] [varchar](50) NULL +) ON [NumericPartitionScheme]([id]) + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [dbo].[partition_vu_prepare_nvarchar_table]( + [id] [nvarchar](10) NULL, + [value] [varchar](50) NULL +) ON [NVarCharPartitionScheme]([id]) + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [dbo].[partition_vu_prepare_smalldatetime_table]( + [id] [smalldatetime] NULL, + [value] [varchar](50) NULL +) ON [SmallDateTimePartitionScheme]([id]) + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [dbo].[partition_vu_prepare_smallint_table]( + [id] [smallint] NULL, + [value] [varchar](50) NULL +) ON [SmallIntPartitionScheme]([id]) + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [dbo].[partition_vu_prepare_smallmoney_table]( + [id] [smallmoney] NULL, + [value] [varchar](50) NULL +) ON [SmallMoneyPartitionScheme]([id]) + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [dbo].[partition_vu_prepare_tinyint_table]( + [id] [tinyint] NULL, + [value] [varchar](50) NULL +) ON [TinyIntPartitionScheme]([id]) + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [dbo].[partition_vu_prepare_uniqueidentifier_table]( + [id] [uniqueidentifier] NULL, + [value] [varchar](50) NULL +) ON [UniqueIdentifierPartitionScheme]([id]) + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [dbo].[partition_vu_prepare_varbinary_table]( + [id] [varbinary](8) NULL, + [value] [varchar](50) NULL +) ON [VarBinaryPartitionScheme]([id]) + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [dbo].[partition_vu_prepare_varchar_table]( + [id] [varchar](10) NULL, + [value] [varchar](50) NULL +) ON [VarCharPartitionScheme]([id]) + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [dbo].[partitiontablenamegreaterthan64d92cad082de128dbac3bc1a7d749bf53]( + [id] [int] NULL, + [value] [varchar](50) NULL +) ON [IntPartitionScheme]([id]) + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz].[partitiontablenamegreaterthan1259a3b74cdca75a6c35cdd44037a1056a]( + [partitioncolumnnamegreaterthan1cd6278b008e04dd31785f1b75b723b88] [bigint] NULL, + [value] [varchar](50) NULL +) ON [PartitionSchemeNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz]([partitioncolumnnamegreaterthan1cd6278b008e04dd31785f1b75b723b88]) + +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +CREATE TABLE [PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz].[partitiontablenamegreaterthan6402ce6bebcadddb6e6a931674c4836f80]( + [partitioncolumnnamegreaterthan1cd6278b008e04dd31785f1b75b723b88] [bigint] NULL, + [value] [varchar](50) NULL +) ON [PartitionSchemeNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder]([partitioncolumnnamegreaterthan1cd6278b008e04dd31785f1b75b723b88]) + +GO + +CREATE NONCLUSTERED INDEX [partition_vu_prepare_bigint_ind877afb285426cec9d46b047e3cf96f63] ON [dbo].[partition_vu_prepare_bigint_table] +( + [id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [BigIntPartitionScheme]([id]) +GO + +CREATE NONCLUSTERED INDEX [partition_vu_prepare_binary_ind48a88b3c8178211af1ed1dcf4cfbe503] ON [dbo].[partition_vu_prepare_binary_table] +( + [id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [BinaryPartitionScheme]([id]) +GO + +CREATE NONCLUSTERED INDEX [partition_vu_prepare_char_index32fed8129381de1b5745e90cd811516f] ON [dbo].[partition_vu_prepare_char_table] +( + [id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [CharPartitionScheme]([id]) +GO + +CREATE NONCLUSTERED INDEX [partition_vu_prepare_date_indexf571a291edad587ba646fc34c4566844] ON [dbo].[partition_vu_prepare_date_table] +( + [id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [DatePartitionScheme]([id]) +GO + +CREATE NONCLUSTERED INDEX [partition_vu_prepare_datetime_i364577d0a406eee6e806be980ac15d2e] ON [dbo].[partition_vu_prepare_datetime_table] +( + [id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [DateTimePartitionScheme]([id]) +GO + +CREATE NONCLUSTERED INDEX [partition_vu_prepare_datetime2_4cad7647322c234b34b97cddb3cd1ad6] ON [dbo].[partition_vu_prepare_datetime2_table] +( + [id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [DateTime2PartitionScheme]([id]) +GO + +CREATE NONCLUSTERED INDEX [partition_vu_prepare_decimal_infc7570aeccbb040dde39974c476a7ec9] ON [dbo].[partition_vu_prepare_decimal_table] +( + [id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [DecimalPartitionScheme]([id]) +GO + +CREATE NONCLUSTERED INDEX [partition_vu_prepare_int_indexpbbe9a6f0ef5edf6e63fa853dac4ed046] ON [dbo].[partition_vu_prepare_int_table] +( + [value] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [IntPartitionScheme]([id]) +GO + +ALTER TABLE [dbo].[partition_vu_prepare_int_table] ADD CONSTRAINT [partition_vu_prepare_int_table_id_key] UNIQUE NONCLUSTERED +( + [id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [IntPartitionScheme]([id]) +GO + +CREATE NONCLUSTERED INDEX [partition_vu_prepare_money_inde9b6a61ad06c0883c6d0f95b2fec9eeee] ON [dbo].[partition_vu_prepare_money_table] +( + [id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [MoneyPartitionScheme]([id]) +GO + +CREATE NONCLUSTERED INDEX [partition_vu_prepare_nchar_indecdc4872501ea902494c8f710f4e9dbb1] ON [dbo].[partition_vu_prepare_nchar_table] +( + [id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [NCharPartitionScheme]([id]) +GO + +CREATE NONCLUSTERED INDEX [partition_vu_prepare_numeric_inf04f315c86929345e23bee80713cf963] ON [dbo].[partition_vu_prepare_numeric_table] +( + [id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [NumericPartitionScheme]([id]) +GO + +CREATE NONCLUSTERED INDEX [partition_vu_prepare_nvarchar_if89fa8cc46282fa6dc23e9f5b834f3ec] ON [dbo].[partition_vu_prepare_nvarchar_table] +( + [id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [NVarCharPartitionScheme]([id]) +GO + +CREATE NONCLUSTERED INDEX [partition_vu_prepare_smalldatetfe8f8bfb8c766f9a1bcd804238ff35d8] ON [dbo].[partition_vu_prepare_smalldatetime_table] +( + [id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [SmallDateTimePartitionScheme]([id]) +GO + +CREATE NONCLUSTERED INDEX [partition_vu_prepare_smallint_i3eae48e3a131ed23416aa2891b58d579] ON [dbo].[partition_vu_prepare_smallint_table] +( + [id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [SmallIntPartitionScheme]([id]) +GO + +CREATE NONCLUSTERED INDEX [partition_vu_prepare_smallmoney68389bf5dc5c581b33c4dbb8a3dc1dc8] ON [dbo].[partition_vu_prepare_smallmoney_table] +( + [id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [SmallMoneyPartitionScheme]([id]) +GO + +CREATE NONCLUSTERED INDEX [partition_vu_prepare_tinyint_in02b271c73e639954190c6a45bd5dd1bb] ON [dbo].[partition_vu_prepare_tinyint_table] +( + [id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [TinyIntPartitionScheme]([id]) +GO + +CREATE NONCLUSTERED INDEX [partition_vu_prepare_uniqueidend39220cd3f46c5b2cea8c338a387aedf] ON [dbo].[partition_vu_prepare_uniqueidentifier_table] +( + [id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [UniqueIdentifierPartitionScheme]([id]) +GO + +CREATE NONCLUSTERED INDEX [partition_vu_prepare_varbinary_26e1223f68c4186a96126a57446ac386] ON [dbo].[partition_vu_prepare_varbinary_table] +( + [id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [VarBinaryPartitionScheme]([id]) +GO + +CREATE NONCLUSTERED INDEX [partition_vu_prepare_varchar_inc528f397ba573964de161e03035b8f08] ON [dbo].[partition_vu_prepare_varchar_table] +( + [id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [VarCharPartitionScheme]([id]) +GO + +CREATE NONCLUSTERED INDEX [partitionindexnamegreaterthan12281d566faf52196dfe6d853f777a92e5] ON [PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz].[partitiontablenamegreaterthan1259a3b74cdca75a6c35cdd44037a1056a] +( + [value] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PartitionSchemeNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz]([partitioncolumnnamegreaterthan1cd6278b008e04dd31785f1b75b723b88]) +GO + +CREATE NONCLUSTERED INDEX [partitionindexnamegreaterthan12b72a1deb0a1d64b3cc262360a8eb4a59] ON [PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz].[partitiontablenamegreaterthan6402ce6bebcadddb6e6a931674c4836f80] +( + [value] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PartitionSchemeNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder]([partitioncolumnnamegreaterthan1cd6278b008e04dd31785f1b75b723b88]) +GO + +GO + diff --git a/test/python/expected/pyodbc/ddl_tables_index.out b/test/python/expected/pyodbc/ddl_tables_index.out index 0812587ed76..535d919cbbf 100644 --- a/test/python/expected/pyodbc/ddl_tables_index.out +++ b/test/python/expected/pyodbc/ddl_tables_index.out @@ -13,12 +13,12 @@ CREATE TABLE [dbo].[babel_4817_t1]( ( [col3] ASC, [col7] DESC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON), +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY], CONSTRAINT [babel_4817_t1_col2_col8_key] UNIQUE NONCLUSTERED ( [col2] DESC, [col8] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO @@ -38,7 +38,7 @@ CREATE TABLE [dbo].[babel_4817_t2]( ( [col3] ASC, [col7] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO @@ -66,7 +66,7 @@ CREATE TABLE [dbo].[babel_4817_t4]( CONSTRAINT [babel_4817_t4_pkey] PRIMARY KEY NONCLUSTERED ( [filename] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO @@ -82,7 +82,7 @@ CREATE TABLE [dbo].[babel_4817_t5]( ( [filename] ASC, [id] DESC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO @@ -118,7 +118,7 @@ CREATE TABLE [dbo].[table_foreign]( CONSTRAINT [table_foreign_pkey] PRIMARY KEY NONCLUSTERED ( [aa] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] ALTER TABLE [dbo].[table_foreign] WITH CHECK ADD FOREIGN KEY([a]) @@ -134,7 +134,7 @@ CREATE TABLE [dbo].[table_primary]( CONSTRAINT [table_primary_pkey] PRIMARY KEY NONCLUSTERED ( [a] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO @@ -146,7 +146,7 @@ CREATE TABLE [dbo].[table_unique]( CONSTRAINT [table_unique_a_key] UNIQUE NONCLUSTERED ( [a] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO @@ -216,7 +216,7 @@ CREATE TABLE [dbo].[test_tsql_const]( CONSTRAINT [test_tsql_const_pkey] PRIMARY KEY NONCLUSTERED ( [c_int] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] ALTER TABLE [dbo].[test_tsql_const] WITH CHECK ADD CONSTRAINT [test_tsql_const_c_binary_check] CHECK (((c_binary > CAST(('0xfe') AS binary(8))))) @@ -237,7 +237,7 @@ CREATE TABLE [dbo].[test_upper]( [a] [char](1) NULL ) ON [PRIMARY] -ALTER TABLE [dbo].[test_upper] WITH CHECK ADD CONSTRAINT [test_upper_a_check] CHECK (((upper(a) IN ('A', 'B')))) +ALTER TABLE [dbo].[test_upper] WITH CHECK ADD CONSTRAINT [test_upper_a_check] CHECK (((sys.upper(a) IN ('A', 'B')))) ALTER TABLE [dbo].[test_upper] CHECK CONSTRAINT [test_upper_a_check] GO @@ -245,14 +245,14 @@ ALTER TABLE [dbo].[babel_4817_t1] ADD CONSTRAINT [babel_4817_t1_col2_col8_key] ( [col2] DESC, [col8] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [babel_4817_t1_idx_1babel_4817_t54b9390e1f9ca15d901db11774c8a339] ON [dbo].[babel_4817_t1] ( [col5] ASC ) -INCLUDE([col1]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +INCLUDE([col1]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO SET ANSI_PADDING ON @@ -261,14 +261,14 @@ ALTER TABLE [dbo].[babel_4817_t1] ADD CONSTRAINT [babel_4817_t1_pkey] PRIMARY K ( [col3] ASC, [col7] DESC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [babel_4817_t2_idxbabel_4817_t2ee980ac887cd6b2f46cd1527808a3a02] ON [dbo].[babel_4817_t2] ( [col5] ASC ) -INCLUDE([col1]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +INCLUDE([col1]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO SET ANSI_PADDING ON @@ -277,7 +277,7 @@ ALTER TABLE [dbo].[babel_4817_t2] ADD CONSTRAINT [babel_4817_t2_pk] PRIMARY KEY ( [col3] ASC, [col7] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO CREATE UNIQUE NONCLUSTERED INDEX [babel_4817_t2_unique_indexbabel58db3c54b7c753629ed4fc2951061d2a] ON [dbo].[babel_4817_t2] @@ -285,63 +285,63 @@ CREATE UNIQUE NONCLUSTERED INDEX [babel_4817_t2_unique_indexbabel58db3c54b7c7536 [col2] DESC, [col8] ASC ) -INCLUDE([col4]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +INCLUDE([col4]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO ALTER TABLE [dbo].[babel_4817_t4] ADD CONSTRAINT [babel_4817_t4_pkey] PRIMARY KEY NONCLUSTERED ( [filename] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO ALTER TABLE [dbo].[babel_4817_t5] ADD CONSTRAINT [babel_4817_t5_pkey] PRIMARY KEY NONCLUSTERED ( [filename] ASC, [id] DESC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [ix_testbabel_4817_t53c84a25c8e10b5bd55950897f8ca76a1] ON [dbo].[babel_4817_t5] ( [filename] ASC ) -INCLUDE([id],[commited_dt]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +INCLUDE([id],[commited_dt]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO ALTER TABLE [dbo].[table_foreign] ADD CONSTRAINT [table_foreign_pkey] PRIMARY KEY NONCLUSTERED ( [aa] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO ALTER TABLE [dbo].[table_primary] ADD CONSTRAINT [table_primary_pkey] PRIMARY KEY NONCLUSTERED ( [a] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO ALTER TABLE [dbo].[table_unique] ADD CONSTRAINT [table_unique_a_key] UNIQUE NONCLUSTERED ( [a] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [test_comp_indextable_unique54256857b8bed086a06f91b550a3a65b] ON [dbo].[table_unique] ( [a] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO ALTER TABLE [dbo].[test_tsql_const] ADD CONSTRAINT [test_tsql_const_pkey] PRIMARY KEY NONCLUSTERED ( [c_int] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [test_indextest_upper8e0335bba8a0f780c0c12b75ae201ead] ON [dbo].[test_upper] ( [a] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO GO diff --git a/test/python/expected/pyodbc/ddl_triggers.out b/test/python/expected/pyodbc/ddl_triggers.out index 5a98de5f1e3..06ade6a909b 100644 --- a/test/python/expected/pyodbc/ddl_triggers.out +++ b/test/python/expected/pyodbc/ddl_triggers.out @@ -15,7 +15,7 @@ CREATE TABLE [dbo].[babel_1654_vu_prepare_employeedata]( CONSTRAINT [babel_1654_vu_prepare_employeedata_pkey] PRIMARY KEY NONCLUSTERED ( [id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO @@ -30,7 +30,7 @@ CREATE TABLE [dbo].[babel_1654_vu_prepare_t]( CONSTRAINT [babel_1654_vu_prepare_t_pkey] PRIMARY KEY NONCLUSTERED ( [id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO @@ -48,17 +48,17 @@ GO ALTER TABLE [dbo].[babel_1654_vu_prepare_employeedata] ADD CONSTRAINT [babel_1654_vu_prepare_employeedata_pkey] PRIMARY KEY NONCLUSTERED ( [id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO ALTER TABLE [dbo].[babel_1654_vu_prepare_t] ADD CONSTRAINT [babel_1654_vu_prepare_t_pkey] PRIMARY KEY NONCLUSTERED ( [id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO -SET ANSI_NULLS ON -SET QUOTED_IDENTIFIER ON +SET ANSI_NULLS OFF +SET QUOTED_IDENTIFIER OFF CREATE TRIGGER [dbo].[babel_1654_vu_prepare_updemployeedatas] ON [dbo].[babel_1654_vu_prepare_employeedata] AFTER UPDATE,INSERT AS select COLUMNS_UPDATED(); update babel_1654_vu_prepare_t set a = 'sss' , b = 'sss' where id = 1; @@ -66,8 +66,8 @@ CREATE TRIGGER [dbo].[babel_1654_vu_prepare_updemployeedatas] ON [dbo].[babel_16 ALTER TABLE [dbo].[babel_1654_vu_prepare_employeedata] ENABLE TRIGGER [babel_1654_vu_prepare_updemployeedatas] GO -SET ANSI_NULLS ON -SET QUOTED_IDENTIFIER ON +SET ANSI_NULLS OFF +SET QUOTED_IDENTIFIER OFF CREATE TRIGGER babel_1654_vu_prepare_trig_t on babel_1654_vu_prepare_t after update as select COLUMNS_UPDATED(); ALTER TABLE [dbo].[babel_1654_vu_prepare_t] ENABLE TRIGGER [babel_1654_vu_prepare_trig_t] diff --git a/test/python/expected/sql_validation_framework/expected_create.out b/test/python/expected/sql_validation_framework/expected_create.out index aa18184d0c3..e56c711892d 100644 --- a/test/python/expected/sql_validation_framework/expected_create.out +++ b/test/python/expected/sql_validation_framework/expected_create.out @@ -17,6 +17,9 @@ Could not find tests for function sys.datepart_internal Could not find tests for function sys.default_domain Could not find tests for function sys.get_current_full_xact_id Could not find tests for function sys.get_host_os +Could not find tests for function sys.get_icu_major_version +Could not find tests for function sys.get_icu_minor_version +Could not find tests for function sys.is_collated_ai Could not find tests for function sys.is_collated_ci_as Could not find tests for function sys.is_collated_ci_as_internal Could not find tests for function sys.is_rolemember_internal @@ -25,6 +28,8 @@ Could not find tests for function sys.openjson_object Could not find tests for function sys.openjson_simple Could not find tests for function sys.openjson_with Could not find tests for function sys.openquery_internal +Could not find tests for function sys.patindex_ai_collations +Could not find tests for function sys.remove_accents_internal_using_cache Could not find tests for function sys.role_id Could not find tests for function sys.sp_columns_100_internal Could not find tests for function sys.sp_columns_managed_internal @@ -122,8 +127,11 @@ Could not find upgrade tests for function sys.fn_helpcollations Could not find upgrade tests for function sys.formatmessage Could not find upgrade tests for function sys.get_current_full_xact_id Could not find upgrade tests for function sys.get_host_os +Could not find upgrade tests for function sys.get_icu_major_version +Could not find upgrade tests for function sys.get_icu_minor_version Could not find upgrade tests for function sys.ident_incr Could not find upgrade tests for function sys.ident_seed +Could not find upgrade tests for function sys.is_collated_ai Could not find upgrade tests for function sys.is_collated_ci_as Could not find upgrade tests for function sys.is_collated_ci_as_internal Could not find upgrade tests for function sys.is_rolemember_internal @@ -134,7 +142,9 @@ Could not find upgrade tests for function sys.openjson_simple Could not find upgrade tests for function sys.openjson_with Could not find upgrade tests for function sys.openquery_internal Could not find upgrade tests for function sys.options +Could not find upgrade tests for function sys.patindex_ai_collations Could not find upgrade tests for function sys.pgerror +Could not find upgrade tests for function sys.remove_accents_internal_using_cache Could not find upgrade tests for function sys.role_id Could not find upgrade tests for function sys.servername Could not find upgrade tests for function sys.sp_columns_100_internal @@ -150,8 +160,6 @@ Could not find upgrade tests for function sys.sp_special_columns_precision_helpe Could not find upgrade tests for function sys.sp_special_columns_scale_helper Could not find upgrade tests for function sys.sp_statistics_internal Could not find upgrade tests for function sys.sp_tables_internal -Could not find upgrade tests for function sys.space -Could not find upgrade tests for function sys.stuff Could not find upgrade tests for function sys.suser_id_internal Could not find upgrade tests for function sys.suser_name_internal Could not find upgrade tests for function sys.systypes_precision_helper @@ -191,6 +199,8 @@ Could not find upgrade tests for procedure sys.sp_unprepare Could not find upgrade tests for procedure sys.sp_updatestats Could not find upgrade tests for table sys.babelfish_configurations Could not find upgrade tests for table sys.babelfish_helpcollation +Could not find upgrade tests for table sys.babelfish_partition_function +Could not find upgrade tests for table sys.babelfish_partition_scheme Could not find upgrade tests for table sys.babelfish_syslanguages Could not find upgrade tests for table sys.service_settings Could not find upgrade tests for table sys.spt_datatype_info_table diff --git a/test/python/expected/sql_validation_framework/expected_drop.out b/test/python/expected/sql_validation_framework/expected_drop.out index 9f2b0bd6c39..de8f103f03f 100644 --- a/test/python/expected/sql_validation_framework/expected_drop.out +++ b/test/python/expected/sql_validation_framework/expected_drop.out @@ -24,10 +24,12 @@ Unexpected drop found for function sys.babelfish_update_server_collation_name in Unexpected drop found for function sys.babelfish_update_server_collation_name in file babelfishpg_tsql--2.8.0--3.0.0.sql Unexpected drop found for function sys.babelfish_update_server_collation_name in file babelfishpg_tsql--2.9.0--3.0.0.sql Unexpected drop found for function sys.babelfish_update_server_collation_name in file babelfishpg_tsql--2.10.0--3.0.0.sql +Unexpected drop found for function sys.babelfish_update_server_collation_name in file babelfishpg_tsql--2.11.0--3.0.0.sql Unexpected drop found for function sys.babelfish_update_server_collation_name in file babelfishpg_tsql--3.4.0--4.0.0.sql Unexpected drop found for function sys.babelfish_update_server_collation_name in file babelfishpg_tsql--3.5.0--4.0.0.sql Unexpected drop found for function sys.babelfish_update_server_collation_name in file babelfishpg_tsql--3.6.0--4.0.0.sql Unexpected drop found for function sys.babelfish_update_server_collation_name in file babelfishpg_tsql--3.7.0--4.0.0.sql +Unexpected drop found for function sys.babelfish_update_server_collation_name in file babelfishpg_tsql--3.8.0--4.0.0.sql Unexpected drop found for function sys.babelfishpg_common_get_babel_server_collation_oid in file babelfishpg_common--2.2.0--2.3.0.sql Unexpected drop found for function sys.babelfishpg_tsql_get_babel_server_collation_oid in file babelfishpg_tsql--2.2.0--2.3.0.sql Unexpected drop found for function sys.babelfishpg_tsql_get_babel_server_collation_oid in file babelfishpg_tsql--2.3.0--3.0.0.sql @@ -76,3 +78,4 @@ Unexpected drop found for procedure sys.babelfish_update_user_catalog_for_guest Unexpected drop found for procedure sys.babelfish_update_user_catalog_for_guest_schema in file babelfishpg_tsql--3.3.0--3.4.0.sql Unexpected drop found for procedure sys.create_xp_qv_in_master_dbo in file babelfishpg_tsql--1.1.0--1.2.0.sql Unexpected drop found for procedure sys.sp_babelfish_grant_usage_to_all in file babelfishpg_tsql--1.1.0--1.2.0.sql +Unexpected drop found for table "#temp_schedules_to_delete" in file babelfishpg_tsql--4.2.0--4.3.0.sql diff --git a/test/python/expected/upgrade_validation/expected_dependency.out b/test/python/expected/upgrade_validation/expected_dependency.out index 428e5b045d5..377a2fcdc4d 100644 --- a/test/python/expected/upgrade_validation/expected_dependency.out +++ b/test/python/expected/upgrade_validation/expected_dependency.out @@ -1,5 +1,4 @@ Could not find dependencies on -Collation sys.arabic_cs_as Collation sys.bbf_unicode_cp1250_ci_ai Collation sys.bbf_unicode_cp1250_cs_ai Collation sys.bbf_unicode_cp1251_ci_ai @@ -37,8 +36,6 @@ Collation sys.bbf_unicode_pref_cp1257_cs_as Collation sys.bbf_unicode_pref_cp1258_cs_as Collation sys.bbf_unicode_pref_cp1_cs_as Collation sys.bbf_unicode_pref_cp874_cs_as -Collation sys.chinese_prc_ci_as -Collation sys.chinese_prc_cs_as Collation sys.cyrillic_general_ci_ai Collation sys.cyrillic_general_ci_as Collation sys.estonian_ci_as @@ -88,8 +85,6 @@ Function sys."nchar"(integer) Function sys."nchar"(sys."nchar",integer,boolean) Function sys."nchar"(sys.varbinary) Function sys."session_user"() -Function sys."substring"(sys."nchar",integer,integer) -Function sys."substring"(text,integer,integer) Function sys."system_user"() Function sys."varchar"(sys.geography) Function sys."varchar"(sys.geometry) @@ -223,6 +218,7 @@ Function sys.bbf_binary_cmp(sys.bbf_binary,sys.bbf_binary) Function sys.bbf_binary_varbinary_cmp(sys.bbf_binary,sys.bbf_varbinary) Function sys.bbf_get_context_info() Function sys.bbf_get_current_physical_schema_name(text) +Function sys.bbf_get_immediate_base_type_of_udt(oid) Function sys.bbf_is_shared_schema(text) Function sys.bbf_pivot() Function sys.bbf_varbinary(sys.geography) @@ -230,7 +226,6 @@ Function sys.bbf_varbinary(sys.geometry) Function sys.bbf_varbinary_binary_cmp(sys.bbf_varbinary,sys.bbf_binary) Function sys.bbf_varbinary_cmp(sys.bbf_varbinary,sys.bbf_varbinary) Function sys.bbfbinary_sqlvariant(sys.bbf_binary) -Function sys.bbfvarbinary(sys.bbf_varbinary,integer,boolean) Function sys.bbfvarbinary_sqlvariant(sys.bbf_varbinary) Function sys.bigint_avg(internal) Function sys.bigint_sqlvariant(bigint) @@ -303,7 +298,6 @@ Function sys.connectionproperty(text) Function sys.cursor_rows() Function sys.cursor_status(text,text) Function sys.databasepropertyex(text,text) -Function sys.datalength(anyelement) Function sys.datalength(character) Function sys.datalength(sys.sql_variant) Function sys.datalength(text) @@ -477,6 +471,8 @@ Function sys.geometry_helper(bytea) Function sys.geompoint_helper(double precision,double precision,integer) Function sys.get_current_full_xact_id() Function sys.get_host_os() +Function sys.get_icu_major_version() +Function sys.get_icu_minor_version() Function sys.get_valid_srids() Function sys.getdate() Function sys.getutcdate() @@ -520,6 +516,7 @@ Function sys.int8fixeddecimaldiv(bigint,sys.fixeddecimal) Function sys.int8fixeddecimaldiv(bigint,sys.smallmoney) Function sys.int8rowversion(bigint,integer,boolean) Function sys.int8varbinary(bigint,integer,boolean) +Function sys.is_collated_ai(text) Function sys.is_collated_ci_as(text) Function sys.is_collated_ci_as_internal(text) Function sys.is_member(character varying) @@ -566,6 +563,7 @@ Function sys.openquery_internal(text,text) Function sys.options() Function sys.original_login() Function sys.patindex(character varying,character varying) +Function sys.patindex_ai_collations(character varying,character varying) Function sys.pgerror() Function sys.pltsql_call_handler() Function sys.pltsql_inline_handler(internal) @@ -579,7 +577,7 @@ Function sys.rand(integer) Function sys.real_larger(sys."real",sys."real") Function sys.real_smaller(sys."real",sys."real") Function sys.real_sqlvariant(real) -Function sys.replicate(text,integer) +Function sys.remove_accents_internal_using_cache(text) Function sys.role_id(sys.sysname) Function sys.round(numeric,integer) Function sys.round(numeric,integer,integer) @@ -641,10 +639,8 @@ Function sys.sp_special_columns_precision_helper(text,integer,smallint,bigint) Function sys.sp_special_columns_scale_helper(text,integer) Function sys.sp_statistics_internal(sys.sysname,sys.sysname,sys.sysname,sys.sysname,character,character) Function sys.sp_tables_internal(sys.nvarchar,sys.nvarchar,sys.sysname,sys."varchar",sys."bit") -Function sys.space(integer) Function sys.sql_variant_property(sys.sql_variant,sys."varchar") Function sys.sqlvariant_bbfbinary(sys.sql_variant) -Function sys.sqlvariant_bbfvarbinary(sys.sql_variant) Function sys.sqlvariant_bigint(sys.sql_variant) Function sys.sqlvariant_bit(sys.sql_variant) Function sys.sqlvariant_char(sys.sql_variant) @@ -676,13 +672,15 @@ Function sys.st_zmflag(sys.geography) Function sys.st_zmflag(sys.geometry) Function sys.stasbinary_helper(sys.geography) Function sys.stastext_helper(sys.geography) +Function sys.stcontains_helper(sys.geography,sys.geography) +Function sys.stcontains_helper(sys.geometry,sys.geometry) Function sys.stdistance_helper(sys.geography,sys.geography) +Function sys.stequals_helper(sys.geography,sys.geography) +Function sys.stequals_helper(sys.geometry,sys.geometry) Function sys.stgeogfromtext_helper(text,integer) Function sys.stgeomfromtext_helper(text,integer) Function sys.string_escape(sys.nvarchar,text) Function sys.string_split(character varying,character varying) -Function sys.stuff(anyelement,integer,integer,anyelement) -Function sys.stuff(text,integer,integer,text) Function sys.suser_id() Function sys.suser_id_internal(text) Function sys.suser_name() @@ -776,7 +774,6 @@ Function sys.xact_state() Function sys.xid8rowversion(xid8,integer,boolean) Function sys.year(anyelement) Operator <=(sys.bpchar,sys.bpchar) -Operator <>(sys."varchar",sys."varchar") Operator <>(sys.bpchar,sys.bpchar) Operator <>(sys.bpchar,text) Operator <>(text,sys.bpchar) @@ -818,7 +815,6 @@ Operator sys.+(sys.fixeddecimal,integer) Operator sys.+(sys.fixeddecimal,smallint) Operator sys.+(sys.fixeddecimal,sys.fixeddecimal) Operator sys.+(sys.nvarchar,sys."varchar") -Operator sys.+(sys.nvarchar,sys.nvarchar) Operator sys.+(sys.smallmoney,bigint) Operator sys.+(sys.smallmoney,integer) Operator sys.+(sys.smallmoney,smallint) @@ -874,7 +870,6 @@ Operator sys.<(numeric,sys.fixeddecimal) Operator sys.<(smallint,sys.fixeddecimal) Operator sys.<(sys."bit",integer) Operator sys.<(sys."bit",sys."bit") -Operator sys.<(sys.bbf_binary,sys.bbf_binary) Operator sys.<(sys.bbf_varbinary,sys.bbf_varbinary) Operator sys.<(sys.datetime,sys.datetime) Operator sys.<(sys.datetime2,sys.datetime2) @@ -894,7 +889,6 @@ Operator sys.<=(numeric,sys.fixeddecimal) Operator sys.<=(smallint,sys.fixeddecimal) Operator sys.<=(sys."bit",integer) Operator sys.<=(sys."bit",sys."bit") -Operator sys.<=(sys.bbf_binary,sys.bbf_binary) Operator sys.<=(sys.bbf_varbinary,sys.bbf_varbinary) Operator sys.<=(sys.datetimeoffset,sys.datetimeoffset) Operator sys.<=(sys.fixeddecimal,bigint) @@ -915,7 +909,6 @@ Operator sys.<>(numeric,sys.fixeddecimal) Operator sys.<>(smallint,sys.fixeddecimal) Operator sys.<>(sys."bit",integer) Operator sys.<>(sys."bit",sys."bit") -Operator sys.<>(sys.bbf_binary,sys.bbf_binary) Operator sys.<>(sys.bbf_varbinary,sys.bbf_varbinary) Operator sys.<>(sys.datetime,sys.datetime) Operator sys.<>(sys.datetime2,sys.datetime2) @@ -937,7 +930,6 @@ Operator sys.=(integer,sys.fixeddecimal) Operator sys.=(numeric,sys.fixeddecimal) Operator sys.=(smallint,sys.fixeddecimal) Operator sys.=(sys."bit",sys."bit") -Operator sys.=(sys.bbf_binary,sys.bbf_binary) Operator sys.=(sys.datetime,sys.datetime) Operator sys.=(sys.datetime2,sys.datetime2) Operator sys.=(sys.datetimeoffset,sys.datetimeoffset) @@ -956,7 +948,6 @@ Operator sys.>(numeric,sys.fixeddecimal) Operator sys.>(smallint,sys.fixeddecimal) Operator sys.>(sys."bit",integer) Operator sys.>(sys."bit",sys."bit") -Operator sys.>(sys.bbf_binary,sys.bbf_binary) Operator sys.>(sys.bbf_varbinary,sys.bbf_varbinary) Operator sys.>(sys.datetime,sys.datetime) Operator sys.>(sys.datetime2,sys.datetime2) @@ -978,7 +969,6 @@ Operator sys.>=(numeric,sys.fixeddecimal) Operator sys.>=(smallint,sys.fixeddecimal) Operator sys.>=(sys."bit",integer) Operator sys.>=(sys."bit",sys."bit") -Operator sys.>=(sys.bbf_binary,sys.bbf_binary) Operator sys.>=(sys.bbf_varbinary,sys.bbf_varbinary) Operator sys.>=(sys.datetimeoffset,sys.datetimeoffset) Operator sys.>=(sys.fixeddecimal,bigint) diff --git a/test/python/input/ddl_partitions.sql b/test/python/input/ddl_partitions.sql new file mode 100644 index 00000000000..b42e271e340 --- /dev/null +++ b/test/python/input/ddl_partitions.sql @@ -0,0 +1,892 @@ + +-- This test files will check for scripting of partition functions, partition schemes, +-- partitioned tables and partitioned indexes. + +----------------------------------------------------- +--- Partition Function with All supported datatypes +----------------------------------------------------- +-- all datatypes should sort and store the values in ascending order by itself +-- and input values should be implicit casted into specified type + +-- using local variable in args +CREATE PARTITION FUNCTION IntPartitionFunction (int) +AS RANGE RIGHT FOR VALUES (0, 1000, 500); +GO + + +-- explicit schema can also be specified with paramater type +CREATE PARTITION FUNCTION BigIntPartitionFunction (sys.bigint) +AS RANGE RIGHT FOR VALUES (0, 10000, 100, 1000); +GO + +CREATE PARTITION FUNCTION SmallIntPartitionFunction (smallint) +AS RANGE RIGHT FOR VALUES (cast(32767 as bigint), -32768, 0); +GO + +-- explicit schema can also be specified with paramater type +CREATE PARTITION FUNCTION TinyIntPartitionFunction (sys.tinyint) +AS RANGE RIGHT FOR VALUES (0, cast(255 as varchar), 128); +GO + +CREATE PARTITION FUNCTION DecimalPartitionFunction (decimal(10, 5)) +AS RANGE RIGHT FOR VALUES (0.0, 300.0, 200.0, 100.0); +GO + +CREATE PARTITION FUNCTION NumericPartitionFunction (numeric(5, 2)) +AS RANGE RIGHT FOR VALUES (0.0, 30.0, 10.0, 20.0); +GO + +CREATE PARTITION FUNCTION MoneyPartitionFunction (MONEY) +AS RANGE RIGHT FOR VALUES ($2.56789, ¥4.91, $3.56789); +GO + +CREATE PARTITION FUNCTION SmallMoneyPartitionFunction (SMALLMONEY) +AS RANGE RIGHT FOR VALUES ($2.56789, ¥4.91, $3.56789); +GO + +CREATE PARTITION FUNCTION DatePartitionFunction (date) +AS RANGE RIGHT FOR VALUES ('2022-07-01', '2022-01-01','2023-01-01'); +GO + +-- should implicity cast it to input type +CREATE PARTITION FUNCTION DateTimePartitionFunction (datetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01 00:00:00', '2019-01-01 00:00:00'); +GO + +CREATE PARTITION FUNCTION DateTime2PartitionFunction (datetime2(3)) +AS RANGE RIGHT FOR VALUES ('2022-01-01 00:00:00.000', '2022-07-01 00:00:00.000', '2019-01-01 00:00:00.000'); +GO + +CREATE PARTITION FUNCTION SmallDateTimePartitionFunction (smalldatetime) +AS RANGE RIGHT FOR VALUES ('2022-01-01', '2022-07-01', '2019-01-01'); +GO + +CREATE PARTITION FUNCTION CharPartitionFunction (char(5)) +AS RANGE RIGHT FOR VALUES ('A', 'F', 'K', 'P', 'U', 'Z', 'D'); +GO + +CREATE PARTITION FUNCTION VarCharPartitionFunction (varchar(10)) +AS RANGE RIGHT FOR VALUES ('Apple', 'Banana', 'Mango', 'Cherry', 'Date'); +GO + +CREATE PARTITION FUNCTION NVarCharPartitionFunction (nvarchar(10)) +AS RANGE RIGHT FOR VALUES (N'Apple', N'Banana', N'Mango', N'Cherry', N'Date'); +GO + +CREATE PARTITION FUNCTION NCharPartitionFunction (nchar(5)) +AS RANGE RIGHT FOR VALUES (N'A', N'F', N'K', N'P', N'U', N'Z', N'B'); +GO + +CREATE PARTITION FUNCTION BinaryPartitionFunction (binary(4)) +AS RANGE RIGHT FOR VALUES (0x000, 0x800, 0x400, 0xC000); +GO + +CREATE PARTITION FUNCTION VarBinaryPartitionFunction (varbinary(8)) +AS RANGE RIGHT FOR VALUES (0x0000000000000000, 0x8000000000000000, 0x4000000000000000, 0xC000000000000000); +GO + +CREATE PARTITION FUNCTION UniqueIdentifierPartitionFunction (uniqueidentifier) +AS RANGE RIGHT FOR VALUES ('00000000-0000-0000-0000-000000000000', 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF', '6F9619FF-8B86-D011-B42D-00C04FC964FF'); +GO + +-- identifier length greater than 64 +CREATE PARTITION FUNCTION PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz (bigint) +AS RANGE RIGHT FOR VALUES (0, 10000, 100, 1000); +GO + +CREATE PARTITION FUNCTION PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder (bigint) +AS RANGE RIGHT FOR VALUES (0, 10000, 100, 1000); +GO + +CREATE PARTITION FUNCTION PartitionFunctionHavingDifferentCollationInput (NVARCHAR(50)) +AS RANGE RIGHT +FOR VALUES ( + N'John Doe', + N'Jane Smith' COLLATE Latin1_General_CI_AS, + N'châu phố' COLLATE Vietnamese_CI_AS, + N'Müller GmbH' COLLATE Traditional_Spanish_CI_AS +); +GO + +-------------------------------------------------- +--- Partition Scheme +-------------------------------------------------- + +-- without all option +-- filegroups are equal to partition that will generated by function +CREATE PARTITION SCHEME IntPartitionScheme AS +PARTITION IntPartitionFunction +TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]); +GO + +-- filgroups are more than partition that will generated by function +CREATE PARTITION SCHEME BigIntPartitionScheme AS +PARTITION BigIntPartitionFunction +TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]); +GO + +-- with all option +CREATE PARTITION SCHEME SmallIntPartitionScheme AS +PARTITION SmallIntPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME TinyIntPartitionScheme AS +PARTITION TinyIntPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME DecimalPartitionScheme AS +PARTITION DecimalPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME NumericPartitionScheme AS +PARTITION NumericPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME MoneyPartitionScheme AS +PARTITION MoneyPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME SmallMoneyPartitionScheme AS +PARTITION SmallMoneyPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME DatePartitionScheme AS +PARTITION DatePartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME DateTimePartitionScheme AS +PARTITION DateTimePartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME DateTime2PartitionScheme AS +PARTITION DateTime2PartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME SmallDateTimePartitionScheme AS +PARTITION SmallDateTimePartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME CharPartitionScheme AS +PARTITION CharPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME VarCharPartitionScheme AS +PARTITION VarCharPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME NVarCharPartitionScheme AS +PARTITION NVarCharPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME NCharPartitionScheme AS +PARTITION NCharPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME BinaryPartitionScheme AS +PARTITION BinaryPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME VarBinaryPartitionScheme AS +PARTITION VarBinaryPartitionFunction +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME UniqueIdentifierPartitionScheme AS +PARTITION UniqueIdentifierPartitionFunction +ALL TO ([PRIMARY]); +GO + +-- identifier length greater than 64 +CREATE PARTITION SCHEME PartitionSchemeNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz AS +PARTITION PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION SCHEME PartitionSchemeNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder AS +PARTITION PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +ALL TO ([PRIMARY]); +GO + +CREATE SCHEMA PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz +GO + +CREATE TABLE PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz ( + PartitionColumnNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz BIGINT, + Value sys.varchar(50) +) ON PartitionSchemeNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz (PartitionColumnNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz); +GO + +CREATE INDEX PartitionIndexNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz +ON PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz(Value) +ON PartitionSchemeNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz +(PartitionColumnNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz); +GO + +CREATE TABLE PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder ( + PartitionColumnNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz BIGINT, + Value sys.varchar(50) +) ON PartitionSchemeNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +(PartitionColumnNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz); +GO + +CREATE INDEX PartitionIndexNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz +ON PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder(Value) +ON PartitionSchemeNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +(PartitionColumnNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz); +GO + +-------------------------------------------------- +--- name identifiers test +-------------------------------------------------- +CREATE PARTITION FUNCTION PARTITION_FUNCTIONログインαιώνια (int) +AS RANGE RIGHT FOR VALUES (0, 500, 1000); +GO + +CREATE PARTITION SCHEME PARTITION_SCHEMEログインαιώνια AS +PARTITION PARTITION_FUNCTIONログインαιώνια +ALL TO ([PRIMARY]); +GO + +CREATE PARTITION FUNCTION [PARTITION_FUNCTION 유니코드스키마👻 ] (int) +AS RANGE RIGHT FOR VALUES (0, 500, 1000); +GO + +CREATE PARTITION SCHEME [PARTITION_SCHEME 유니코드스키마👻 ] AS +PARTITION [PARTITION_FUNCTION 유니코드스키마👻 ] +ALL TO ([PRIMARY]); +GO + +CREATE TABLE [PARTITION_TABLE 유니코드스키마👻 ]( + [PARTITION_COLUMN 유니코드스키마👻 ] INT, + Value sys.varchar(50) +) ON [PARTITION_SCHEME 유니코드스키마👻 ]([PARTITION_COLUMN 유니코드스키마👻 ]); +GO + +CREATE INDEX [PARTITION_INDEX 유니코드스키마👻 ] +ON [PARTITION_TABLE 유니코드스키마👻 ](Value) +ON [PARTITION_SCHEME 유니코드스키마👻 ]([PARTITION_COLUMN 유니코드스키마👻 ]); +GO + +-- qouted identifer +SET QUOTED_IDENTIFIER ON; +GO + +CREATE PARTITION FUNCTION "PARTITION_FUNCTION 😎$@ #123 🌍rder " (int) +AS RANGE RIGHT FOR VALUES (0, 500, 1000); +GO + +CREATE PARTITION SCHEME "PARTITION_SCHEME 😎$@ #123 🌍rder " AS +PARTITION "PARTITION_FUNCTION 😎$@ #123 🌍rder " +ALL TO ([PRIMARY]); +GO + + +CREATE TABLE "PARTITION_TABLE 😎$@ #123 🌍rder " ( + "PARTITION_COLUMN 😎$@ #123 🌍rder " INT, + Value sys.varchar(50) +) ON "PARTITION_SCHEME 😎$@ #123 🌍rder " ("PARTITION_COLUMN 😎$@ #123 🌍rder "); +GO + +CREATE INDEX "PARTITION_INDEX 😎$@ #123 🌍rder " +ON "PARTITION_TABLE 😎$@ #123 🌍rder " (Value) +ON "PARTITION_SCHEME 😎$@ #123 🌍rder "("PARTITION_COLUMN 😎$@ #123 🌍rder "); +GO + +SET QUOTED_IDENTIFIER OFF; +Go + + +--------------------------------------------------------------------------- +--- CREATE PARTITIONED TABLES with PARTITION SCHEME for different datatypes +--------------------------------------------------------------------------- +-- int data type +CREATE TABLE partition_vu_prepare_int_table ( + Id INT UNIQUE, + Value sys.varchar(50) +) ON IntPartitionScheme(Id); +GO + +-- add constraint +ALTER TABLE partition_vu_prepare_int_table ADD CONSTRAINT check_value_not_null CHECK(value IS NOT NULL); +GO + +-- bigint data type +CREATE TABLE partition_vu_prepare_bigint_table ( + Id BIGINT, + Value sys.varchar(50) +) ON BigIntPartitionScheme--this is comment should get ignored +(Id); +GO + +-- smallint data type +CREATE TABLE partition_vu_prepare_smallint_table ( + Id SMALLINT, + Value sys.varchar(50) +) ON SmallIntPartitionScheme(Id); +GO + +-- tinyint data type +CREATE TABLE partition_vu_prepare_tinyint_table ( + Id TINYINT, + Value sys.varchar(50) +) ON TinyIntPartitionScheme(Id); +GO + +-- decimal data type +CREATE TABLE partition_vu_prepare_decimal_table ( + Id DECIMAL(10, 5), + Value sys.varchar(50) +) ON DecimalPartitionScheme(Id); +GO + +-- numeric data type +CREATE TABLE partition_vu_prepare_numeric_table ( + Id NUMERIC(5, 2), + Value sys.varchar(50) +) ON NumericPartitionScheme(Id); +GO + +-- money data type +CREATE TABLE partition_vu_prepare_money_table ( + Id MONEY, + Value sys.varchar(50) +) ON MoneyPartitionScheme(Id); +GO + +-- smallmoney data type +CREATE TABLE partition_vu_prepare_smallmoney_table ( + Id SMALLMONEY, + Value sys.varchar(50) +) ON SmallMoneyPartitionScheme(Id); +GO + +-- date data type +CREATE TABLE partition_vu_prepare_date_table ( + Id DATE, + Value sys.varchar(50) +) ON DatePartitionScheme(Id); +GO + +-- datetime data type +CREATE TABLE partition_vu_prepare_datetime_table ( + Id DATETIME, + Value sys.varchar(50) +) ON DateTimePartitionScheme(Id); +GO + +-- datetime2 data type +CREATE TABLE partition_vu_prepare_datetime2_table ( + Id DATETIME2(3), + Value sys.varchar(50) +) ON DateTime2PartitionScheme(Id); +GO + +-- smalldatetime data type +CREATE TABLE partition_vu_prepare_smalldatetime_table ( + Id SMALLDATETIME, + Value sys.varchar(50) +) ON SmallDateTimePartitionScheme(Id); +GO + +-- char data type +CREATE TABLE partition_vu_prepare_char_table ( + Id CHAR(5), + Value sys.varchar(50) +) ON CharPartitionScheme(Id); +GO + +-- varchar data type +CREATE TABLE partition_vu_prepare_varchar_table ( + Id VARCHAR(10), + Value sys.varchar(50) +) ON VarCharPartitionScheme(Id); +GO + +-- nvarchar data type +CREATE TABLE partition_vu_prepare_nvarchar_table ( + Id NVARCHAR(10), + Value sys.varchar(50) +) ON NVarCharPartitionScheme(Id); +GO + +-- nchar data type +CREATE TABLE partition_vu_prepare_nchar_table ( + Id NCHAR(5), + Value sys.varchar(50) +) ON NCharPartitionScheme(Id); +GO + +-- binary data type +CREATE TABLE partition_vu_prepare_binary_table ( + Id BINARY(4), + Value sys.varchar(50) +) ON BinaryPartitionScheme(Id); +GO + +-- varbinary data type +CREATE TABLE partition_vu_prepare_varbinary_table ( + Id VARBINARY(8), + Value sys.varchar(50) +) ON VarBinaryPartitionScheme(Id); +GO + +-- uniqueidentifier data type +CREATE TABLE partition_vu_prepare_uniqueidentifier_table ( + Id UNIQUEIDENTIFIER, + Value sys.varchar(50) +) ON UniqueIdentifierPartitionScheme(Id); +GO + +-- identifier length greater than 64 +CREATE TABLE PartitionTableNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz ( + Id INT, + Value sys.varchar(50) +) ON IntPartitionScheme(Id); +GO + +--------------------------------------------------------------------------- +--- CREATE ALIGNED PARTITIONED INDEX with PARTITION SCHEME +--------------------------------------------------------------------------- +-- using schema name +CREATE INDEX partition_vu_prepare_int_index +ON dbo.partition_vu_prepare_int_table(Value) +ON IntPartitionScheme (Id); +GO + +-- without explicit schema name +CREATE INDEX partition_vu_prepare_bigint_index +ON partition_vu_prepare_bigint_table(Id) +ON BigIntPartitionScheme (Id); +GO + +-- without partition scheme should also work +CREATE INDEX partition_vu_prepare_smallint_index +ON partition_vu_prepare_smallint_table--this is comment should get ignored +(Id) +GO + +CREATE INDEX partition_vu_prepare_tinyint_index +ON partition_vu_prepare_tinyint_table(Id) +ON TinyIntPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_decimal_index +ON partition_vu_prepare_decimal_table(Id) +ON DecimalPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_numeric_index +ON partition_vu_prepare_numeric_table(Id) +ON NumericPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_money_index +ON partition_vu_prepare_money_table(Id) +ON MoneyPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_smallmoney_index +ON partition_vu_prepare_smallmoney_table(Id) +ON SmallMoneyPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_date_index +ON partition_vu_prepare_date_table(Id) +ON DatePartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_datetime_index +ON partition_vu_prepare_datetime_table(Id) +ON DateTimePartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_datetime2_index +ON partition_vu_prepare_datetime2_table(Id) +ON DateTime2PartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_smalldatetime_index +ON partition_vu_prepare_smalldatetime_table(Id) +ON SmallDateTimePartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_char_index +ON partition_vu_prepare_char_table(Id) +ON CharPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_varchar_index +ON partition_vu_prepare_varchar_table(Id) +ON VarCharPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_nvarchar_index +ON partition_vu_prepare_nvarchar_table(Id) +ON NVarCharPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_nchar_index +ON partition_vu_prepare_nchar_table(Id) +ON NCharPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_binary_index +ON partition_vu_prepare_binary_table(Id) +ON BinaryPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_varbinary_index +ON partition_vu_prepare_varbinary_table(Id) +ON VarBinaryPartitionScheme (Id); +GO + +CREATE INDEX partition_vu_prepare_uniqueidentifier_index +ON partition_vu_prepare_uniqueidentifier_table(Id) +ON UniqueIdentifierPartitionScheme (Id); +GO + +-------------------------------------------------- +--- DROP Partitioned Index +-------------------------------------------------- +--DROP + +DROP INDEX partition_vu_prepare_uniqueidentifier_index ON partition_vu_prepare_uniqueidentifier_table; +GO + +DROP INDEX partition_vu_prepare_varbinary_index ON partition_vu_prepare_varbinary_table; +GO + +DROP INDEX partition_vu_prepare_binary_index ON partition_vu_prepare_binary_table; +GO + +DROP INDEX partition_vu_prepare_nchar_index ON partition_vu_prepare_nchar_table; +GO + +DROP INDEX partition_vu_prepare_nvarchar_index ON partition_vu_prepare_nvarchar_table; +GO + +DROP INDEX partition_vu_prepare_varchar_index ON partition_vu_prepare_varchar_table; +GO + +DROP INDEX partition_vu_prepare_char_index ON partition_vu_prepare_char_table; +GO + +DROP INDEX partition_vu_prepare_smalldatetime_index ON partition_vu_prepare_smalldatetime_table; +GO + +DROP INDEX partition_vu_prepare_datetime2_index ON partition_vu_prepare_datetime2_table; +GO + +DROP INDEX partition_vu_prepare_datetime_index ON partition_vu_prepare_datetime_table; +GO + +DROP INDEX partition_vu_prepare_date_index ON partition_vu_prepare_date_table; +GO + +DROP INDEX partition_vu_prepare_smallmoney_index ON partition_vu_prepare_smallmoney_table; +GO + +DROP INDEX partition_vu_prepare_money_index ON partition_vu_prepare_money_table; +GO + +DROP INDEX partition_vu_prepare_numeric_index ON partition_vu_prepare_numeric_table; +GO + +DROP INDEX partition_vu_prepare_decimal_index ON partition_vu_prepare_decimal_table; +GO + +DROP INDEX partition_vu_prepare_tinyint_index ON partition_vu_prepare_tinyint_table; +GO + +DROP INDEX partition_vu_prepare_smallint_index ON partition_vu_prepare_smallint_table; +GO + +DROP INDEX partition_vu_prepare_bigint_index ON partition_vu_prepare_bigint_table; +GO + +DROP INDEX partition_vu_prepare_int_index ON partition_vu_prepare_int_table; +GO + +DROP INDEX [PARTITION_INDEX 유니코드스키마👻 ] ON [PARTITION_TABLE 유니코드스키마👻 ] +GO + +SET QUOTED_IDENTIFIER ON; +GO + +DROP INDEX "PARTITION_INDEX 😎$@ #123 🌍rder " ON "PARTITION_TABLE 😎$@ #123 🌍rder " +GO + +SET QUOTED_IDENTIFIER OFF; +GO + +DROP INDEX PartitionIndexNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz +ON PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz +GO + +DROP INDEX PartitionIndexNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz +ON PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +GO +-------------------------------------------------- +--- DROP Partitioned Table +-------------------------------------------------- + +DROP TABLE partition_vu_prepare_uniqueidentifier_table; +GO + +DROP TABLE partition_vu_prepare_varbinary_table; +GO + +DROP TABLE partition_vu_prepare_binary_table; +GO + +DROP TABLE partition_vu_prepare_nchar_table; +GO + +DROP TABLE partition_vu_prepare_nvarchar_table; +GO + +DROP TABLE partition_vu_prepare_varchar_table; +GO + +DROP TABLE partition_vu_prepare_char_table; +GO + +DROP TABLE partition_vu_prepare_smalldatetime_table; +GO + +DROP TABLE partition_vu_prepare_datetime2_table; +GO + +DROP TABLE partition_vu_prepare_datetime_table; +GO + +DROP TABLE partition_vu_prepare_date_table; +GO + +DROP TABLE partition_vu_prepare_smallmoney_table; +GO + +DROP TABLE partition_vu_prepare_money_table; +GO + +DROP TABLE partition_vu_prepare_numeric_table; +GO + +DROP TABLE partition_vu_prepare_decimal_table; +GO + +DROP TABLE partition_vu_prepare_tinyint_table; +GO + +DROP TABLE partition_vu_prepare_smallint_table; +GO + +DROP TABLE partition_vu_prepare_bigint_table; +GO + +DROP TABLE partition_vu_prepare_int_table; +GO + +DROP TABLE PartitionTableNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz +GO + + +DROP TABLE [PARTITION_TABLE 유니코드스키마👻 ] +GO + +SET QUOTED_IDENTIFIER ON; +GO + +DROP TABLE "PARTITION_TABLE 😎$@ #123 🌍rder " +GO + +SET QUOTED_IDENTIFIER OFF; +GO + +DROP TABLE PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan128abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxyz +GO + +DROP TABLE PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz.PartitionTableNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +GO + +DROP SCHEMA PartitionSchemaNameGreaterThan64abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz +GO +-------------------------------------------------- +--- DROP Partition Scheme +-------------------------------------------------- +DROP PARTITION SCHEME IntPartitionScheme +GO + +DROP PARTITION SCHEME BigIntPartitionScheme +GO + +DROP PARTITION SCHEME SmallIntPartitionScheme +GO + +DROP PARTITION SCHEME TinyIntPartitionScheme +GO + +DROP PARTITION SCHEME DecimalPartitionScheme +GO + +DROP PARTITION SCHEME NumericPartitionScheme +GO + +DROP PARTITION SCHEME MoneyPartitionScheme +GO + +DROP PARTITION SCHEME SmallMoneyPartitionScheme +GO + +DROP PARTITION SCHEME DatePartitionScheme +GO + +DROP PARTITION SCHEME DateTimePartitionScheme +GO + +DROP PARTITION SCHEME DateTime2PartitionScheme +GO + +DROP PARTITION SCHEME SmallDateTimePartitionScheme +GO + +DROP PARTITION SCHEME CharPartitionScheme +GO + +DROP PARTITION SCHEME VarCharPartitionScheme +GO + +DROP PARTITION SCHEME NVarCharPartitionScheme +GO + +DROP PARTITION SCHEME NCharPartitionScheme +GO + +DROP PARTITION SCHEME BinaryPartitionScheme +GO + +DROP PARTITION SCHEME VarBinaryPartitionScheme +GO + +DROP PARTITION SCHEME UniqueIdentifierPartitionScheme +GO + +DROP PARTITION SCHEME PartitionSchemeNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz +GO + +DROP PARTITION SCHEME PARTITION_SCHEMEログインαιώνια +GO + +DROP PARTITION SCHEME [PARTITION_SCHEME 유니코드스키마👻 ] +GO + +SET QUOTED_IDENTIFIER ON; +GO + +DROP PARTITION SCHEME "PARTITION_SCHEME 😎$@ #123 🌍rder " +Go + +SET QUOTED_IDENTIFIER OFF; +GO + +DROP PARTITION SCHEME PartitionSchemeNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +GO + +------------------------------------------- +--- DROP Partition Function +------------------------------------------- +DROP PARTITION FUNCTION IntPartitionFunction +GO + +DROP PARTITION FUNCTION BigIntPartitionFunction +GO + +DROP PARTITION FUNCTION SmallIntPartitionFunction +GO + +DROP PARTITION FUNCTION TinyIntPartitionFunction +GO + +DROP PARTITION FUNCTION DecimalPartitionFunction +GO + +DROP PARTITION FUNCTION NumericPartitionFunction +GO + +DROP PARTITION FUNCTION MoneyPartitionFunction +GO + +DROP PARTITION FUNCTION SmallMoneyPartitionFunction +GO + +DROP PARTITION FUNCTION DatePartitionFunction +GO + +DROP PARTITION FUNCTION DateTimePartitionFunction +GO + +DROP PARTITION FUNCTION DateTime2PartitionFunction +GO + +DROP PARTITION FUNCTION SmallDateTimePartitionFunction +GO + +DROP PARTITION FUNCTION CharPartitionFunction +GO + +DROP PARTITION FUNCTION VarCharPartitionFunction +GO + +DROP PARTITION FUNCTION NVarCharPartitionFunction +GO + +DROP PARTITION FUNCTION NCharPartitionFunction +GO + +DROP PARTITION FUNCTION BinaryPartitionFunction +GO + +DROP PARTITION FUNCTION VarBinaryPartitionFunction +GO + +DROP PARTITION FUNCTION UniqueIdentifierPartitionFunction +GO + +DROP PARTITION FUNCTION PartitionFunctionNameGreaterThan64AndLessThan128abcdefghijklmnopqrstuvwxyz +GO + +DROP PARTITION FUNCTION PartitionFunctionHavingDifferentCollationInput +GO + +DROP PARTITION FUNCTION PARTITION_FUNCTIONログインαιώνια +GO + +DROP PARTITION FUNCTION [PARTITION_FUNCTION 유니코드스키마👻 ] +GO + +DROP PARTITION FUNCTION PartitionFunctionNameGreaterThan64AndLessThan128HavingEmoji😎$123🌍rder +GO + +SET QUOTED_IDENTIFIER ON; +GO + +DROP PARTITION FUNCTION "PARTITION_FUNCTION 😎$@ #123 🌍rder " +Go + +SET QUOTED_IDENTIFIER OFF; +GO \ No newline at end of file